From 10df5324d040a897c42f22e46d02b3ddca6a15c4 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Tue, 2 Aug 2022 13:45:57 -0700 Subject: [PATCH] fix help command --- commands/help.js | 43 ++++++++++++++++++++----------------------- commands/settings.js | 2 +- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/commands/help.js b/commands/help.js index d54d5be..f40e313 100644 --- a/commands/help.js +++ b/commands/help.js @@ -83,35 +83,32 @@ module.exports = { let embed = new MessageEmbed() .setDescription(cmd.description) .setColor("GREEN") - .addField( + .setTitle(`How to use /${cmd.name} command`) + + if (cmd.SlashCommand.options && cmd.SlashCommand.options[0].type == 1) { + let description = `${cmd.description}\n\n**Usage**\n`; + + for (let i = 0; i < cmd.SlashCommand.options.length; i++) { + if (cmd.SlashCommand.options[i].type == 1) { + let param = ''; + if (cmd.SlashCommand.options[i].options) { + param = cmd.SlashCommand.options[i].options.length > 0 ? ' ' : ''; + for (let j = 0; j < cmd.SlashCommand.options[i].options.length; j++) { + if (cmd.SlashCommand.options[i].options[j].required) param += `[${cmd.SlashCommand.options[i].options[j].name}] ` + } + } + description += `\`/${cmd.name} ${cmd.SlashCommand.options[i].name}${param}\`\n${cmd.SlashCommand.options[i].description}\n\n` + } + } + embed.setDescription(description); + } else { + embed.addField( "Usage", `\`/${cmd.name}\`${cmd.usage ? " " + cmd.usage : ""}`, true ) - - for (let i = 0; i < cmd.SlashCommand.options.length; i++) { - if (cmd.SlashCommand.options[i].type == 1) { - let param = cmd.SlashCommand.options[i].options.length > 0 ? ' ' : ''; - for (let j = 0; j < cmd.SlashCommand.options[i].options.length; j++) { - if (cmd.SlashCommand.options[i].options[j].required) param += `[${cmd.SlashCommand.options[i].options[j].name}] ` - } - embed.addField( - `/${cmd.name} ${cmd.SlashCommand.options[i].name}${param}`, - `${cmd.SlashCommand.options[i].description}`, - true - ) - } } - embed.addField( - "Permissions", - "Member: " + - cmd.permissions.member.join(", ") + - "\nBot: " + - cmd.permissions.channel.join(", "), - true - ); - return interaction.send(embed); } } else if (args[0].name == 'settings') { diff --git a/commands/settings.js b/commands/settings.js index b4ba784..ac7f624 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -3,7 +3,7 @@ const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js'); module.exports = { name: "settings", debug: false, - description: "configure your server settings", + description: "Configure your server settings", usage: "[opt] [action] [value]", permissions: { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],