Add permission level to help
This commit is contained in:
parent
a4ff4ca374
commit
c461e87ef1
2 changed files with 28 additions and 14 deletions
|
@ -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: [
|
with: [
|
||||||
getMessage(c.lang, 'command.help.cmdList'),
|
{
|
||||||
|
translate: "%s (%s):",
|
||||||
|
with: [
|
||||||
|
getMessage(c.lang, 'command.help.cmdList'),
|
||||||
|
permListFormat
|
||||||
|
]
|
||||||
|
},
|
||||||
commandList.sort(sortHelp)
|
commandList.sort(sortHelp)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in a new issue