mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
DZ zu unbeliebten zugtypen hinzugefügt
Die API gibt Züge da als entweder bspw. RE RE7 oder ICE 781, je nach Zugart. Ich glaub das unterscheidet sich zwischen Hochgeschwindigkeitszügen und regionalverkehr. Da RE RE7 komplett bescheuert ausieht wird der erste Teil des Namens (RE) entfernt. Immer mal wieder müssen Höchstgeschwindigkeitzüge zu einer Blacklist hinzugefügt werden, da der Zug dadurch nur noch die Zahl als Namen hat
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ async def rename_vc(bot: discord.Bot, scheduled = False) -> bool:
|
|||||||
|
|
||||||
current = random_connection()
|
current = random_connection()
|
||||||
train_type = current['train'].split()[0]
|
train_type = current['train'].split()[0]
|
||||||
if train_type in ("IC", "ICE", "NJ", "ES"):
|
if train_type in ("IC", "ICE", "NJ", "ES", "DZ"):
|
||||||
train = current['train']
|
train = current['train']
|
||||||
train_ID = current['train'].split()[1]
|
train_ID = current['train'].split()[1]
|
||||||
else:
|
else:
|
||||||
|
|||||||
+2
-3
@@ -15,10 +15,10 @@ def random_connection():
|
|||||||
data = response.json()
|
data = response.json()
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
departures = [
|
departures = [
|
||||||
d for d in data.get("departures", [])
|
d for d in data.get("departures", [])
|
||||||
if d.get("scheduledDeparture") and d.get("destination") != station
|
if d.get("scheduledDeparture") and d.get("destination") != station
|
||||||
]
|
]
|
||||||
|
|
||||||
if not departures:
|
if not departures:
|
||||||
@@ -52,7 +52,6 @@ def format_via_list(via: list[str]):
|
|||||||
|
|
||||||
def get_train_info(station, train_ID, train_type):
|
def get_train_info(station, train_ID, train_type):
|
||||||
url = f"https://dbf.finalrewind.org/z/{train_type}%20{train_ID}/{station}.json"
|
url = f"https://dbf.finalrewind.org/z/{train_type}%20{train_ID}/{station}.json"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|||||||
Reference in New Issue
Block a user