From bb1a7ce99ae91343ba4ec91a6d1f8083ee6fe940 Mon Sep 17 00:00:00 2001 From: JuliusFreudenberger Date: Tue, 12 May 2020 22:27:47 +0200 Subject: [PATCH] Added __name__=__main__ for easier startup Also made replies silent --- bot.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bot.py b/bot.py index c271dc3..2eaa565 100644 --- a/bot.py +++ b/bot.py @@ -96,7 +96,7 @@ def handle_vvs(update, context): departures = get_vvs_departures(query) for reply in departures: - update.message.reply_text(reply) + update.message.reply_text(reply, disable_notification=True) def parse_station(args): @@ -168,12 +168,17 @@ def error_callback(update, context): return -inline_station_search_handler = InlineQueryHandler(inline_station_search) +def __main__(): + inline_station_search_handler = InlineQueryHandler(inline_station_search) + dispatcher.add_handler(inline_station_search_handler) + dispatcher.add_handler(CommandHandler('vvs', handle_vvs)) -dispatcher.add_handler(inline_station_search_handler) -dispatcher.add_handler(CommandHandler('vvs', handle_vvs)) -dispatcher.add_error_handler(error_callback) -dispatcher.add_handler(CallbackQueryHandler(handle_multiple_stations_reply)) + dispatcher.add_error_handler(error_callback) -updater.start_polling() -updater.idle() + dispatcher.add_handler(CallbackQueryHandler(handle_multiple_stations_reply)) + updater.start_polling() + updater.idle() + + +if __name__ == "__main__": + __main__()