attempt to fix interval queuing
parent
9e028f5854
commit
58777b51bd
|
@ -1,6 +1,7 @@
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import { TextChannel } from 'eris';
|
import { TextChannel } from 'eris';
|
||||||
import { Client, RichEmbed } from '../class';
|
import { Client, RichEmbed } from '../class';
|
||||||
|
import { MemberInterface } from '../models';
|
||||||
import { CloudServicesUtil } from '../util';
|
import { CloudServicesUtil } from '../util';
|
||||||
|
|
||||||
let interval: NodeJS.Timeout;
|
let interval: NodeJS.Timeout;
|
||||||
|
@ -11,9 +12,9 @@ export default function checkLock(client: Client): NodeJS.Timeout {
|
||||||
const moderations = await client.db.Moderation.find();
|
const moderations = await client.db.Moderation.find();
|
||||||
const judgements = await client.db.Judgement.find().lean().exec();
|
const judgements = await client.db.Judgement.find().lean().exec();
|
||||||
const members = await client.db.Member.find();
|
const members = await client.db.Member.find();
|
||||||
members.forEach(async (member) => {
|
members.forEach(async (member: MemberInterface) => {
|
||||||
if (member.misc?.t3TemporaryExpiration?.processed === false) {
|
if (member.misc?.t3TemporaryExpiration && member.misc.t3TemporaryExpiration.processed === false) {
|
||||||
if (new Date() > member.misc?.t3TemporaryExpiration?.date) {
|
if (new Date() > member.misc.t3TemporaryExpiration.date) {
|
||||||
await CloudServicesUtil.setTier(member.id, member.misc.t3TemporaryExpiration.previousTier, client.config.internalKey);
|
await CloudServicesUtil.setTier(member.id, member.misc.t3TemporaryExpiration.previousTier, client.config.internalKey);
|
||||||
await member.updateOne({ 'misc.t3TemporaryExpiration.processed': true, 'misc.t3TemporaryExpiration.previousTier': null });
|
await member.updateOne({ 'misc.t3TemporaryExpiration.processed': true, 'misc.t3TemporaryExpiration.previousTier': null });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue