Show error message

This commit is contained in:
Supositware 2024-01-30 00:25:41 +01:00
parent fe014ca7d7
commit d96d32f008
2 changed files with 9 additions and 2 deletions

View file

@ -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 });
}
},
};

View file

@ -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}\`` });
});
}
},
};