26 lines
796 B
JavaScript
26 lines
796 B
JavaScript
const { Events } = require('discord.js');
|
|
const { simpleEmbed } = require('../functions/embeds.js');
|
|
|
|
module.exports = {
|
|
name: Events.InteractionCreate,
|
|
async execute(interaction) {
|
|
if (interaction.isChatInputCommand() || interaction.isUserContextMenuCommand()) {
|
|
const command = interaction.client.commands.get(interaction.commandName);
|
|
|
|
if (!command) {
|
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
await command.execute(interaction);
|
|
} catch (error) {
|
|
await interaction.reply({ embeds: [simpleEmbed('There was an error while executing the command')] });
|
|
console.error(`Error executing ${interaction.commandName}`);
|
|
console.error(error);
|
|
}
|
|
}
|
|
|
|
},
|
|
};
|