mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 17:34:13 +02:00
feat: add restriction for verification reminder if less than 100 messages since last reminder
This commit is contained in:
parent
a2404ae404
commit
1dbfff38bc
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user