You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Natsuki/util/cache/char.js

20 lines
751 B

const Discord = require('discord.js');
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.charsLove = new Discord.Collection();
3 years ago
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);
char.nicknames.forEach(nn => client.misc.cache.chars.set(nn, char.id));
client.misc.cache.charsID.set(char.id, char.name);
3 years ago
client.misc.cache.charsNum++;
client.misc.cache.charsLove.set(char.id, char.loved);
}
}
}