Ā© 2026 Hedgehog Software, LLC
const utils = require("../utils/utils"); const embed = require("../utils/embed"); const loaders = require("../utils/loaders"); const EventBuild = require("../utils/event"); module.exports = new EventBuild( "commandInteraction", "interactionCreate", async (interaction) => { if(interaction.isCommand( )) { await interaction.deferReply({ ephemeral: true }); const name = interaction.commandName; if(!name) { return utils.editOrReply(interaction, { embeds: [embed.error({ content: "You need to inform the command that you want to use." })] }); }; const command = loaders.commands.find((command) => { return command.name == name; }); if (!command) { return utils.editOrReply(interaction, { embeds: [embed.error({ content: `Sorry! I couldn't find the command '${name}'.` })] }); }; try { await command.execute(interaction); } catch (error) { console.error(`Error executing command '${command.name}':`, error); return utils.editOrReply(interaction, { embeds: [embed.error({ content: `Sorry! An error occurred while I tried to execute the command.` })] }); }; }; } );