feat: add restriction for verification reminder if less than 100 messages since last reminder

This commit is contained in:
Anthony Berg 2023-05-27 07:19:47 +01:00
parent a2404ae404
commit 1dbfff38bc

View File

@ -33,11 +33,23 @@ export class VerifyReminder extends ScheduledTask {
public async run() {
const { client } = container;
// Get the total messages sent in non-vegan general since last message
const redisKey = 'verifyReminderMessageCounter';
const messageCount = await this.container.redis.get(redisKey);
// Do not send if messages count is less than 100
if (!messageCount || +messageCount < 100) return;
// Send verification reminder to non-vegan general
const channel = client.channels.cache.get(IDs.channels.nonVegan.general) as TextChannel;
await channel.send('If you want to have the vegan or activist role, you\'ll need to do a voice verification. '
+ 'To do this, hop into the \'Verification\' voice channel.'
+ '\n\nIf there aren\'t any verifiers available, you\'ll be disconnected, and you can rejoin later.');
// Reset the total message counter to 0
await this.container.redis.set(redisKey, 0);
}
}