From 6803b130f7c4a0c048999ad20348ce996020c40b Mon Sep 17 00:00:00 2001 From: Carl Date: Thu, 9 Apr 2026 13:11:09 +0200 Subject: [PATCH] Fixed bot being started multiple times. --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 70514c6..ae1bc1c 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ from webui import create_ui from bot_instance import bot import asyncio +bot_started = False # prolly only need this in dev mode load_dotenv() TOKEN = os.getenv("TOKEN") if not TOKEN: @@ -32,8 +33,11 @@ async def start_discord_bot(): def main(): + global bot_started create_ui() - ui.timer(0, lambda: asyncio.create_task(start_discord_bot()), once=True) + if not bot_started: + bot_started = True + ui.timer(0, lambda: asyncio.create_task(start_discord_bot()), once=True) ui.run()