add categories for the help cmd to look for

This commit is contained in:
murm 2023-03-19 01:10:07 -04:00
parent 0b4188f214
commit 6896751e86

View file

@ -20,19 +20,28 @@ class HelpCommand extends Command {
return { html: html }
}
if (help.categories[this.args[0].toLowerCase()]) {
html = `<h2>mrmBot Help - ${htmlescape(this.args[0])}</h2><table><tr><th>Command</th><th>Description</th></tr>`
for (const [command] of collections.commands) {
if (collections.info.get(command).category != this.args[0].toLowerCase()) continue;
const description = collections.info.get(command).description;
html = html + `<tr><td>${command}</td><td>${description}</td></tr>`
}
html = html + "</table>"
return { html: html }
}
}
html = `<h2>mrmBot Help</h2><table><tr><th>Command</th><th>Description</th></tr>`
for (const [command] of collections.commands) {
const description = collections.info.get(command).description;
html = html + `<tr><td>${command}</td><td>${description}</td></tr>`
const prefix = htmlescape(process.env.PREFIX);
html = `<h2>mrmBot Help - Categories</h2><table><tr><th>Category</th><th>Command</th></tr>`
for (const category of Object.keys(help.categories)) {
html = html + `<tr><td>${category}</td><td>${prefix}help ${category}</td></tr>`
}
html = html + "</table>"
return { html: html }
// return { html: "<h1>There are no mrmBot Docs Yet</h1>In the meantime, please refer to https://esmbot.net/help.html" };
}
static category = "general"
static description = "Gets a list of commands";
static aliases = ["commands"];
static arguments = ["{command}"];