import { ChatInputCommandInteraction, CacheType } from "discord.js" import { execCmds } from "../cmd" export async function execCmd(interaction: ChatInputCommandInteraction) { try { const commandName = interaction.commandName const command = execCmds.get(commandName) console.info(`Executing command '${commandName}' by ${interaction.user.tag} (${interaction.user.id})`) const options = interaction.options.data if (options.length > 0) { console.info( options.map(option => `\x1b[34m${option.name}\x1b[0m: \x1b[90m${option.value}\x1b[0m`).join(", ") ) } if (command) command.exec(interaction) else console.warn(`Command ${commandName} not found`) } catch (error) { console.error(error) } }