From 2907cbc325571351feeaaf374a922e02fdb9ec7c Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 14 May 2020 00:09:07 -0400 Subject: [PATCH] Randomize and stagger posting intervals --- markov-bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/markov-bot.py b/markov-bot.py index aa5b085..22d74c6 100755 --- a/markov-bot.py +++ b/markov-bot.py @@ -51,7 +51,9 @@ class MyClient(discord.Client): await channel.send(gen_sentence()) except: pass - await asyncio.sleep(3600) + await asyncio.sleep((2700 + random.randrange(1800)) // min(max(len(self.guilds), 1), 100)) + if self.is_closed(): + break client = MyClient() with open('token') as f: