Polarcraft/discordbot/events/interactionCreate.js
Xeovalyte 5f0de3f326
All checks were successful
Build and Publish / Build and Publish Discord Bot (push) Successful in 28s
Build and Publish / Build and Publish Minecraft Mod (push) Successful in 2m17s
Added nuke command
2023-08-17 10:23:42 +02:00

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