From 124e5afe5a049664618fa159f7113c12267424aa Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 5 Feb 2024 00:16:06 +0100 Subject: [PATCH] refactor: renamed to differentiate command types --- .../{self_roles.js => slash_self_roles.js} | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) rename commands/admin/{self_roles.js => slash_self_roles.js} (92%) diff --git a/commands/admin/self_roles.js b/commands/admin/slash_self_roles.js similarity index 92% rename from commands/admin/self_roles.js rename to commands/admin/slash_self_roles.js index 73dd62c..1494912 100644 --- a/commands/admin/self_roles.js +++ b/commands/admin/slash_self_roles.js @@ -38,7 +38,9 @@ const registerSelfRoles = async (interaction) => { response.msgID = id; return response; - } catch (_) { + } catch (error) { + console.error(error); + // Reply failed to acknowledge command await interaction.reply({ content: 'Failed to fetch message!', @@ -92,7 +94,9 @@ const addSelfRoles = async (interaction) => { }); console.info(`[INFO] Added new entry to get role with ID '${role.id}' using '${emoji}'.`); - } catch (_) { + } catch (error) { + console.error(error); + // Reply failed to acknowledge command await interaction.reply({ content: `Failed to ${step} message!`, @@ -163,7 +167,19 @@ export async function execute(interaction) { } if (createNew) { + try { + // Create database entry + Message.create({ id }); + } catch (error) { + console.error(error); + + // Reply failed to acknowledge command + await interaction.followUp({ + content: 'Failed to save data from message!', + ephemeral: true, + }); + } + console.info(`[INFO] New self roles on message with ID: '${id}'.`); - Message.create({ id }); } }