AstraOS Ver. 1.8:
- DC Bots werden nach restart automatisch gestartet
This commit is contained in:
parent
bd63b62b75
commit
20ddc5c89d
|
|
@ -128,6 +128,12 @@ except Exception as e:
|
|||
accounts_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():
|
||||
if discord_bots_collection is None:
|
||||
print("WARNUNG: Bot-Autostart übersprungen, da keine DB-Verbindung besteht.")
|
||||
|
|
@ -969,6 +975,5 @@ def update_maintenance():
|
|||
if __name__ == '__main__':
|
||||
app.config['SESSION_COOKIE_SECURE'] = False
|
||||
print("INFO: Starte den Server im Entwicklungsmodus ohne HTTPS.")
|
||||
with app.app_context():
|
||||
start_bots_on_startup()
|
||||
# Der Autostart wird hier nicht mehr benötigt, da er oben global aufgerufen wird.
|
||||
socketio.run(app, host='0.0.0.0', port=5000, debug=True, allow_unsafe_werkzeug=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue