Inform enduser on failed interaction
This commit is contained in:
parent
7225739527
commit
cf3102cbc5
1 changed files with 10 additions and 1 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue