import logging from telegram.ext import Updater, CommandHandler, InlineQueryHandler, CallbackQueryHandler from exceptions import * from vvs import inline_station_search, handle_vvs, handle_multiple_stations_reply from weather_meteomedia import handle_weather token_file = open("token", "r") updater = Updater(token=token_file.read(), use_context=True) token_file.close() dispatcher = updater.dispatcher logging.basicConfig(format='%(acstime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) 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(CommandHandler('weather', handle_weather)) dispatcher.add_error_handler(error_callback) dispatcher.add_handler(CallbackQueryHandler(handle_multiple_stations_reply, pattern="^\/vvs")) updater.start_polling() updater.idle() if __name__ == "__main__": __main__()