attempt to fix interval queuing

master
Matthew 2022-02-03 14:35:19 -05:00
parent 9e028f5854
commit 58777b51bd
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 4 additions and 3 deletions

View File

@ -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 });
}