Catch errors on message send (Fix #4)

This commit is contained in:
Skylar Grant 2023-09-02 19:33:32 -04:00
parent 4f576f9b5d
commit d268f52237
1 changed files with 5 additions and 5 deletions

10
main.js
View File

@ -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;