From e58d14dd1427df981200f1a126ab800be981fc96 Mon Sep 17 00:00:00 2001 From: Kaaninchen <124433727+kaaninchen@users.noreply.github.com> Date: Sat, 18 Jul 2026 16:29:45 +0200 Subject: [PATCH] =?UTF-8?q?Config=20f=C3=BCr=20random=20station/die=20erst?= =?UTF-8?q?e=20die=20zur=20auswahl=20steht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json.example | 3 ++- src/data/operators.py | 13 +++++++++---- src/handlers.py | 2 +- src/utils.py | 7 +++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/config.json.example b/config.json.example index 9929d23..fb56745 100644 --- a/config.json.example +++ b/config.json.example @@ -3,5 +3,6 @@ "stations": [ "Berlin Hbf", "Hamburg Hbf", "München Hbf", "Amsterdam Centraal"], "server": , "vc": , - "formatting": "🚅┇" + "formatting": "🚅┇", + "random": false } \ No newline at end of file diff --git a/src/data/operators.py b/src/data/operators.py index a25a923..9036324 100644 --- a/src/data/operators.py +++ b/src/data/operators.py @@ -1,8 +1,8 @@ OPERATORS = { "fallback": { "unknown": True, - "logo": "https://images.emojiterra.com/google/noto-emoji/unicode-15/color/512px/1f686.png", - "color": 0x087BBB + "logo": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQCVeC5E0mNNBKyQftQaFMzxIVkbDvEnSzWv07h_c8PdA&s=10", + "color": 0xFFFFFF }, "db_allgemein": { "logo": "https://marketingportal.extranet.deutschebahn.com/resource/blob/13602522/c53f806b9df966e144010b276af72dd2/Bild_09-data.png", @@ -32,8 +32,8 @@ OPERATORS = { "color": 0x0083BE }, "Bayerische Regiobahn": { - "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Logo_BRB_2015.svg/1920px-Logo_BRB_2015.svg.png", - "color": 0xF61526 + "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Bahnland_Bayern_Logo_2021.svg/500px-Bahnland_Bayern_Logo_2021.svg.png", + "color": 0x0095DB }, "Abellio Rail Mitteldeutschland GmbH": { "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Abellio_logo.svg/1920px-Abellio_logo.svg.png", @@ -42,6 +42,10 @@ OPERATORS = { "SBB": { "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/SBB_logo_simplified.svg/960px-SBB_logo_simplified.svg.png", "color": 0xEB0000 + }, + "Nordbahn Eisenbahngesellschaft": { + "logo": "https://upload.wikimedia.org/wikipedia/commons/b/b5/Logo_Nordbahn_NAH.SH_Blau_positiv_final.png", + "color": 0x1A2848 } } @@ -51,6 +55,7 @@ OPERATOR_ALIASES = { "DB Fernverkehr AG": OPERATORS["db_allgemein"], "DB Regio AG NRW": OPERATORS["db_allgemein"], "DB Regio AG Nord": OPERATORS["db_allgemein"], + "DB Regio AG Südost": OPERATORS["db_allgemein"], "SBB GmbH": OPERATORS["SBB"], "Schweizerische Bundesbahnen SBB": OPERATORS["SBB"], } \ No newline at end of file diff --git a/src/handlers.py b/src/handlers.py index ee017b0..61d768c 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -66,7 +66,7 @@ async def _schedule_next_umstieg(bot, arrival): wait_seconds = (arrival - datetime.now()).total_seconds() if wait_seconds > 0: remaining = str(timedelta(seconds=wait_seconds)) - logger(f"Um {arrival.strftime('%H:%M:%S')} gehts weiter (in {remaining.split(".")[0]})!...") + logger(f"SCHEDULER: Nächster Umstieg in {remaining.split(".")[0]} ({arrival.strftime('%H:%M:%S')})") await asyncio.sleep(wait_seconds) logger("Zug angekommen, wähle neue Verbindung...") await rename_vc(bot) \ No newline at end of file diff --git a/src/utils.py b/src/utils.py index 7a4a5b4..93af63b 100644 --- a/src/utils.py +++ b/src/utils.py @@ -38,13 +38,16 @@ def random_connection(): departures = [ d for d in data.get("departures", []) if d.get("scheduledDeparture") and d.get("destination") != station - and not d.get("train", "").startswith("S ") ] if not departures: continue - dep = random.choice(departures) + if config['random']: + dep = random.choice(departures) + else: + dep = departures[0] + return { "train": dep['train'], "destination": dep['destination'],