From 16fe630d0391c424b6ca06778cd289de6c9e12a1 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sat, 31 Dec 2022 22:52:41 +0530 Subject: [PATCH] Prevent bot from hanging due to infinite loop caused when checking timestamps --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index b2bbe710..eda71ad0 100644 --- a/main.py +++ b/main.py @@ -141,9 +141,9 @@ async def on_ready(): time.sleep(5) print("[main/Presents] Presents daemon started.") while True: + print(f"[main/Presents] Dropping new presents in {colors.cyan}#general{colors.end} channel...") + await asyncio.sleep(randint(450, 600)) if floor(time.time()) > 1672511400: - print(f"[main/Presents] Dropping new presents in {colors.cyan}#general{colors.end} channel...") - await asyncio.sleep(randint(450, 600)) cyberspace_channel_context = await client.fetch_channel(880409977074888718) localembed = discord.Embed(title="**:gift: Presents have dropped in chat!**", description="Be the first one to collect them!", color=color) await cyberspace_channel_context.send(embed=localembed, view=PresentsDrop())