UNPKG

makecord-create

Version:

Create advanced Discord Bots with Makecord - Now with TypeScript support

23 lines (19 loc) 790 B
const { Events } = require('discord.js'); module.exports = { name: Events.InteractionCreate, async execute(interaction) { if (!interaction.isChatInputCommand()) return; const command = interaction.client.slashCommands.get(interaction.commandName); if (!command) return; try { await command.execute(interaction); } catch (error) { console.error(error); if (interaction.replied || interaction.deferred) { await interaction.followUp({ content: 'An error occurred while executing the command!', ephemeral: true }); } else { await interaction.reply({ content: 'An error occurred while executing the command!', ephemeral: true }); } } }, };