From ca47208da74624252aa5963a4bf3fde442ac9e37 Mon Sep 17 00:00:00 2001 From: IDeletedSystem64 Date: Tue, 2 Aug 2022 23:53:44 -0500 Subject: [PATCH] Refactor help command! --- commands/help.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/commands/help.js b/commands/help.js index 4918e95..6b98b22 100644 --- a/commands/help.js +++ b/commands/help.js @@ -5,7 +5,7 @@ module.exports = { name: require('path').parse(__filename).name, description: 'Get help on anything from commands, to what the bot does! just not your homework..', options: [{ - name: 'command', + name: 'help', description: 'View Information about this command', required: false, type: Constants.ApplicationCommandOptionTypes.STRING @@ -15,18 +15,30 @@ module.exports = { }, async parseInteraction (client, config, interaction) { - await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('command'))); + await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('help'))); }, handle (client, config, user, command) { if (!command) { - return client.generateErrorMessage('Note to self: Design default help embed.', user.displayAvatarURL()); + return { + embeds: [{ + title: `:question: SEYMOUR! THE ${client.user.username} IS ON FIRE!`, + description: `Run ${config.prefix}help for more information on each command.`, + footer: { + icon_url: user.displayAvatarURL(), + text: config.footerTxt + }, + fields: [ + { name: 'Commands', value: client.commands.map(command => command.name).join('\n') } + ] + }] + }; } // const cmdName = args[0].toLowerCase(); - const cmdName = command + const cmdName = command; const cmd = client.commands.get(cmdName); - + console.log(cmd.options.map(option => option.required)); if (!cmd) { return client.generateErrorMessage(`${cmdName} is not a valid command! Run ${config.prefix}help for a command list.`); } @@ -43,8 +55,8 @@ module.exports = { { name: 'Command Name', value: `${cmdName}`, inline: true }, { name: 'Command Description', value: cmd.description, inline: true }, { name: 'Command Options', value: cmd.options.map(option => option.name).join('\n') || 'None', inline: true }, - { name: 'Command Option Description', value: cmd.options.map(option => option.description).join('\n') || 'None', inline: true }, - { name: 'Option Legend', value: '[Option] REQUIRED\n