mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
a lot
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:
+18
-1
@@ -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]
|
||||
Reference in New Issue
Block a user