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:
@@ -7,7 +7,6 @@ from src.commands import setup_commands
|
|||||||
from src.embeds import build_error_embed
|
from src.embeds import build_error_embed
|
||||||
from src.data.status import discord_status
|
from src.data.status import discord_status
|
||||||
|
|
||||||
|
|
||||||
bot = discord.Bot(intents=discord.Intents.all())
|
bot = discord.Bot(intents=discord.Intents.all())
|
||||||
setup_commands(bot)
|
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}")
|
embed = build_error_embed(f"Ein Fehler ist aufgetreten: {error}")
|
||||||
await ctx.respond(embed=embed)
|
await ctx.respond(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bot.run(config['token'])
|
bot.run(config['token'])
|
||||||
except:
|
except:
|
||||||
|
|||||||
+9
-1
@@ -20,6 +20,7 @@ def build_info_embed() -> discord.Embed | None:
|
|||||||
|
|
||||||
conn = handlers.current
|
conn = handlers.current
|
||||||
operator = operator_infos(conn["train"])
|
operator = operator_infos(conn["train"])
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=handlers.train_name,
|
title=handlers.train_name,
|
||||||
description=f"Abfahrt von {conn['station']} um {format_timestamp(conn['departure'])}",
|
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:
|
if len(conn['via']) > 0:
|
||||||
embed.add_field(name="Über", value=format_via_list(conn['via']), inline=False)
|
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"])
|
embed.set_thumbnail(url=operator["logo"])
|
||||||
|
|
||||||
route_lines = []
|
route_lines = []
|
||||||
|
|||||||
+1
-2
@@ -25,7 +25,6 @@ async def rename_vc(bot: discord.Bot) -> bool:
|
|||||||
train = current['train'].split()[1]
|
train = current['train'].split()[1]
|
||||||
train_name = f"{train} nach {current['destination']}"
|
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}",)
|
await channel.edit(name=f"{config['formatting']}{train_name}",)
|
||||||
return True
|
return True
|
||||||
@@ -39,7 +39,6 @@ def operator_infos(train):
|
|||||||
return OPERATORS["fallback"]
|
return OPERATORS["fallback"]
|
||||||
|
|
||||||
train_type = train.split()[0]
|
train_type = train.split()[0]
|
||||||
print(train_type)
|
|
||||||
return OPERATORS.get(train_type, OPERATORS["fallback"])
|
return OPERATORS.get(train_type, OPERATORS["fallback"])
|
||||||
|
|
||||||
def format_via_list(via: list[str]):
|
def format_via_list(via: list[str]):
|
||||||
|
|||||||
Reference in New Issue
Block a user