cwk-ds-tools
Version:
Zero-boilerplate Discord.js bot framework with built-in MongoDB, automod, slash commands, and more
22 lines (18 loc) • 574 B
JavaScript
module.exports = {
name: 'interactionCreate',
once: false,
async execute(interaction, client) {
if (!interaction.isChatInputCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.run(interaction, client);
} catch (error) {
console.error(error);
await interaction.reply({
content: 'There was an error while executing this command!',
ephemeral: true
});
}
}
};