From 22dcc9b7bf959a8dec5e21c62ddd19ecbf16bdb4 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Sat, 17 Aug 2024 15:20:51 -0400 Subject: [PATCH] Help command --- commands/help.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ commands/skip.js | 1 + 2 files changed, 45 insertions(+) create mode 100644 commands/help.js diff --git a/commands/help.js b/commands/help.js new file mode 100644 index 0000000..9831c29 --- /dev/null +++ b/commands/help.js @@ -0,0 +1,44 @@ +const { EmbedBuilder } = require('discord.js'); + +module.exports = { + name: 'help', + description: 'List all commands or get details about a specific command.', + execute(message, args) { + const { commands } = message.client; + const commandsArray = Array.from(commands.values()); + + if (!args.length) { + const embed = new EmbedBuilder() + .setColor('#0099ff') + .setTitle('Help - List of Commands') + .setDescription('Here\'s a list of all my commands:') + .addFields( + commandsArray.map(command => ({ + name: `\`${command.name}\``, + value: command.description || 'No description provided', + inline: true, + })) + ) + .setFooter({ text: 'You can send `+help [command name]` to get info on a specific command!' }); + + return message.channel.send({ embeds: [embed] }); + } + + const name = args[0].toLowerCase(); + const command = commands.get(name); + + if (!command) { + return message.reply('That\'s not a valid command!'); + } + + const embed = new EmbedBuilder() + .setColor('#0099ff') + .setTitle(`Help - \`${command.name}\``) + .addFields( + { name: 'Name', value: command.name, inline: true }, + { name: 'Description', value: command.description || 'No description provided', inline: true } + ); + + message.channel.send({ embeds: [embed] }); + }, +}; diff --git a/commands/skip.js b/commands/skip.js index 0ed38d2..3171d25 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -2,6 +2,7 @@ const { skipTrack } = require('../utils/queueManager'); module.exports = { name: 'skip', + description: 'Skip the current track', execute(message) { const guildId = message.guild.id; const voiceChannel = message.member.voice.channel;