2019-10-11 22:40:28 +02:00
|
|
|
import logging
|
2020-05-12 22:29:44 +02:00
|
|
|
|
2019-10-17 20:19:37 +02:00
|
|
|
from telegram.ext import Updater, CommandHandler, InlineQueryHandler, CallbackQueryHandler
|
2019-10-11 22:40:28 +02:00
|
|
|
|
2019-10-17 19:03:09 +02:00
|
|
|
from exceptions import *
|
2020-09-14 20:41:54 +02:00
|
|
|
from vvs import inline_station_search, handle_vvs, handle_multiple_stations_reply
|
2020-09-18 22:36:37 +02:00
|
|
|
from weather_meteomedia import handle_meteomedia
|
|
|
|
from weather_openweathermap import handle_weather, __init__
|
2019-10-17 19:03:09 +02:00
|
|
|
|
2019-10-11 22:40:28 +02:00
|
|
|
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)
|
|
|
|
|
2019-10-17 19:03:09 +02:00
|
|
|
|
2020-05-12 22:27:47 +02:00
|
|
|
def __main__():
|
|
|
|
inline_station_search_handler = InlineQueryHandler(inline_station_search)
|
|
|
|
dispatcher.add_handler(inline_station_search_handler)
|
|
|
|
dispatcher.add_handler(CommandHandler('vvs', handle_vvs))
|
2020-09-18 22:36:37 +02:00
|
|
|
dispatcher.add_handler(CommandHandler('meteomedia', handle_meteomedia))
|
|
|
|
dispatcher.add_handler(CommandHandler("weather", handle_weather))
|
|
|
|
|
|
|
|
__init__()
|
2019-10-11 22:40:28 +02:00
|
|
|
|
2020-05-12 22:27:47 +02:00
|
|
|
dispatcher.add_error_handler(error_callback)
|
2019-10-11 22:40:28 +02:00
|
|
|
|
2020-09-24 11:12:57 +02:00
|
|
|
dispatcher.add_handler(CallbackQueryHandler(handle_multiple_stations_reply, pattern="^\/vvs"))
|
2020-05-12 22:27:47 +02:00
|
|
|
updater.start_polling()
|
|
|
|
updater.idle()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
__main__()
|