i forgot to do commits, how unprofessional... i restructured the bot and made the /info and /umstieg command. Bot's almost done, the only thing missing now is the loop
This commit is contained in:
Kaaninchen
2026-07-17 01:19:24 +02:00
parent 9d338cd2ce
commit 723df6bf99
7 changed files with 202 additions and 2 deletions
+18 -1
View File
@@ -1,6 +1,7 @@
import requests
import random
from config import config
from src.data.operators import OPERATORS
def random_connection():
while True:
@@ -23,4 +24,20 @@ def random_connection():
continue
dep = random.choice(departures)
return [dep['train'], dep['destination'], station]
return [dep['train'], dep['destination'], dep['route'], dep['scheduledDeparture'], dep['via'], station]
def operator_infos(train):
if not train:
return OPERATORS["Fallback"]
train_type = train.split()[0]
return OPERATORS.get(train_type, OPERATORS["fallback"])
def format_via_list(via: list[str]):
if not via:
return ""
if len(via) == 1:
return via[0]
return ", ".join(via[:-1]) + " und " + via[-1]