Natsuki's API!
https://api.natsuki.app
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.
24 lines
925 B
24 lines
925 B
const chalk = require('chalk');
|
|
|
|
module.exports = async (app, spinner) => {
|
|
const Users = app.db.models.ani.users;
|
|
|
|
return new Promise(async resolve => {
|
|
const st = new Date().getTime();
|
|
|
|
let amount = 1;
|
|
|
|
for await (const user of Users.find()) {
|
|
app.cache.users[user.id] = {id: user.id, discord: user.discord};
|
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`ani DB users.`)}`});
|
|
amount++;
|
|
}
|
|
|
|
const cacheTime = new Date().getTime() - st;
|
|
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`});
|
|
spinner.status('non-spinnable');
|
|
|
|
resolve(0);
|
|
});
|
|
} //robbery is like, the best
|
|
// ...it's my own code don't @ me
|