mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 19:52:47 +00:00
Warne den Nutzer bei unbekannten Anbietern
This commit is contained in:
+9
-1
@@ -20,6 +20,7 @@ def build_info_embed() -> discord.Embed | None:
|
||||
|
||||
conn = handlers.current
|
||||
operator = operator_infos(conn["train"])
|
||||
|
||||
embed = discord.Embed(
|
||||
title=handlers.train_name,
|
||||
description=f"Abfahrt von {conn['station']} um {format_timestamp(conn['departure'])}",
|
||||
@@ -29,7 +30,14 @@ def build_info_embed() -> discord.Embed | None:
|
||||
if len(conn['via']) > 0:
|
||||
embed.add_field(name="Über", value=format_via_list(conn['via']), inline=False)
|
||||
|
||||
embed.set_author(name=operator["name"])
|
||||
if operator["name"] == "Unbekannter Anbieter":
|
||||
anbieter = conn['train'].split()[0]
|
||||
print(f"INFO: Unbekannter Anbieter für Typ {anbieter}")
|
||||
operator_name = f"{operator['name']} (Typ: {anbieter})"
|
||||
else:
|
||||
operator_name = operator["name"]
|
||||
|
||||
embed.set_author(name=operator_name)
|
||||
embed.set_thumbnail(url=operator["logo"])
|
||||
|
||||
route_lines = []
|
||||
|
||||
+1
-2
@@ -25,7 +25,6 @@ async def rename_vc(bot: discord.Bot) -> bool:
|
||||
train = current['train'].split()[1]
|
||||
train_name = f"{train} nach {current['destination']}"
|
||||
|
||||
print(f"Info: {train_name} from {current['station']} \n via: {current['via']}")
|
||||
|
||||
print(f"Umstieg: {train_name} von {current['station']} \nüber: {current['via']}")
|
||||
await channel.edit(name=f"{config['formatting']}{train_name}",)
|
||||
return True
|
||||
@@ -39,7 +39,6 @@ def operator_infos(train):
|
||||
return OPERATORS["fallback"]
|
||||
|
||||
train_type = train.split()[0]
|
||||
print(train_type)
|
||||
return OPERATORS.get(train_type, OPERATORS["fallback"])
|
||||
|
||||
def format_via_list(via: list[str]):
|
||||
|
||||
Reference in New Issue
Block a user