Added more Commands

This commit is contained in:
Noah Pombas
2025-02-13 04:42:11 +01:00
parent 216e95ee3e
commit 7860aab0e8
21 changed files with 684 additions and 253 deletions

View File

@@ -1,39 +1,39 @@
const {InteractionType} = require("discord.js")
const { InteractionType } = require('discord.js');
module.exports = {
name: 'interactionCreate',
/**
* @param {CommandInteraction} interaction
* @param {Client} client
/**
* @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 });
if (!command) return interaction.reply({content: `❌ Error processing this command.`, 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);
if(option.name) args.push(option.name);
option.options?.forEach(x => {
if (x.value) args.push(x.value);
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 });
} catch (error) {
interaction.reply({ content: error.message })
}
}
}