Fixed circular import.
This commit is contained in:
9
bot_instance.py
Normal file
9
bot_instance.py
Normal file
@@ -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()
|
||||||
7
main.py
7
main.py
@@ -7,16 +7,11 @@ from servermanager import create_server
|
|||||||
from nicegui import ui
|
from nicegui import ui
|
||||||
from webui import create_ui
|
from webui import create_ui
|
||||||
import threading
|
import threading
|
||||||
|
from bot_instance import bot
|
||||||
|
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
|
||||||
bot = commands.Bot(command_prefix="!", intents=intents)
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
TOKEN = os.getenv("TOKEN")
|
TOKEN = os.getenv("TOKEN")
|
||||||
|
|
||||||
bot.tracked_games = []
|
|
||||||
bot.tracked_games_lock = threading.Lock()
|
|
||||||
|
|
||||||
|
|
||||||
def reload_games():
|
def reload_games():
|
||||||
with bot.tracked_games_lock:
|
with bot.tracked_games_lock:
|
||||||
|
|||||||
2
webui.py
2
webui.py
@@ -1,5 +1,5 @@
|
|||||||
from nicegui import ui
|
from nicegui import ui
|
||||||
from main import bot
|
from bot_instance import bot
|
||||||
|
|
||||||
# reminder:
|
# reminder:
|
||||||
# tracked_games etc erst in andere variable kopieren und lock benutzen.
|
# tracked_games etc erst in andere variable kopieren und lock benutzen.
|
||||||
|
|||||||
Reference in New Issue
Block a user