From 84056d70360dface69b139a9f4e0adaf1c36478a Mon Sep 17 00:00:00 2001 From: tresabhi Date: Sat, 3 Jun 2023 01:22:24 +0000 Subject: [PATCH] fix: removed not needed try catch for executing commands --- src/events/interactionCreate.ts | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 07955bf91..b64e953ac 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -80,11 +80,7 @@ export default async function interactionCreate( return; } - try { - if (command.autocomplete) command.autocomplete(interaction); - } catch (error) { - console.error(error); - } + if (command.autocomplete) command.autocomplete(interaction); } else if (interaction.isChatInputCommand()) { const command = commandCollection.get(interaction.commandName); @@ -95,22 +91,8 @@ export default async function interactionCreate( return; } - try { - await interaction.deferReply(); - console.log(interaction.toString()); - 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!', - }); - } - } + console.log(interaction.toString()); + await interaction.deferReply(); + command.execute(interaction); } }