mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-09-17 16:52:47 +00:00
Compare commits
3
Commits
53ded15209
...
db43ee4279
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db43ee4279 | ||
|
|
dc2f9dade0 | ||
|
|
10b6ee560e |
@@ -82,7 +82,7 @@ but you can safely ignore this warning if you're fine with it.
|
|||||||
If not, I've created a tool which would help you to get the exact station name. You can use the tool by running
|
If not, I've created a tool which would help you to get the exact station name. You can use the tool by running
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ python run main.py stations
|
$ python main.py stations
|
||||||
```
|
```
|
||||||
|
|
||||||
Example output:
|
Example output:
|
||||||
@@ -122,11 +122,10 @@ For every station inside of the `stations.json` you'll find an ID. You can add t
|
|||||||
This is especially useful if you want to add a station whose name isn't unique and also used by other stations. The bot would falsely use the first station with the same name and consider it an exact match, even if you wanted a different one. This won't happen with the ID, as every ID is uniquely assigned to only one station.
|
This is especially useful if you want to add a station whose name isn't unique and also used by other stations. The bot would falsely use the first station with the same name and consider it an exact match, even if you wanted a different one. This won't happen with the ID, as every ID is uniquely assigned to only one station.
|
||||||
|
|
||||||
##### blacklist
|
##### blacklist
|
||||||
You can blacklist specific types of transport, the bot would then skip them while selecting a connection. You can get the type either in your console (mode)
|
You can blacklist specific types of transport, the bot would then skip them while selecting a connection. You can get the type in your console (mode)
|
||||||
```sh
|
```sh
|
||||||
22:44:47: INFO: Agency: GVB, mode: TRAM
|
22:44:47: INFO: Agency: GVB, mode: TRAM
|
||||||
```
|
```
|
||||||
or in the `/info` embed.
|
|
||||||
|
|
||||||
I highly recommend keeping `"OTHER"` blacklisted, if the API doesn't know what that is then we probably shouldn't use it. Also, it would probably a good idea to keep `"RIDE_SHARING"` blacklisted as they have weird timetables
|
I highly recommend keeping `"OTHER"` blacklisted, if the API doesn't know what that is then we probably shouldn't use it. Also, it would probably a good idea to keep `"RIDE_SHARING"` blacklisted as they have weird timetables
|
||||||
|
|
||||||
@@ -164,7 +163,7 @@ Place the audio file of your desired station in [src/data/announcements](src/dat
|
|||||||
After you've set everything up, you're ready to start the bot!
|
After you've set everything up, you're ready to start the bot!
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ python run main.py
|
$ python main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## src/data
|
## src/data
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ channel:
|
|||||||
train_via: "{train_name} nach {goes_to} über {from_station}"
|
train_via: "{train_name} nach {goes_to} über {from_station}"
|
||||||
short_name: "{train_name} nach {goes_to}"
|
short_name: "{train_name} nach {goes_to}"
|
||||||
embeds:
|
embeds:
|
||||||
footer:
|
|
||||||
notice: "https://transitous.org/sources/ • Maps (C) CARTO (C) OpenStreetMap.org contributors"
|
|
||||||
info:
|
info:
|
||||||
description: "Abfahrt von {station} um {departure}. Ankunft um {arrival}"
|
description: "Abfahrt von {station} um {departure}. Ankunft um {arrival}"
|
||||||
via: "Über"
|
via: "Über"
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ channel:
|
|||||||
train_via: "{train_name} to {goes_to} via {from_station}"
|
train_via: "{train_name} to {goes_to} via {from_station}"
|
||||||
short_name: "{train_name} to {goes_to}"
|
short_name: "{train_name} to {goes_to}"
|
||||||
embeds:
|
embeds:
|
||||||
footer:
|
|
||||||
notice: "Data provided by https://transitous.org/sources/ • Maps (C) CARTO (C) OpenStreetMap.org contributors"
|
|
||||||
info:
|
info:
|
||||||
description: "Departure from {station} at {departure}. Arrival by {arrival}"
|
description: "Departure from {station} at {departure}. Arrival by {arrival}"
|
||||||
via: "via"
|
via: "via"
|
||||||
|
|||||||
+4
-4
@@ -7,8 +7,8 @@ from src.lang.locales import lang
|
|||||||
|
|
||||||
lang_embed = lang.embeds
|
lang_embed = lang.embeds
|
||||||
|
|
||||||
def build_embed_footer(mode: str, slogans):
|
def build_embed_footer(slogans):
|
||||||
footer_notice = f"{lang.embeds.footer.notice()} • mode: {mode}"
|
footer_notice = f"https://transitous.org/sources/ • Maps (C) CARTO (C) OpenStreetMap.org contributors"
|
||||||
icon = "https://raw.githubusercontent.com/kaaninchen/Gleiswechsel/refs/heads/main/src/data/assets/transitous-logo.png"
|
icon = "https://raw.githubusercontent.com/kaaninchen/Gleiswechsel/refs/heads/main/src/data/assets/transitous-logo.png"
|
||||||
|
|
||||||
if slogans is not None:
|
if slogans is not None:
|
||||||
@@ -55,7 +55,7 @@ def build_info_embed() -> discord.Embed:
|
|||||||
for field_name, field_value in route_fields:
|
for field_name, field_value in route_fields:
|
||||||
embed.add_field(name=field_name, value=field_value, inline=False)
|
embed.add_field(name=field_name, value=field_value, inline=False)
|
||||||
|
|
||||||
footer = build_embed_footer(trip["mode"], metadata["slogans"])
|
footer = build_embed_footer(metadata["slogans"])
|
||||||
embed.set_footer(text=footer["text"], icon_url=footer["icon"])
|
embed.set_footer(text=footer["text"], icon_url=footer["icon"])
|
||||||
|
|
||||||
embed.set_author(name=agency)
|
embed.set_author(name=agency)
|
||||||
@@ -78,7 +78,7 @@ def build_announcement_embed(msg):
|
|||||||
embed.set_author(name=agency)
|
embed.set_author(name=agency)
|
||||||
embed.set_thumbnail(url=metadata["logo"])
|
embed.set_thumbnail(url=metadata["logo"])
|
||||||
|
|
||||||
footer = build_embed_footer(trip["mode"], metadata.get("slogan"))
|
footer = build_embed_footer(metadata.get("slogan"))
|
||||||
embed.set_footer(text=footer["text"], icon_url=footer["icon"])
|
embed.set_footer(text=footer["text"], icon_url=footer["icon"])
|
||||||
|
|
||||||
return embed
|
return embed
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# generated by datamodel-codegen:
|
# generated by datamodel-codegen:
|
||||||
# filename: en.yaml
|
# filename: en.yaml
|
||||||
# timestamp: 2026-08-20T10:40:43+00:00
|
# timestamp: 2026-08-23T14:08:25+00:00
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
@@ -19,11 +19,6 @@ class Channel:
|
|||||||
short_name: str
|
short_name: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Footer:
|
|
||||||
notice: str
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Info:
|
class Info:
|
||||||
description: str
|
description: str
|
||||||
@@ -45,7 +40,6 @@ class Announcement:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Embeds:
|
class Embeds:
|
||||||
footer: Footer
|
|
||||||
info: Info
|
info: Info
|
||||||
announcement: Announcement
|
announcement: Announcement
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user