From ec87cb7423f4a2917ccc784303243a85e9209945 Mon Sep 17 00:00:00 2001 From: Conatum Date: Mon, 16 May 2022 20:04:59 +0300 Subject: [PATCH] (TimeSlot): Add random dithers. Add startup and close dither for ratelimiting. --- bot/modules/accountability/TimeSlot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bot/modules/accountability/TimeSlot.py b/bot/modules/accountability/TimeSlot.py index 43f3d664..dcb87e14 100644 --- a/bot/modules/accountability/TimeSlot.py +++ b/bot/modules/accountability/TimeSlot.py @@ -2,6 +2,7 @@ from typing import List, Dict import datetime import discord import asyncio +import random from settings import GuildSettings from utils.lib import tick, cross @@ -364,6 +365,8 @@ class TimeSlot: Start the accountability room slot. Update the status message, and launch the DM reminder. """ + dither = 15 * random.random() + await asyncio.sleep(dither) if self.channel: try: await self.channel.edit(name="Scheduled Session Room") @@ -408,6 +411,8 @@ class TimeSlot: Delete the channel and update the status message to display a session summary. Unloads the TimeSlot from cache. """ + dither = 15 * random.random() + await asyncio.sleep(dither) if self.channel: try: await self.channel.delete()