You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Haha-Yes/events/client/interactionCreate.js

22 lines
575 B
JavaScript

export default {
name: 'interactionCreate',
async execute(interaction) {
const client = interaction.client;
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
console.log(`\x1b[33m${interaction.user.tag}\x1b[0m launched command \x1b[33m${interaction.commandName}\x1b[0m`);
if (!command) return;
try {
await command.execute(interaction);
}
catch (error) {
console.error(error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
},
};