diff --git a/src/events/Discord/disconnected.js b/src/events/Discord/disconnected.js index af9d72e..dc672ba 100644 --- a/src/events/Discord/disconnected.js +++ b/src/events/Discord/disconnected.js @@ -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}`)}`); } }; \ No newline at end of file diff --git a/src/events/Discord/ready.js b/src/events/Discord/ready.js index fbf1f9c..1310178 100644 --- a/src/events/Discord/ready.js +++ b/src/events/Discord/ready.js @@ -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); }