From 8148890574a17a3c0e24da855e6d650b3f6cd04c Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 26 Sep 2024 09:22:16 -0400 Subject: [PATCH] Add listing of aliases to /help --- functions.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/functions.js b/functions.js index f606849..7d8a1b2 100644 --- a/functions.js +++ b/functions.js @@ -185,10 +185,11 @@ const functions = { const slashCommandsMap = interaction.client.slashCommands.map(e => { if (!slashSeenNames.includes(e.data.name)) { slashSeenNames.push(e.data.name); - return { + const command = { name: e.data.name, description: e.data.description }; + return command; } else { return null; } @@ -204,18 +205,29 @@ const functions = { const dotCommandsMap = interaction.client.dotCommands.map(e => { if (!dotSeenNames.includes(e.name)) { dotSeenNames.push(e.name); - return { + let command = { name: e.name, description: e.description, usage: e.usage }; + command.aliasString = new String(); + if (e.alias != undefined && typeof e.alias === 'object') { + for (const a of e.alias) { + command.aliasString += `\`.${a}\`, `; + } + } else if (e.alias != undefined && typeof e.alias === 'string') { + command.aliasString += `\`.${e.alias}\``; + } else { + command.aliasString = 'None'; + } + return command; } else { return null; } }); for (const e of dotCommandsMap) { if (e != null) { - dotCommandsFields.push(`- \`.${e.name}\` - ${e.description} - ${e.usage}`); + dotCommandsFields.push(`- \`.${e.name}\` - ${e.description}\n\tUsage: ${e.usage}\n\tAliases: ${e.aliasString}`); } } console.log(dotCommandsFields);