Add listing of aliases to /help
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 7s

This commit is contained in:
Skylar Grant 2024-09-26 09:22:16 -04:00
parent 09901b5e58
commit 8148890574

View File

@ -185,10 +185,11 @@ const functions = {
const slashCommandsMap = interaction.client.slashCommands.map(e => { const slashCommandsMap = interaction.client.slashCommands.map(e => {
if (!slashSeenNames.includes(e.data.name)) { if (!slashSeenNames.includes(e.data.name)) {
slashSeenNames.push(e.data.name); slashSeenNames.push(e.data.name);
return { const command = {
name: e.data.name, name: e.data.name,
description: e.data.description description: e.data.description
}; };
return command;
} else { } else {
return null; return null;
} }
@ -204,18 +205,29 @@ const functions = {
const dotCommandsMap = interaction.client.dotCommands.map(e => { const dotCommandsMap = interaction.client.dotCommands.map(e => {
if (!dotSeenNames.includes(e.name)) { if (!dotSeenNames.includes(e.name)) {
dotSeenNames.push(e.name); dotSeenNames.push(e.name);
return { let command = {
name: e.name, name: e.name,
description: e.description, description: e.description,
usage: e.usage 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 { } else {
return null; return null;
} }
}); });
for (const e of dotCommandsMap) { for (const e of dotCommandsMap) {
if (e != null) { 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); console.log(dotCommandsFields);