diff --git a/index.js b/index.js index 0b10cd0..ee8968b 100644 --- a/index.js +++ b/index.js @@ -22,6 +22,17 @@ client.on("ready", () => { console.log(`Logged in as ${client.user.tag}!`); }); +// send message on error +client.on("error", (error) => { + console.error(error); + let channel = client.channels.cache.get(COMMAND_CHANNEL_ID); + if (!channel) return console.error("Can't find command channel"); + client.channels.cache + .get(COMMAND_CHANNEL_ID) + .send(`error: ${error.message}`) + .catch(console.error); +}); + client.on("interactionCreate", async (interaction) => { const command = interaction.commandName; if (!interaction.isChatInputCommand()) return;