Add permission level to help

This commit is contained in:
7cc5c4f330d47060 2024-09-13 03:30:34 -04:00
parent a4ff4ca374
commit c461e87ef1
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
2 changed files with 28 additions and 14 deletions

View file

@ -26,21 +26,14 @@ for (const plugin of bpl) {
const printHelp = (c) => { const printHelp = (c) => {
const commandList = [] const commandList = []
const colorList = ["green", "red", "dark_red"]
for (const i in cmds) { for (const i in cmds) {
if (cmds[i].hidden) continue if (cmds[i].hidden) continue
let cmdColor let cmdColor
switch (cmds[i].level) { if(colorList[cmds[i].level]){
case 0: cmdColor = colorList[cmds[i].level]
cmdColor = 'green' } else {
break cmdColor = colorList[0]
case 1:
cmdColor = 'red'
break
case 2:
cmdColor = 'dark_red'
break
default:
cmdColor = 'green'
} }
commandList.push( commandList.push(
{ {
@ -52,10 +45,31 @@ const printHelp = (c) => {
} }
) )
} }
const permsN = getMessage(c.lang, 'command.help.permsNormal')
const permsT = getMessage(c.lang, 'command.help.permsTrusted')
const permsO = getMessage(c.lang, 'command.help.permsOwner')
const permList = [permsN, permsT, permsO]
const permListFormat = []
permList.forEach((item, i)=>{
permListFormat.push({
translate: i === permList.length - 1 ? "%s" : "%s ",
color: colorList[i],
with: [
item
]
})
})
c.reply({ c.reply({
translate: '%s %s', translate: '%s %s',
with: [
{
translate: "%s (%s):",
with: [ with: [
getMessage(c.lang, 'command.help.cmdList'), getMessage(c.lang, 'command.help.cmdList'),
permListFormat
]
},
commandList.sort(sortHelp) commandList.sort(sortHelp)
] ]
}) })

View file

@ -54,7 +54,7 @@
"command.cloop.success.clear": "Cleared all command loops", "command.cloop.success.clear": "Cleared all command loops",
"command.cloop.list": "%s: Command: %s Rate: %s", "command.cloop.list": "%s: Command: %s Rate: %s",
"command.eval.output": "Output", "command.eval.output": "Output",
"command.help.cmdList": "Commands:", "command.help.cmdList": "Commands",
"command.help.commandInfo": "%s%s - %s", "command.help.commandInfo": "%s%s - %s",
"command.help.commandUsage": "Usage - %s%s", "command.help.commandUsage": "Usage - %s%s",
"command.help.commandDesc": "Description - %s", "command.help.commandDesc": "Description - %s",