diff --git a/bot_instance.py b/bot_instance.py new file mode 100644 index 0000000..b5528bd --- /dev/null +++ b/bot_instance.py @@ -0,0 +1,9 @@ +from discord.ext import commands +import discord +import threading + +intents = discord.Intents.default() +bot = commands.Bot(command_prefix="!", intents=intents) + +bot.tracked_games = [] +bot.tracked_games_lock = threading.Lock() diff --git a/main.py b/main.py index 1b372be..fb2cb6c 100644 --- a/main.py +++ b/main.py @@ -7,16 +7,11 @@ from servermanager import create_server from nicegui import ui from webui import create_ui import threading +from bot_instance import bot - -intents = discord.Intents.default() -bot = commands.Bot(command_prefix="!", intents=intents) load_dotenv() TOKEN = os.getenv("TOKEN") -bot.tracked_games = [] -bot.tracked_games_lock = threading.Lock() - def reload_games(): with bot.tracked_games_lock: diff --git a/webui.py b/webui.py index 187eadb..322ca72 100644 --- a/webui.py +++ b/webui.py @@ -1,5 +1,5 @@ from nicegui import ui -from main import bot +from bot_instance import bot # reminder: # tracked_games etc erst in andere variable kopieren und lock benutzen.