mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-09-17 16:52:47 +00:00
transitous rewrite: via
This commit is contained in:
@@ -92,7 +92,7 @@ def get_random_connection(stop_id: str) -> str | None:
|
||||
if not trip_ids:
|
||||
logger("Couldn't find any connection", "error")
|
||||
return None
|
||||
|
||||
print(trip_ids)
|
||||
trip_id = random.choice(trip_ids)
|
||||
|
||||
from_station = None
|
||||
|
||||
@@ -5,6 +5,7 @@ emoji_list = {
|
||||
"TRAM": "🚈",
|
||||
"REGIONAL_RAIL": "🚊",
|
||||
"HIGHSPEED_RAIL": "🚅",
|
||||
"LONG_DISTANCE": "🚅",
|
||||
"METRO": "🚇",
|
||||
"SUBWAY": "🚇"
|
||||
}
|
||||
@@ -98,6 +98,10 @@ OPERATORS = {
|
||||
"enno": {
|
||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Enno_logo.svg/960px-Enno_logo.svg.png",
|
||||
"color": 0x88216F
|
||||
},
|
||||
"DSB": {
|
||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/8/87/DSB_company_logo.svg/960px-DSB_company_logo.svg.png",
|
||||
"color": 0xB22B32
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +115,12 @@ OPERATOR_ALIASES = {
|
||||
"DB Regio AG NRW": OPERATORS["db_allgemein"],
|
||||
"DB Regio AG Südost": OPERATORS["db_allgemein"],
|
||||
"DB Regio AG Nordost": OPERATORS["db_allgemein"],
|
||||
"DB Regio AG Nord": OPERATORS["db_allgemein"],
|
||||
"DB Regio AG Mitte": OPERATORS["db_allgemein"],
|
||||
"NS International": OPERATORS["NS"],
|
||||
"SBB GmbH": OPERATORS["SBB"],
|
||||
"Schweizerische Bundesbahnen SBB": OPERATORS["SBB"],
|
||||
"Dänische Staatsbahnen": OPERATORS["DSB"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-1
@@ -31,8 +31,18 @@ def build_info_embed() -> discord.Embed:
|
||||
color = metadata["color"]
|
||||
)
|
||||
|
||||
stops = trip["stops"]
|
||||
|
||||
if len(stops) > 2:
|
||||
count = min(3, len(stops))
|
||||
random_stops = random.sample(list(stops), k=count)
|
||||
|
||||
via = ", ".join(random_stops[:-1]) + " und " + random_stops[-1]
|
||||
embed.add_field(name="Über", value=via, inline=False)
|
||||
|
||||
|
||||
route_lines = []
|
||||
for stop_name, stop_arrival in trip["stops"].items():
|
||||
for stop_name, stop_arrival in stops.items():
|
||||
if stop_name == trip["station"]:
|
||||
route_lines.append(f"**• {stop_name} ({stop_arrival} Uhr)**")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user