diff --git a/bot.py b/bot.py index 081be22..e71bdba 100644 --- a/bot.py +++ b/bot.py @@ -18,7 +18,7 @@ def start(update): def search_station(query): request = requests.get("https://efa-api.asw.io/api/v1/station/?search=" + query) - if request.status_code != 200: + if request.status_code != 200 and len(request.text) > 2: return -1 else: return request.json()[0]['stationId'] @@ -77,3 +77,6 @@ updater.dispatcher.add_handler(CommandHandler('vvs', get_vvs_departures)) updater.start_polling() updater.idle() + if query.station_id == -1: + update.message.reply_text("No station matching this name found!") + return