From d96d32f008bef55a12ffe9376d2e1b7da87afd34 Mon Sep 17 00:00:00 2001 From: Supositware Date: Tue, 30 Jan 2024 00:25:41 +0100 Subject: [PATCH] Show error message --- events/client/interactionCreate.js | 4 +++- events/client/messageCreate.js | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/events/client/interactionCreate.js b/events/client/interactionCreate.js index 9e9abf9..b6873b2 100644 --- a/events/client/interactionCreate.js +++ b/events/client/interactionCreate.js @@ -1,3 +1,5 @@ +// TODO: Moving that to a dedicated function that works for both messages and interactions + import { PermissionFlagsBits, InteractionType } from 'discord.js'; import db from '../../models/index.js'; import ratelimiter from '../../utils/ratelimiter.js'; @@ -114,7 +116,7 @@ export default { } catch (error) { console.error(error); - await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true }); + await interaction.followUp({ content: `There was an error while executing this command!\n\`${error}\``, ephemeral: true }); } }, }; diff --git a/events/client/messageCreate.js b/events/client/messageCreate.js index 5d041e6..1649c3f 100644 --- a/events/client/messageCreate.js +++ b/events/client/messageCreate.js @@ -253,6 +253,7 @@ export default { } // Command handling from message + // TODO: Moving that to a dedicated function that works for both messages and interactions let hasPrefix = false; prefixs.forEach(p => { @@ -440,7 +441,11 @@ export default { } catch (error) { console.error(error); - await message.reply({ content: 'There was an error while executing this command!', ephemeral: true }); + await message.reply({ content: `There was an error while executing this command!\n\`${error}\`` }) + .catch(async () => { + await message.channel.send({ content: `There was an error while executing this command!\n\`${error}\`` }); + }); + } }, };