aboutsummaryrefslogtreecommitdiff
path: root/bot/src/events/InteractionCreate.js
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-03-02 22:27:57 -0500
committerAndrew Lee <andrew@alee14.me>2025-03-02 22:27:57 -0500
commitcf1382d88c5e3298923c8cb243b7bc5751e68b53 (patch)
treea38351317594ed660fc80c784cdf7dbc71f5656b /bot/src/events/InteractionCreate.js
parent1c253d25cb1d35aa987d76e07806999c562712d6 (diff)
downloadAleeBot-cf1382d88c5e3298923c8cb243b7bc5751e68b53.tar.gz
AleeBot-cf1382d88c5e3298923c8cb243b7bc5751e68b53.tar.bz2
AleeBot-cf1382d88c5e3298923c8cb243b7bc5751e68b53.zip
Ported more commands; Made embed colour a const; Cleanup
Diffstat (limited to 'bot/src/events/InteractionCreate.js')
-rw-r--r--bot/src/events/InteractionCreate.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/bot/src/events/InteractionCreate.js b/bot/src/events/InteractionCreate.js
index 4e39241..eadef09 100644
--- a/bot/src/events/InteractionCreate.js
+++ b/bot/src/events/InteractionCreate.js
@@ -2,7 +2,7 @@ import { Events, MessageFlags } from 'discord.js';
export default {
name: Events.InteractionCreate,
- async execute(interaction, client) {
+ async execute(interaction) {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
@@ -10,10 +10,14 @@ export default {
if (!command) return;
try {
- await command.execute(interaction, client);
+ await command.execute(interaction);
} catch (e) {
- console.error(e);
- await interaction.reply({ content: `Something went wrong. Send the following error message to Alee:\n\`\`\`${e}\`\`\``, flags: MessageFlags.Ephemeral });
+ console.log(e);
+ if (interaction.replied || interaction.deferred) {
+ await interaction.followUp({ content: `Something went wrong. The following error message:\n\`\`\`${e}\`\`\``, flags: MessageFlags.Ephemeral });
+ } else {
+ await interaction.reply({ content: `Something went wrong. The following error message:\n\`\`\`${e}\`\`\``, flags: MessageFlags.Ephemeral });
+ }
}
}
};