2023-08-02 14:16:30 +02:00
|
|
|
const { Events } = require('discord.js');
|
|
|
|
|
|
|
|
module.exports = {
|
2023-08-03 12:06:31 +02:00
|
|
|
name: Events.InteractionCreate,
|
|
|
|
async execute(interaction) {
|
2023-08-11 11:14:59 +02:00
|
|
|
if (interaction.isChatInputCommand() || interaction.isUserContextMenuCommand()) {
|
|
|
|
const command = interaction.client.commands.get(interaction.commandName);
|
2023-08-02 14:16:30 +02:00
|
|
|
|
2023-08-11 11:14:59 +02:00
|
|
|
if (!command) {
|
|
|
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
|
|
|
return;
|
|
|
|
}
|
2023-08-02 14:16:30 +02:00
|
|
|
|
2023-08-11 11:14:59 +02:00
|
|
|
try {
|
|
|
|
await command.execute(interaction);
|
|
|
|
} catch (error) {
|
|
|
|
console.error(`Error executing ${interaction.commandName}`);
|
|
|
|
console.error(error);
|
|
|
|
}
|
2023-08-03 12:06:31 +02:00
|
|
|
}
|
2023-08-02 14:16:30 +02:00
|
|
|
|
2023-08-03 12:06:31 +02:00
|
|
|
},
|
2023-08-02 14:16:30 +02:00
|
|
|
};
|