parent
ad047ffa19
commit
3959a4765c
@ -1,46 +1,49 @@ |
|||||||
const ora = require('ora'); |
const gs = require('gradient-string'); |
||||||
|
const spinnies = require('dreidels'); |
||||||
const chalk = require('chalk'); |
const chalk = require('chalk'); |
||||||
|
|
||||||
module.exports = async (client) => { |
module.exports = async (client) => { |
||||||
|
return new Promise(async resolve => { |
||||||
|
const loaders = []; |
||||||
|
const spin = new spinnies(); |
||||||
|
|
||||||
console.log(''); |
console.log(''); |
||||||
let ora_arCache = ora("Caching ARs...").start(); |
|
||||||
await require('./cache/ar')(client); |
|
||||||
ora_arCache.stop(); ora_arCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.ar.size}`)} ${chalk.blueBright(`guilds with auto responses.`)}`); |
|
||||||
|
|
||||||
let ora_blCache = ora("Caching Blacklists...").start(); |
|
||||||
await require('./cache/bl')(client); |
|
||||||
ora_blCache.stop(); ora_blCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.bl.guild.length}`)} ${chalk.blueBright(`guild blacklists`)}`); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.bl.user.length}`)} ${chalk.blueBright(`user blacklists`)}`); |
|
||||||
|
|
||||||
let ora_lxpCache = ora("Caching Local XPs...").start(); |
let arCache = spin.add("ar", {text: "Caching ARs..."}); |
||||||
await require('./cache/lxp')(client); |
loaders.push(require('./cache/ar')(client, arCache)); |
||||||
ora_lxpCache.stop(); ora_lxpCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.enabled.length}`)} ${chalk.blueBright(`guilds with XP enabled.`)}`); |
|
||||||
|
|
||||||
let ora_lrCache = ora("Caching Level Roles...").start(); |
let blCache = spin.add("bl", {text: "Caching Guild Blacklists..."}); |
||||||
await require('./cache/lr')(client); |
let bluCache = spin.add("blu", {text: "Caching User Blacklists..."}); |
||||||
ora_lrCache.stop(); ora_lrCache.clear(); |
loaders.push(require('./cache/bl')(client, blCache, bluCache)); |
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.hasLevelRoles.length}`)} ${chalk.blueBright(`guilds with Level Roles enabled.`)}`); |
|
||||||
|
|
||||||
let ora_moCache = ora("Caching Monitors...").start(); |
let lxpCache = spin.add("xp", {text: "Caching Local XPs..."}); |
||||||
await require('./cache/monit')(client); |
loaders.push(require('./cache/lxp')(client, lxpCache)); |
||||||
ora_moCache.stop(); ora_moCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${Object.keys(client.misc.cache.monit).length}`)} ${chalk.blueBright(`guilds with Monitors enabled.`)}`); |
|
||||||
|
|
||||||
let ora_anCache = ora("Caching Animes...").start(); |
let lrCache = spin.add("lr", {text: "Caching Level Roles..."}); |
||||||
await require('./cache/anime')(client); |
loaders.push(require('./cache/lr')(client, lrCache)); |
||||||
ora_anCache.stop(); ora_anCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.animeNum}`)} ${chalk.blueBright(`animes into lookup registry.`)}`); |
|
||||||
|
|
||||||
let ora_chCache = ora("Caching Characters...").start(); |
let moCache = spin.add("m", {text: "Caching Monitors..."}); |
||||||
await require('./cache/char')(client); |
loaders.push(require('./cache/monit')(client, moCache)); |
||||||
ora_chCache.stop(); ora_chCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.charsNum}`)} ${chalk.blueBright(`characters into lookup registry.`)} ${chalk.gray(`(${client.misc.cache.chars.size} // NN)`)}`); |
let anCache = spin.add("a", {text: "Caching Animes..."}); |
||||||
|
loaders.push(require('./cache/anime')(client, anCache)); |
||||||
|
|
||||||
|
let chCache = spin.add("ch", {text: "Caching Characters..."}); |
||||||
|
loaders.push(require('./cache/char')(client, chCache)); |
||||||
|
|
||||||
let ora_ctCache = ora("Caching Chests...").start(); |
let ctCache = spin.add("cht", {text: "Caching Chests..."}); |
||||||
await require('./cache/chest')(client); |
loaders.push(require('./cache/chest')(client, ctCache)); |
||||||
ora_ctCache.stop(); ora_ctCache.clear(); |
|
||||||
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.chests.enabled.length}`)} ${chalk.blueBright("guilds that spawn chests.")}`); |
await Promise.all(loaders); |
||||||
|
|
||||||
|
/*console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.bl.guild.length}`)} ${chalk.blueBright(`guild blacklists`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.bl.user.length}`)} ${chalk.blueBright(`user blacklists`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.enabled.length}`)} ${chalk.blueBright(`guilds with XP enabled.`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.lxp.hasLevelRoles.length}`)} ${chalk.blueBright(`guilds with Level Roles enabled.`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${Object.keys(client.misc.cache.monit).length}`)} ${chalk.blueBright(`guilds with Monitors enabled.`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.animeNum}`)} ${chalk.blueBright(`animes into lookup registry.`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.charsNum}`)} ${chalk.blueBright(`characters into lookup registry.`)} ${chalk.gray(`(${client.misc.cache.chars.size} // NN)`)}`); |
||||||
|
console.log(`${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${client.misc.cache.chests.enabled.length}`)} ${chalk.blueBright("guilds that spawn chests.")}`);*/ |
||||||
|
resolve(0); |
||||||
|
}); |
||||||
}; |
}; |
@ -1,11 +1,20 @@ |
|||||||
const AR = require('../../models/ar'); |
const AR = require('../../models/ar'); |
||||||
|
const chalk = require('chalk'); |
||||||
|
|
||||||
module.exports = async client => { |
module.exports = async (client, spinner) => { |
||||||
|
return new Promise(async resolve => { |
||||||
client.misc.cache.ar = new Map(); |
client.misc.cache.ar = new Map(); |
||||||
client.misc.cache.arIgnore = new Map(); |
client.misc.cache.arIgnore = new Map(); |
||||||
|
let amount = 0; |
||||||
|
|
||||||
for await (const ar of AR.find()) { |
for await (const ar of AR.find()) { |
||||||
client.misc.cache.ar.set(ar.gid, ar.triggers); |
client.misc.cache.ar.set(ar.gid, ar.triggers); |
||||||
if (ar.ignoreChs.length) {client.misc.cache.arIgnore.set(ar.gid, ar.ignoreChs);} |
if (ar.ignoreChs.length) {client.misc.cache.arIgnore.set(ar.gid, ar.ignoreChs);} |
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guilds with auto responses.`)}`}); |
||||||
|
amount++; |
||||||
} |
} |
||||||
|
|
||||||
|
spinner.status('non-spinnable'); |
||||||
|
resolve(0); |
||||||
|
}); |
||||||
}; |
}; |
@ -1,17 +1,32 @@ |
|||||||
const GuildData = require('../../models/guild'); |
const GuildData = require('../../models/guild'); |
||||||
const UserData = require('../../models/user'); |
const UserData = require('../../models/user'); |
||||||
|
const chalk = require('chalk'); |
||||||
|
|
||||||
module.exports = async (client) => { |
module.exports = async (client, spinner, spinner2) => { |
||||||
|
return new Promise(async resolve => { |
||||||
client.misc.cache.bl = { |
client.misc.cache.bl = { |
||||||
guild: [], |
guild: [], |
||||||
user: [] |
user: [] |
||||||
}; |
}; |
||||||
|
let amount = 0; |
||||||
|
let amount2 = 0; |
||||||
|
|
||||||
for await (const guild of GuildData.find()) { |
for await (const guild of GuildData.find()) { |
||||||
if (guild.blacklisted) {client.misc.cache.bl.guild.push(guild.gid);} |
if (guild.blacklisted) {client.misc.cache.bl.guild.push(guild.gid); amount++;} |
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guild blacklists.`)}`}); |
||||||
} |
} |
||||||
|
|
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guild blacklists.`)}`}); |
||||||
|
spinner.status('non-spinnable'); |
||||||
|
|
||||||
for await (const user of UserData.find()) { |
for await (const user of UserData.find()) { |
||||||
if (user.blackisted) {client.misc.cache.bl.user.push(user.uid);} |
if (user.blackisted) {client.misc.cache.bl.user.push(user.uid); amount2++;} |
||||||
|
spinner2.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount2}`)} ${chalk.blueBright(`user blacklists.`)}`}); |
||||||
} |
} |
||||||
|
|
||||||
|
spinner2.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount2}`)} ${chalk.blueBright(`user blacklists.`)}`}); |
||||||
|
spinner2.status('non-spinnable'); |
||||||
|
|
||||||
|
resolve(0); |
||||||
|
}); |
||||||
}; |
}; |
@ -1,9 +1,18 @@ |
|||||||
const Chests = require('../../models/chests'); |
const Chests = require('../../models/chests'); |
||||||
|
const chalk = require('chalk'); |
||||||
|
|
||||||
module.exports = async client => { |
module.exports = async (client, spinner) => { |
||||||
|
return new Promise(async resolve => { |
||||||
client.misc.cache.chests.enabled = []; |
client.misc.cache.chests.enabled = []; |
||||||
|
let amount = 0; |
||||||
|
|
||||||
for await (const chest of Chests.find()) { |
for await (const chest of Chests.find()) { |
||||||
client.misc.cache.chests.enabled.push(chest.gid); |
client.misc.cache.chests.enabled.push(chest.gid); |
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guilds that spawn chests.`)}`}); |
||||||
|
amount++; |
||||||
} |
} |
||||||
|
|
||||||
|
spinner.status('non-spinnable'); |
||||||
|
resolve(0); |
||||||
|
}); |
||||||
}; |
}; |
@ -1,9 +1,19 @@ |
|||||||
const LR = require('../../models/levelroles'); |
const LR = require('../../models/levelroles'); |
||||||
|
const chalk = require('chalk'); |
||||||
|
|
||||||
module.exports = async client => { |
module.exports = async (client, spinner) => { |
||||||
|
return new Promise(async resolve => { |
||||||
client.misc.cache.lxp.hasLevelRoles = []; |
client.misc.cache.lxp.hasLevelRoles = []; |
||||||
|
let amount = 0; |
||||||
|
|
||||||
for await (const lr of LR.find()) { |
for await (const lr of LR.find()) { |
||||||
client.misc.cache.lxp.hasLevelRoles.push(lr.gid); |
client.misc.cache.lxp.hasLevelRoles.push(lr.gid); |
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guilds with Level Roles enabled.`)}`}); |
||||||
|
amount++; |
||||||
} |
} |
||||||
|
|
||||||
|
spinner.status('non-spinnable'); |
||||||
|
|
||||||
|
resolve(0); |
||||||
|
}); |
||||||
}; |
}; |
@ -1,12 +1,21 @@ |
|||||||
const LXP = require('../../models/localxp'); |
const LXP = require('../../models/localxp'); |
||||||
|
const chalk = require('chalk'); |
||||||
|
|
||||||
module.exports = async client => { |
module.exports = async (client, spinner) => { |
||||||
|
return new Promise(async resolve => { |
||||||
client.misc.cache.lxp.enabled = []; |
client.misc.cache.lxp.enabled = []; |
||||||
client.misc.cache.lxp.disabledChannels = new Map(); |
client.misc.cache.lxp.disabledChannels = new Map(); |
||||||
client.misc.cache.chests.enabled = new Map(); |
client.misc.cache.chests.enabled = new Map(); |
||||||
|
let amount = 0; |
||||||
|
|
||||||
for await (const xp of LXP.find()) { |
for await (const xp of LXP.find()) { |
||||||
client.misc.cache.lxp.enabled.push(xp.gid); |
client.misc.cache.lxp.enabled.push(xp.gid); |
||||||
if (xp.noGains && xp.noGains.length) {client.misc.cache.lxp.disabledChannels.set(xp.gid, xp.noGains);} |
if (xp.noGains && xp.noGains.length) {client.misc.cache.lxp.disabledChannels.set(xp.gid, xp.noGains);} |
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`guilds with XP enabled.`)}`}); |
||||||
|
amount++; |
||||||
} |
} |
||||||
|
|
||||||
|
spinner.status('non-spinnable'); |
||||||
|
resolve(0); |
||||||
|
}); |
||||||
}; |
}; |
Loading…
Reference in new issue