From 8e08a932bfccbaa58fe18ea795aa8bdbdd72f666 Mon Sep 17 00:00:00 2001 From: kry008 Date: Thu, 23 May 2024 14:03:01 +0200 Subject: [PATCH] temp commit --- commands/help.js | 107 ----------------------------------------------- 1 file changed, 107 deletions(-) diff --git a/commands/help.js b/commands/help.js index d2bcef9..e69de29 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,107 +0,0 @@ -//optiona name of the command -var fs = require('fs'); -function getAllCommands(client) { - const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); - const allCommands = []; - for (const file of commandFiles) { - const command = require(`./${file}`); - allCommands.push(command); - } - return allCommands; -} -function allCommandsNames(guild = true) -{ - //check if it is in dm or guild - if(guild) - { - const commands = getAllCommands(); - let str = ''; - for(const command of commands) - { - if(command.admin === false) - str += command.name + '\n'; - } - return str; - } - else - { - const commands = getAllCommands(); - let str = ''; - for(const command of commands) - { - if(command.canBeUsedInDm) - if(command.admin === false) - str += command.name + '\n'; - } - return str; - } -} -function getCommand(name, guild = true) -{ - //check if it is in dm or guild - if(guild) - { - const commands = getAllCommands(); - for(const command of commands) - { - if(command.name === name) - return command; - } - } - else - { - const commands = getAllCommands(); - for(const command of commands) - { - if(command.name === name && command.canBeUsedInDm) - return command; - } - } - return null; -} -module.exports = { - name: 'help', - description: 'Get a list of all commands or information about a specific command', - help: 'Get a list of all commands or information about a specific command', - options: [ - { - name: 'command', - description: 'Command to get information about', - type: 3, - required: false, - }, - ], - slash: true, - text: true, - admin: false, - requireKick: false, - premium: false, - requireBan: false, - canBeUsedInDm: true, - contexts: ['GUILD_TEXT', 'GUID_VOICE', 'DM'], - integration_types: [0,1], - execute: async (message, args) => { - if(args.length === 0) - { - const commands = allCommandsNames(); - message.channel.send(commands); - return; - } - const command = getCommand(args[0]); - if(command === null) - { - message.channel.send('Command not found'); - return; - } - message.channel.send('Name: ' + command.name + '\nDescription: ' + command.description + '\nHelp: ' + command.help); - }, - executeSlash: async interaction => { - const command = getCommand(interaction.options.getString('command')); - if(command === null) - { - interaction.reply('Command not found'); - return; - } - interaction.reply('Name: ' + command.name + '\nDescription: ' + command.description + '\nHelp: ' + command.help); - }, -};