Converted multiple functions to ES6 syntax, moved from collections to maps for storing commands
This commit is contained in:
parent
1da0d24602
commit
02df085580
8 changed files with 28 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
const { Collection } = require("eris");
|
||||
//const { Collection } = require("eris");
|
||||
|
||||
exports.commands = new Collection();
|
||||
exports.aliases = new Collection();
|
||||
exports.info = new Collection();
|
||||
exports.commands = new Map();
|
||||
exports.aliases = new Map();
|
||||
exports.info = new Map();
|
|
@ -16,9 +16,9 @@ exports.load = async (command) => {
|
|||
params: props.params
|
||||
});
|
||||
if (props.aliases) {
|
||||
props.aliases.forEach(alias => {
|
||||
for (const alias of props.aliases) {
|
||||
collections.aliases.set(alias, command.split(".")[0]);
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ Default prefix is \`&\`.
|
|||
+ [**Image Editing**](#🖼️-image-editing)
|
||||
+ [**Soundboard**](#🔊-soundboard)
|
||||
`;
|
||||
const commands = Array.from(collections.commands.keys());
|
||||
const commands = collections.commands;
|
||||
const categories = {
|
||||
general: ["## 💻 General"],
|
||||
moderation: ["## 🔨 Moderation"],
|
||||
|
@ -28,7 +28,7 @@ Default prefix is \`&\`.
|
|||
images: ["## 🖼️ Image Editing", "> These commands support the PNG, JPEG, WEBP, and GIF formats. (GIF support is currently experimental)"],
|
||||
soundboard: ["## 🔊 Soundboard"]
|
||||
};
|
||||
for (const command of commands) {
|
||||
for (const [command] of commands) {
|
||||
const category = collections.info.get(command).category;
|
||||
const description = collections.info.get(command).description;
|
||||
const params = collections.info.get(command).params;
|
||||
|
@ -37,7 +37,7 @@ Default prefix is \`&\`.
|
|||
} else if (category === 2) {
|
||||
categories.moderation.push(`+ **${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
} else if (category === 3) {
|
||||
const subCommands = Array.from(Object.keys(description));
|
||||
const subCommands = [...Object.keys(description)];
|
||||
for (const subCommand of subCommands) {
|
||||
categories.tags.push(`+ **tags${subCommand !== "default" ? ` ${subCommand}` : ""}**${params[subCommand] ? ` ${params[subCommand]}` : ""} - ${description[subCommand]}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue