Added check to make sure help list isn't generated multiple times

This commit is contained in:
Essem 2021-09-16 15:34:46 -05:00
parent 8d5cd12a45
commit 963d5247f6
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
2 changed files with 4 additions and 1 deletions

View File

@ -53,7 +53,7 @@ class HelpCommand extends Command {
} else {
if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!";
const pages = [];
if (help.categories === help.categoryTemplate) await help.generateList();
if (help.categories === help.categoryTemplate && !help.generated) await help.generateList();
for (const category of Object.keys(help.categories)) {
const splitPages = help.categories[category].map((item, index) => {
return index % 15 === 0 ? help.categories[category].slice(index, index + 15) : null;

View File

@ -8,6 +8,8 @@ export const categoryTemplate = {
};
export let categories = categoryTemplate;
export let generated = false;
export async function generateList() {
categories = categoryTemplate;
for (const [command] of commands) {
@ -24,6 +26,7 @@ export async function generateList() {
categories[category].push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
}
}
generated = true;
}
export async function createPage(output) {