From 58777b51bde6cd698f6197c213a705d3345fe6c6 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Thu, 3 Feb 2022 14:35:19 -0500 Subject: [PATCH] attempt to fix interval queuing --- src/intervals/autoRelease.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/intervals/autoRelease.ts b/src/intervals/autoRelease.ts index fc4bd94..fca216c 100644 --- a/src/intervals/autoRelease.ts +++ b/src/intervals/autoRelease.ts @@ -1,6 +1,7 @@ /* eslint-disable no-undef */ import { TextChannel } from 'eris'; import { Client, RichEmbed } from '../class'; +import { MemberInterface } from '../models'; import { CloudServicesUtil } from '../util'; let interval: NodeJS.Timeout; @@ -11,9 +12,9 @@ export default function checkLock(client: Client): NodeJS.Timeout { const moderations = await client.db.Moderation.find(); const judgements = await client.db.Judgement.find().lean().exec(); const members = await client.db.Member.find(); - members.forEach(async (member) => { - if (member.misc?.t3TemporaryExpiration?.processed === false) { - if (new Date() > member.misc?.t3TemporaryExpiration?.date) { + members.forEach(async (member: MemberInterface) => { + if (member.misc?.t3TemporaryExpiration && member.misc.t3TemporaryExpiration.processed === false) { + if (new Date() > member.misc.t3TemporaryExpiration.date) { await CloudServicesUtil.setTier(member.id, member.misc.t3TemporaryExpiration.previousTier, client.config.internalKey); await member.updateOne({ 'misc.t3TemporaryExpiration.processed': true, 'misc.t3TemporaryExpiration.previousTier': null }); }