Inform enduser on failed interaction

This commit is contained in:
Wroclaw 2023-07-31 12:11:23 +02:00
parent 7225739527
commit cf3102cbc5

View file

@ -30,7 +30,16 @@ export default class CommandManager {
) {
const foundCommand = this.commands.find((command) => command.name === interaction.commandName );
if (!foundCommand) throw new Error(`Unknown command received (${interaction.commandName}). Did you forgot to push updated commands?`);
foundCommand.execute(interaction);
foundCommand.execute(interaction).catch(e => {
interaction.reply({
embeds: [{
color: 0xff0000,
description: `Failed to perform interaction:\n\`${e}\``,
}]
}).catch(() => {/* GRACEFAIL: We're still logging the issue that happened to the console */});
console.error(`Failed to perform interaction: ${interaction.commandName}`);
console.error(e);
});
return;
}
if (interaction.isAutocomplete()) {