mirror of
https://github.com/Wessel/yorushika.git
synced 2026-06-08 14:18:31 +02:00
Small fixes
This commit is contained in:
@@ -8,6 +8,6 @@ module.exports = class Disconnect extends DiscordEvent {
|
||||
}
|
||||
|
||||
emit() {
|
||||
this.bot.print(1, `${cyan('Discord')} >> All websockets disconnected from ${green(`${this.bot.user.username}#${this.bot.user.discriminator}`)}`);
|
||||
this.bot.print(1, `${cyan('Discord')} >> All websockets disconnected from ${green(`${this.bot.user.username}#${this.bot.user.discriminator}`)}`);
|
||||
}
|
||||
};
|
||||
@@ -31,10 +31,16 @@ module.exports = class Ready extends DiscordEvent {
|
||||
const flushTime = 1800000;
|
||||
setInterval(() => {
|
||||
const uCache = this.bot.cache.get('users') || [];
|
||||
|
||||
const gCache = this.bot.cache.get('guilds') || [];
|
||||
uCache.forEach((v, _) => (new Date(v.entryAge) <= new Date(new Date() - flushTime)) ? uCache.splice(_, 1) : undefined);
|
||||
const vCache = this.bot.cache.get('voters') || [];
|
||||
|
||||
gCache.forEach((v, _) => (new Date(v.entryAge) <= new Date(new Date() - flushTime)) ? gCache.splice(_, 1) : undefined);
|
||||
uCache.forEach((v, _) => {
|
||||
if (new Date(v.entryAge) <= new Date(new Date() - flushTime)) {
|
||||
vCache.forEach((n, _) => n === v.userId ? vCache.splice(_, 1) : undefined);
|
||||
uCache.splice(_, 1);
|
||||
}
|
||||
});
|
||||
}, flushTime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user