const { Events } = require('discord.js'); module.exports = { name: Events.InteractionCreate, async execute({ log, createEmbed, client }, interaction) { if (interaction.isChatInputCommand()) { const command = interaction.client.commands.get(interaction.commandName); if (!command) { return log.Error(`No command matching ${interaction.commandName} was found`); } else { log.Info(`${interaction.user.username} executed command ${interaction.commandName}`); } try { await command.execute({ interaction, log, createEmbed, client }); } catch (error) { log.Error(error); await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); } } }, };