From 61ad632994019a8c8e2629d2e1bb163bdb2f09c6 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 24 Dec 2021 01:16:20 -0700 Subject: [PATCH] cache nicknames --- bot.js | 3 ++- util/cache/char.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bot.js b/bot.js index b55b382..4911143 100644 --- a/bot.js +++ b/bot.js @@ -39,7 +39,8 @@ client.misc = { chars: new Discord.Collection(), anime: new Discord.Collection(), charsID: new Discord.Collection(), - animeID: new Discord.Collection() + animeID: new Discord.Collection(), + charsNum: 0 }, loggers: {}, rl: readline.createInterface({input: process.stdin, output: process.stdout}) diff --git a/util/cache/char.js b/util/cache/char.js index c9ea407..0b4ec7b 100644 --- a/util/cache/char.js +++ b/util/cache/char.js @@ -5,11 +5,14 @@ const CharData = require('../../models/char'); module.exports = async client => { client.misc.cache.chars = new Discord.Collection(); client.misc.cache.charsID = new Discord.Collection(); + client.misc.cache.charsNum = 0; for await (const char of CharData.find()) { if (char.queued !== true) { client.misc.cache.chars.set(char.name, char.id); + chars.nicknames.forEach(nn => client.misc.cache.chars.set(nn, char.id)); client.misc.cache.charsID.set(char.id, char.name); + client.misc.cache.charsNum++; } } } \ No newline at end of file