From d268f522373f6c280fd5f7dd8864d4714bdf5360 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 2 Sep 2023 19:33:32 -0400 Subject: [PATCH] Catch errors on message send (Fix #4) --- main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index 6727767..8ef9bf1 100755 --- a/main.js +++ b/main.js @@ -69,7 +69,7 @@ client.on('interactionCreate', async interaction => { if (client.slashCommands.has(commandName)) { client.slashCommands.get(commandName).execute(interaction); } else { - interaction.reply('Sorry, I don\'t have access to that command.'); + interaction.reply('Sorry, I don\'t have access to that command.').catch(e => console.err(e)); console.error('Slash command attempted to run but not found: ' + commandName); } } @@ -79,7 +79,7 @@ client.on('interactionCreate', async interaction => { case 'refresh': // console.log(JSON.stringify(interaction)); await fn.refresh(interaction).catch(err => { - interaction.channel.send(fn.builders.errorEmbed("Oops! Something went wrong!")); + interaction.channel.send(fn.builders.errorEmbed("Oops! Something went wrong!")).catch(e => console.err(e)); }); break; case 'deleteping': @@ -103,10 +103,10 @@ client.on('interactionCreate', async interaction => { } } catch(err) { if (err === "Guild doesn't exist in database!") { - interaction.channel.send(fn.builders.errorEmbed(strings.error.noGuild)); + interaction.channel.send(fn.builders.errorEmbed(strings.error.noGuild)).catch(e => console.err(e)); console.error(err); } else { - interaction.channel.send("Oops! An error occurred... Sorry about that, please contact my owner @vfsh if this keeps happening."); + interaction.channel.send("Oops! An error occurred... Sorry about that, please contact my owner @vfsh if this keeps happening.").catch(e => console.err(e)); console.error(err); } } @@ -117,7 +117,7 @@ client.on('messageUpdate', async (oldMessage, message) => { await fn.messages.updateHandler(message).catch(async e => { switch (e) { case strings.error.noCompareMessage: - await message.channel.send(strings.error.noCompareMessage); + await message.channel.send(strings.error.noCompareMessage).catch(e => console.err(e)); break; default: break;