Fixed bot being started multiple times.

This commit is contained in:
2026-04-09 13:11:09 +02:00
parent ae0c707470
commit 6803b130f7

View File

@@ -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,7 +33,10 @@ async def start_discord_bot():
def main():
global bot_started
create_ui()
if not bot_started:
bot_started = True
ui.timer(0, lambda: asyncio.create_task(start_discord_bot()), once=True)
ui.run()