I wanted a way to organize this Json file:
{
"ajuda": {
"name":"Ajuda",
"category": "Sistema",
"desc":"Mostra todos os comandos disponiveis.",
"usage":"ajuda [grupo ou comando]"
},
"ping": {
"name":"Ping",
"category": "Sistema",
"desc":"Usado para saber a latencia do bot.",
"usage":"ping"
},
"status": {
"name":"Status",
"category": "Sistema",
"desc":"Mostra algumas estatística úteis do bot.",
"usage":"status"
},
"convidar": {
"name":"Convidar",
"category": "Miscelânea",
"desc":"Usado para mostrar o meu link de convite.",
"usage":"convidar"
},
"kick": {
"name":"Kick",
"category": "Administração",
"desc":"Usado para expulsar a pessoa mencionada.",
"usage":"kick <@user>"
}
}
In alphabetical order by category. And put it in that code here:
let currentCategory = "";
let output = '= Lista de Comandos =\n\n[Use ${config.prefix}ajuda <comandos> para detalhes]\n';
for (var cmd in commands) {
const cat = commands[cmd].category;
if (currentCategory !== cat) {
output += '\u200b\n== ${cat} ==\n';
currentCategory = cat;
}
output += '${config.prefix}${commands[cmd].name} :: ${commands[cmd].desc}\n'
}
message.channel.send(output, {code: "asciidoc", split: { char: "\u200b" }});
But I was not able to ... I tried 300 ways that I found on the internet but nothing.