Added station name in first message

the name is parsed from the first departure information
This commit is contained in:
JuliusFreudenberger 2019-10-18 12:34:30 +02:00
parent 1077d9acc4
commit c11d324588

2
bot.py
View file

@ -112,7 +112,7 @@ def get_vvs_departures(query):
request = requests.get("https://efa-api.asw.io/api/v1/station/" + query.station_id + "/departures") request = requests.get("https://efa-api.asw.io/api/v1/station/" + query.station_id + "/departures")
if request.status_code != 200: if request.status_code != 200:
raise ServerCommunicationError raise ServerCommunicationError
reply.append("Next departures:") reply.append("Next departures for station: " + request.json()[0]['stopName'])
printed_departures = 0 printed_departures = 0
for station in request.json(): for station in request.json():
if station['direction'].casefold().find(query.destination) != -1 or station['direction'].find( if station['direction'].casefold().find(query.destination) != -1 or station['direction'].find(