From 28443611e49287adabef4722de672cfdda883aeb Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 23 Sep 2024 22:01:19 -0400 Subject: [PATCH] Vastly improved the /help command --- functions.js | 42 +++++++++++++++++++++++++++++------------- strings.json | 6 +++--- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/functions.js b/functions.js index cee266c..d6b12dd 100644 --- a/functions.js +++ b/functions.js @@ -215,28 +215,44 @@ const functions = { // Construct the Slash Commands help let slashCommandsFields = []; + let slashSeenNames = new Array(); const slashCommandsMap = interaction.client.slashCommands.map(e => { - return { - name: e.data.name, - description: e.data.description - }; - }) + if (!slashSeenNames.includes(e.data.name)) { + slashSeenNames.push(e.data.name); + return { + name: e.data.name, + description: e.data.description + }; + } else { + return null; + } + }); for (const e of slashCommandsMap) { - slashCommandsFields.push(`- /${e.name} - ${e.description}`); + slashCommandsFields.push(`- \`/${e.name}\` - ${e.description}`); } + console.log(slashCommandsFields); // Construct the Dot Commands Help - let dotCommandsFields = []; + let dotCommandsFields = new Array(); + let dotSeenNames = new Array(); const dotCommandsMap = interaction.client.dotCommands.map(e => { - return { - name: e.name, - description: e.description, - usage: e.usage - }; + if (!dotSeenNames.includes(e.name)) { + dotSeenNames.push(e.name); + return { + name: e.name, + description: e.description, + usage: e.usage + }; + } else { + return null; + } }); for (const e of dotCommandsMap) { - dotCommandsFields.push(`- .${e.name} - ${e.description}\nUsage: ${e.usage}`); + if (e != null) { + dotCommandsFields.push(`- \`.${e.name}\` - ${e.description} - ${e.usage}`); + } } + console.log(dotCommandsFields); // Construct the Description Fields const descriptionFields = [ diff --git a/strings.json b/strings.json index e7991f8..8883464 100644 --- a/strings.json +++ b/strings.json @@ -1,8 +1,8 @@ { "help": { - "description": "Hi there! Thanks for checking out NodBot. NodBot is used in two distinct ways: with 'Slash Commands' (/help), and with 'Dot Commands' (nod.gif). The two types will be outlined below, along with usage examples.", - "slash": "Slash Commands always begin with a / and a menu will pop up to help complete the commands.", - "dot": "Dot Commands have the command at the end of the message, for example to search for a gif of 'nod', type 'nod.gif'" + "description": "Hi there! Thanks for checking out NodBot. NodBot is used in two distinct ways: with 'Slash Commands' (`/help`), and with 'Dot Commands' (`nod.gif`). The two types will be outlined below, along with usage examples.", + "slash": "Slash Commands always begin with a `/` and a menu will pop up to help complete the commands.", + "dot": "Dot Commands have the command at the end of the message, for example to search for a gif of `nod`, type `nod.gif`" }, "emoji": { "joint": "<:joint:862082955902976000>",