fix: removed not needed try catch for executing commands

This commit is contained in:
TresAbhi committed 2023-06-03 01:22:24 +00:00
1 parent 96ae6b715f
commit 84056d7036
1 file changed
+4 -22
+4 -22
View File
@@ -80,11 +80,7 @@ export default async function interactionCreate(
return; return;
} }
try { if (command.autocomplete) command.autocomplete(interaction);
if (command.autocomplete) command.autocomplete(interaction);
} catch (error) {
console.error(error);
}
} else if (interaction.isChatInputCommand()) { } else if (interaction.isChatInputCommand()) {
const command = commandCollection.get(interaction.commandName); const command = commandCollection.get(interaction.commandName);
@@ -95,22 +91,8 @@ export default async function interactionCreate(
return; return;
} }
try { console.log(interaction.toString());
await interaction.deferReply(); await interaction.deferReply();
console.log(interaction.toString()); command.execute(interaction);
command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: 'There was an error while executing this command!',
ephemeral: true,
});
} else {
await interaction.editReply({
content: 'There was an error while executing this command!',
});
}
}
} }
} }