2019-12-05 16:58:46 +00:00
|
|
|
const collections = require("./collections.js");
|
|
|
|
const fs = require("fs");
|
2020-02-11 01:49:35 +00:00
|
|
|
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
const categoryTemplate = {
|
|
|
|
general: [],
|
|
|
|
tags: ["> **Every command in this category is a subcommand of the tag command.**\n"],
|
|
|
|
"image-editing": ["> **These commands support the PNG, JPEG, WEBP (static), and GIF (animated or static) formats.**\n"]
|
|
|
|
};
|
|
|
|
exports.categories = categoryTemplate;
|
|
|
|
|
|
|
|
exports.generateList = async () => {
|
|
|
|
this.categories = categoryTemplate;
|
|
|
|
for (const [command] of collections.commands) {
|
|
|
|
const category = collections.info.get(command).category;
|
|
|
|
const description = collections.info.get(command).description;
|
|
|
|
const params = collections.info.get(command).params;
|
|
|
|
if (category === "tags") {
|
|
|
|
const subCommands = [...Object.keys(description)];
|
|
|
|
for (const subCommand of subCommands) {
|
|
|
|
this.categories.tags.push(`**tags${subCommand !== "default" ? ` ${subCommand}` : ""}**${params[subCommand] ? ` ${params[subCommand]}` : ""} - ${description[subCommand]}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!this.categories[category]) this.categories[category] = [];
|
|
|
|
this.categories[category].push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.createPage = async (output) => {
|
|
|
|
let template = `# <img src="https://raw.githubusercontent.com/esmBot/esmBot/master/esmbot.png" width="64"> esmBot${process.env.NODE_ENV === "development" ? " Dev" : ""} Command List
|
|
|
|
|
2021-03-05 04:33:03 +00:00
|
|
|
This page was last generated on \`${new Date().toString()}\`.
|
|
|
|
|
2019-12-20 17:39:30 +00:00
|
|
|
\`[]\` means an argument is required, \`{}\` means an argument is optional.
|
|
|
|
|
|
|
|
Default prefix is \`&\`.
|
|
|
|
|
2020-08-13 13:47:41 +00:00
|
|
|
**Want to help support esmBot's development? Consider donating on Patreon!** https://patreon.com/TheEssem
|
|
|
|
|
2021-07-14 22:23:50 +00:00
|
|
|
> Tip: You can get much more info about a command by using \`help [command]\` in the bot itself.
|
2019-12-20 17:39:30 +00:00
|
|
|
`;
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
|
|
|
|
template += "\n## Table of Contents\n";
|
|
|
|
for (const category of Object.keys(this.categories)) {
|
|
|
|
const categoryStringArray = category.split("-");
|
|
|
|
for (const index of categoryStringArray.keys()) {
|
|
|
|
categoryStringArray[index] = categoryStringArray[index].charAt(0).toUpperCase() + categoryStringArray[index].slice(1);
|
|
|
|
}
|
|
|
|
template += `+ [**${categoryStringArray.join(" ")}**](#${category})\n`;
|
|
|
|
}
|
|
|
|
|
|
|
|
// hell
|
|
|
|
for (const category of Object.keys(this.categories)) {
|
|
|
|
const categoryStringArray = category.split("-");
|
|
|
|
for (const index of categoryStringArray.keys()) {
|
|
|
|
categoryStringArray[index] = categoryStringArray[index].charAt(0).toUpperCase() + categoryStringArray[index].slice(1);
|
|
|
|
}
|
|
|
|
template += `\n## ${categoryStringArray.join(" ")}\n`;
|
|
|
|
for (const command of this.categories[category]) {
|
|
|
|
if (command.startsWith(">")) {
|
|
|
|
template += `${command}\n`;
|
|
|
|
} else {
|
|
|
|
template += `+ ${command}\n`;
|
2019-12-06 00:15:28 +00:00
|
|
|
}
|
2019-12-05 16:58:46 +00:00
|
|
|
}
|
|
|
|
}
|
Class commands, improved sharding, and many other changes (#88)
* Load commands recursively
* Sort commands
* Missed a couple of spots
* missed even more spots apparently
* Ported commands in "fun" category to new class-based format, added babel eslint plugin
* Ported general commands, removed old/unneeded stuff, replaced moment with day, many more fixes I lost track of
* Missed a spot
* Removed unnecessary abort-controller package, add deprecation warning for mongo database
* Added imagereload, clarified premature end message
* Fixed docker-compose path issue, added total bot uptime to stats, more fixes for various parts
* Converted image commands into classes, fixed reload, ignore another WS event, cleaned up command handler and image runner
* Converted music/soundboard commands to class format
* Cleanup unnecessary logs
* awful tag command class port
* I literally somehow just learned that you can leave out the constructor in classes
* Pass client directly to commands/events, cleaned up command handler
* Migrated bot to eris-sharder, fixed some error handling stuff
* Remove unused modules
* Fixed type returning
* Switched back to Eris stable
* Some fixes and cleanup
* might wanna correct this
* Implement image command ratelimiting
* Added Bot token prefix, added imagestats, added running endpoint to API
2021-04-12 16:16:12 +00:00
|
|
|
|
|
|
|
await fs.promises.writeFile(output, template);
|
2019-12-05 16:58:46 +00:00
|
|
|
};
|