AstraOS Ver. 1.8.2:

- DC Bots werden nach restart automatisch gestartet
This commit is contained in:
MrWhiff 2025-12-09 21:14:35 +01:00
parent 20ddc5c89d
commit 1652392572

View file

@ -128,12 +128,6 @@ except Exception as e:
accounts_collection = None accounts_collection = None
logs_collection = None logs_collection = None
# Autostart-Funktion für Bots im Produktions- und Entwicklungsmodus aufrufen
# Die Prüfung `os.environ.get('WERKZEUG_RUN_MAIN') != 'true'` verhindert, dass es im Debug-Modus doppelt ausgeführt wird.
if os.environ.get('WERKZEUG_RUN_MAIN') != 'true':
with app.app_context():
start_bots_on_startup()
def start_bots_on_startup(): def start_bots_on_startup():
if discord_bots_collection is None: if discord_bots_collection is None:
print("WARNUNG: Bot-Autostart übersprungen, da keine DB-Verbindung besteht.") print("WARNUNG: Bot-Autostart übersprungen, da keine DB-Verbindung besteht.")
@ -170,6 +164,11 @@ def start_bots_on_startup():
except Exception as e: except Exception as e:
print(f"FEHLER: Bot '{bot_info['name']}' konnte nicht gestartet werden: {e}") print(f"FEHLER: Bot '{bot_info['name']}' konnte nicht gestartet werden: {e}")
# Autostart-Funktion für Bots im Produktions- und Entwicklungsmodus aufrufen
# Die Prüfung `os.environ.get('WERKZEUG_RUN_MAIN') != 'true'` verhindert, dass es im Debug-Modus doppelt ausgeführt wird.
if os.environ.get('WERKZEUG_RUN_MAIN') != 'true':
with app.app_context():
start_bots_on_startup()
try: try:
tickets_client = MongoClient(os.environ.get("MONGO_URI")) tickets_client = MongoClient(os.environ.get("MONGO_URI"))