add categories for the help cmd to look for
This commit is contained in:
parent
0b4188f214
commit
6896751e86
1 changed files with 14 additions and 5 deletions
|
@ -20,19 +20,28 @@ class HelpCommand extends Command {
|
||||||
return { html: html }
|
return { html: html }
|
||||||
}
|
}
|
||||||
if (help.categories[this.args[0].toLowerCase()]) {
|
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>`
|
const prefix = htmlescape(process.env.PREFIX);
|
||||||
for (const [command] of collections.commands) {
|
html = `<h2>mrmBot Help - Categories</h2><table><tr><th>Category</th><th>Command</th></tr>`
|
||||||
const description = collections.info.get(command).description;
|
for (const category of Object.keys(help.categories)) {
|
||||||
html = html + `<tr><td>${command}</td><td>${description}</td></tr>`
|
html = html + `<tr><td>${category}</td><td>${prefix}help ${category}</td></tr>`
|
||||||
}
|
}
|
||||||
html = html + "</table>"
|
html = html + "</table>"
|
||||||
|
|
||||||
return { html: html }
|
return { html: html }
|
||||||
// return { html: "<h1>There are no mrmBot Docs Yet</h1>In the meantime, please refer to https://esmbot.net/help.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 description = "Gets a list of commands";
|
||||||
static aliases = ["commands"];
|
static aliases = ["commands"];
|
||||||
static arguments = ["{command}"];
|
static arguments = ["{command}"];
|
||||||
|
|
Loading…
Reference in a new issue