const {InteractionType} = require("discord.js") module.exports = { name: 'interactionCreate', /** * @param {CommandInteraction} interaction * @param {Client} client */ async execute(interaction, client) { if (interaction.type !== InteractionType.ApplicationCommand) return; const command = client.slash.get(interaction.commandName); if (!command) return interaction.reply({ content: `Command doesn't exist!`, ephemeral: true }); if (command.ownerOnly) { if (interaction.user.id !== client.config.ownerID) { return interaction.reply({ content: `Permission Denied`, ephemeral: true }); } } const args = []; for (let option of interaction.options.data) { if (option.type === 'SUB_COMMAND') { if (option.name) args.push(option.name); option.options?.forEach(x => { if (x.value) args.push(x.value); }); } else if (option.value) args.push(option.value); } try { command.run(client, interaction, args) } catch (e) { interaction.reply({ content: e.message }); } } }