Added toggle/options for help page generator
This commit is contained in:
parent
b6a2dd275a
commit
c357d3bc46
4 changed files with 24 additions and 16 deletions
|
@ -24,6 +24,9 @@ CSE=
|
||||||
# Put DBL/top.gg token here
|
# Put DBL/top.gg token here
|
||||||
DBL=
|
DBL=
|
||||||
|
|
||||||
|
# Put HTML help page output location here, leave blank to disable
|
||||||
|
OUTPUT=
|
||||||
|
|
||||||
# Enable/disable Twitter bot (true/false)
|
# Enable/disable Twitter bot (true/false)
|
||||||
TWITTER=false
|
TWITTER=false
|
||||||
# Put Twitter username here
|
# Put Twitter username here
|
||||||
|
|
|
@ -48,46 +48,46 @@ body
|
||||||
h2#table-of-contents Table of Contents
|
h2#table-of-contents Table of Contents
|
||||||
ul
|
ul
|
||||||
li
|
li
|
||||||
a(href='#💻-general')
|
a(href='#general')
|
||||||
strong General
|
strong General
|
||||||
li
|
li
|
||||||
a(href='#🔨-moderation')
|
a(href='#moderation')
|
||||||
strong Moderation
|
strong Moderation
|
||||||
li
|
li
|
||||||
a(href='#🏷️-tags')
|
a(href='#tags')
|
||||||
strong Tags
|
strong Tags
|
||||||
li
|
li
|
||||||
a(href='#👌-fun')
|
a(href='#fun')
|
||||||
strong Fun
|
strong Fun
|
||||||
li
|
li
|
||||||
a(href='#🖼️-image-editing')
|
a(href='#images')
|
||||||
strong Image Editing
|
strong Image Editing
|
||||||
li
|
li
|
||||||
a(href='#🔊-soundboard')
|
a(href='#soundboard')
|
||||||
strong Soundboard
|
strong Soundboard
|
||||||
h2(id='💻-general') 💻 General
|
h2(id='general') 💻 General
|
||||||
each command in commands.general
|
each command in commands.general
|
||||||
ul
|
ul
|
||||||
li!= command
|
li!= command
|
||||||
h2(id='🔨-moderation') 🔨 Moderation
|
h2(id='moderation') 🔨 Moderation
|
||||||
each command in commands.moderation
|
each command in commands.moderation
|
||||||
ul
|
ul
|
||||||
li!= command
|
li!= command
|
||||||
h2(id='🏷️-tags') 🏷️ Tags
|
h2(id='tags') 🏷️ Tags
|
||||||
each command in commands.tags
|
each command in commands.tags
|
||||||
ul
|
ul
|
||||||
li!= command
|
li!= command
|
||||||
h2(id='👌-fun') 👌 Fun
|
h2(id='fun') 👌 Fun
|
||||||
each command in commands.fun
|
each command in commands.fun
|
||||||
ul
|
ul
|
||||||
li!= command
|
li!= command
|
||||||
h2(id='🖼️-image-editing') 🖼️ Image Editing
|
h2(id='images') 🖼️ Image Editing
|
||||||
blockquote
|
blockquote
|
||||||
p These commands support the PNG, JPEG, and WEBP formats.
|
p These commands support the PNG, JPEG, and WEBP formats.
|
||||||
each command in commands.images
|
each command in commands.images
|
||||||
ul
|
ul
|
||||||
li!= command
|
li!= command
|
||||||
h2(id='🔊-soundboard') 🔊 Soundboard
|
h2(id='soundboard') 🔊 Soundboard
|
||||||
each command in commands.soundboard
|
each command in commands.soundboard
|
||||||
ul
|
ul
|
||||||
li!= command
|
li!= command
|
|
@ -3,6 +3,7 @@ const database = require("../utils/database.js");
|
||||||
const logger = require("../utils/logger.js");
|
const logger = require("../utils/logger.js");
|
||||||
const messages = require("../messages.json");
|
const messages = require("../messages.json");
|
||||||
const misc = require("../utils/misc.js");
|
const misc = require("../utils/misc.js");
|
||||||
|
const helpGenerator = process.env.OUTPUT !== "" ? require("../utils/help.js") : null;
|
||||||
const twitter = process.env.TWITTER === "true" ? require("../utils/twitter.js") : null;
|
const twitter = process.env.TWITTER === "true" ? require("../utils/twitter.js") : null;
|
||||||
|
|
||||||
// run when ready
|
// run when ready
|
||||||
|
@ -42,6 +43,11 @@ module.exports = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate docs
|
||||||
|
if (helpGenerator) {
|
||||||
|
await helpGenerator(process.env.OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
// set activity (a.k.a. the gamer code)
|
// set activity (a.k.a. the gamer code)
|
||||||
(async function activityChanger() {
|
(async function activityChanger() {
|
||||||
client.editStatus("dnd", { name: `${misc.random(messages)} | @esmBot help` });
|
client.editStatus("dnd", { name: `${misc.random(messages)} | @esmBot help` });
|
||||||
|
|
|
@ -2,8 +2,7 @@ const pug = require("pug");
|
||||||
const collections = require("./collections.js");
|
const collections = require("./collections.js");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
module.exports = async () => {
|
module.exports = async (output) => {
|
||||||
//const compiledFunction = pug.compileFile("./assets/pages/help.pug");
|
|
||||||
const commands = Array.from(collections.commands.keys());
|
const commands = Array.from(collections.commands.keys());
|
||||||
const categories = {
|
const categories = {
|
||||||
general: [],
|
general: [],
|
||||||
|
@ -31,7 +30,7 @@ module.exports = async () => {
|
||||||
categories.soundboard.push(`<strong>${command}</strong>${params ? ` ${params}` : ""} - ${description}`);
|
categories.soundboard.push(`<strong>${command}</strong>${params ? ` ${params}` : ""} - ${description}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fs.writeFile("../help.html", pug.renderFile("./assets/pages/help.pug", { commands: categories }), () => {
|
fs.writeFile(output, pug.renderFile("./assets/pages/help.pug", { commands: categories }), () => {
|
||||||
console.log("hi");
|
console.log("The docs have been generated.");
|
||||||
});
|
});
|
||||||
};
|
};
|
Loading…
Reference in a new issue