mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
Fehler beim Überprüfen der Vollständigkeit von den API behoben
This commit is contained in:
@@ -26,7 +26,7 @@ OPERATORS = {
|
|||||||
"slogan": ["Senk ju vor träwelling wis Deutsche Bahn.", "Bitte beachten Sie die umgekehrte Wagenreihung.", "Zurückbleiben bitte!", "Alle reden vom Wetter. Wir nicht.", "Die Bahn macht mobil.", "Grün abgefahren"]
|
"slogan": ["Senk ju vor träwelling wis Deutsche Bahn.", "Bitte beachten Sie die umgekehrte Wagenreihung.", "Zurückbleiben bitte!", "Alle reden vom Wetter. Wir nicht.", "Die Bahn macht mobil.", "Grün abgefahren"]
|
||||||
},
|
},
|
||||||
"db_bawü": {
|
"db_bawü": {
|
||||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/d/d1/Bwegt_Logo_%282020%29.jpg",
|
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Bwegt_Logo.svg/960px-Bwegt_Logo.svg.png",
|
||||||
"color": 0xFFBF34,
|
"color": 0xFFBF34,
|
||||||
"slogan": ["Nett hier", "Aber waren Sie schon mal in Baden-Württemberg?", "Bwegt euch!"]
|
"slogan": ["Nett hier", "Aber waren Sie schon mal in Baden-Württemberg?", "Bwegt euch!"]
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ async def rename_vc(bot: discord.Bot):
|
|||||||
train_ID = current['train_number']
|
train_ID = current['train_number']
|
||||||
|
|
||||||
train_info = get_train_info(station=current['station'], train_ID=train_ID, train_type=train_type)
|
train_info = get_train_info(station=current['station'], train_ID=train_ID, train_type=train_type)
|
||||||
if train_info['operators'] and train_info['arrival']:
|
if train_info and train_info.get('operators') and train_info.get('arrival'):
|
||||||
break
|
break
|
||||||
|
|
||||||
logger(f"Versuch {attempt}: Keine Ankunftszeit für {current['train']} verfügbar, versuche neue Verbindung...")
|
logger(f"Versuch {attempt}: Keine Ankunftszeit für {current['train']} verfügbar, versuche neue Verbindung...")
|
||||||
|
|||||||
+11
-1
@@ -68,7 +68,17 @@ def get_train_info(station, train_ID, train_type):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
dep = data.get("departure", [])
|
dep = data.get("departure", [])
|
||||||
arrival_iso = dep.get("route_post_diff", [])[-1].get("sched_arr")
|
if not dep:
|
||||||
|
return None
|
||||||
|
|
||||||
|
route_post = dep.get("route_post_diff")
|
||||||
|
if not route_post:
|
||||||
|
return None
|
||||||
|
|
||||||
|
arrival_iso = route_post[-1].get("sched_arr")
|
||||||
|
if not arrival_iso:
|
||||||
|
return None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"arrival": arrival_iso,
|
"arrival": arrival_iso,
|
||||||
"operators": dep.get("operators"),
|
"operators": dep.get("operators"),
|
||||||
|
|||||||
Reference in New Issue
Block a user