Add aliases to the help command

This commit is contained in:
7cc5c4f330d47060 2024-10-24 21:25:57 -04:00
parent 1fcb2f8ab8
commit dad70f81bc
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
2 changed files with 41 additions and 2 deletions

View file

@ -171,6 +171,43 @@ const printCmdHelp = (c) => {
}
]
})
if(cmds[cmd].aliases){
const aliasList = [];
for(const item of cmds[cmd].aliases){
if(aliasList.length>0){
aliasList.push({
text: ", ",
color: c.colors.secondary
})
}
aliasList.push({
text: item,
color: c.colors.primary,
clickEvent: {
action: 'copy_to_clipboard',
value: item
},
hoverEvent: {
action: 'show_text',
contents: {
text: getMessage(c.lang, 'command.help.copyAlias'),
color: c.colors.secondary
},
value: { // Added twice for backwards compatibility
text: getMessage(c.lang, 'command.help.copyAlias'),
color: c.colors.secondary
}
}
})
}
c.reply({
translate: getMessage(c.lang, 'command.help.commandAliases'),
color: c.colors.secondary,
with: [
aliasList
]
})
}
const permsN = getMessage(c.lang, 'command.help.permsNormal')
const permsT = getMessage(c.lang, 'command.help.permsTrusted')
const permsO = getMessage(c.lang, 'command.help.permsOwner')

View file

@ -65,12 +65,14 @@
"command.help.commandUsage.lf": "Usage - %s%s\n",
"command.help.commandDesc.lf": "Description - %s\n",
"command.help.commandPerms.lf": "Required permissions - %s\n",
"command.help.commandAliases": "Aliases - %s",
"command.help.runCommand": "Click to run command",
"command.help.permsNormal": "Public",
"command.help.permsTrusted": "Trusted",
"command.help.permsOwner": "Owner",
"command.help.noCommand": "Command does not exist",
"command.help.alias": "Alias to %s",
"command.help.copyAlias": "Click to copy this alias to your clipboard",
"command.netmsg.disabled": "This command has been disabled on this server.",
"command.netmsg.serverAddress": "Server Address",
"command.settings.disabled.console": "This command cannot be run from the console.",
@ -129,5 +131,5 @@
"command.disallowed.perms": "You do not have permission to run this command. If you do have permission, please make sure you put the command hash at the end, or ran the command through the hashing system of your client or proxy.",
"command.disallowed.perms.yourLevel": "Your permission level: %s",
"command.disallowed.perms.cmdLevel": "Command requires: %s",
"copyText": "Click to copy!"
"copyText": "Click to copy this item to your clipboard"
}