Allow multiple usages for e.g. subcommands

This commit is contained in:
7cc5c4f330d47060 2024-07-23 16:57:47 -04:00
parent 9817191d27
commit 551e77e7df
2 changed files with 8 additions and 4 deletions

View file

@ -54,13 +54,15 @@ module.exports={
let usage=getMessage(lang,`command.${cmd}.usage`);
let desc=getMessage(lang,`command.${cmd}.desc`);
if(cmds[cmd].usage){
usage=cmds[cmd].usage;
usage=cmds[cmd].usage.split("||");
}
if(cmds[cmd].desc){
desc=cmds[cmd].desc;
}
//b.tellraw(uuid,{"text":getMessage(lang,"command.help.commandInfo",[cmd,usage,desc])});
b.tellraw(uuid,{"text":getMessage(lang,"command.help.commandUsage",[cmd,usage,desc])});
for(const i in usage){
b.tellraw(uuid,{"text":getMessage(lang,"command.help.commandUsage",[cmd,usage[i]])});
}
b.tellraw(uuid,{"text":getMessage(lang,"command.help.commandDesc",[desc])});
const permsN=getMessage(lang,"command.help.permsNormal");
const permsT=getMessage(lang,"command.help.permsTrusted");

View file

@ -27,12 +27,14 @@ class ConsoleCommand{
let usage=getMessage(lang,`command.${cmd}.usage`);
let desc=getMessage(lang,`command.${cmd}.desc`);
if(cmds[cmd].usage){
usage=cmds[cmd].usage;
usage=cmds[cmd].usage.split("||");
}
if(cmds[cmd].desc){
desc=cmds[cmd].desc;
}
console.log({"text":getMessage(lang,"command.help.commandUsage",[cmd,usage,desc])});
for(const i in usage){
console.log({"text":getMessage(lang,"command.help.commandUsage",[cmd,usage[i]])});
}
console.log({"text":getMessage(lang,"command.help.commandDesc",[desc])});
const permsN=getMessage(lang,"command.help.permsNormal");
const permsT=getMessage(lang,"command.help.permsTrusted");