-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
31 lines (24 loc) · 1.12 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Powered by Antima.it, Gianmarco Marcello
Main entrypoint for the update_notifier application.
"""
import sys
import os
from telegram.ext import Updater, CommandHandler
from handlers import wrap_handler, help_cmds, add, remove, list_urls, timer, timer_set, end
if __name__ == "__main__":
try:
token = os.environ["telegram_token"]
except KeyError:
sys.exit("$telegram_token is not defined")
user_urls = {}
updater = Updater(token)
updater.dispatcher.add_handler(CommandHandler('help', help_cmds))
updater.dispatcher.add_handler(CommandHandler('add', wrap_handler(add, user_urls)))
updater.dispatcher.add_handler(CommandHandler('remove', wrap_handler(remove, user_urls)))
updater.dispatcher.add_handler(CommandHandler('list', wrap_handler(list_urls, user_urls)))
updater.dispatcher.add_handler(CommandHandler('timer', wrap_handler(timer, user_urls)))
updater.dispatcher.add_handler(CommandHandler('set_timer', wrap_handler(timer_set, user_urls)))
updater.dispatcher.add_handler(CommandHandler('end', wrap_handler(end, user_urls)))
updater.start_polling()
updater.idle()