Warne den Nutzer bei unbekannten Anbietern

This commit is contained in:
Kaaninchen
2026-07-17 17:55:55 +02:00
parent bcd8d3a507
commit e487edf729
4 changed files with 10 additions and 6 deletions
-2
View File
@@ -7,7 +7,6 @@ from src.commands import setup_commands
from src.embeds import build_error_embed
from src.data.status import discord_status
bot = discord.Bot(intents=discord.Intents.all())
setup_commands(bot)
@@ -28,7 +27,6 @@ async def on_application_command_error(ctx, error):
embed = build_error_embed(f"Ein Fehler ist aufgetreten: {error}")
await ctx.respond(embed=embed)
try:
bot.run(config['token'])
except:
+9 -1
View File
@@ -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
View File
@@ -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
-1
View File
@@ -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]):