-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (24 loc) · 1.07 KB
/
Copy pathmain.py
File metadata and controls
33 lines (24 loc) · 1.07 KB
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
32
33
import __builtin__ as shared
from telegram import Bot
from telegram.ext import Updater
from util import configure_from_file
# configure for normal mode
configure_from_file('default.cfg')
from worker import Notifier
from command import (start, showlist, setlanguage, subscribe, unsubscribe,
subscriptions, default, watch)
if __name__ == '__main__':
updater = Updater(token=shared.config['telegram']['token'])
dispatcher = updater.dispatcher
dispatcher.addTelegramCommandHandler('start', start)
dispatcher.addTelegramCommandHandler('showlist', showlist)
dispatcher.addTelegramCommandHandler('setlanguage',setlanguage)
dispatcher.addTelegramCommandHandler('subscribe',subscribe)
dispatcher.addTelegramCommandHandler('unsubscribe',unsubscribe)
dispatcher.addTelegramCommandHandler('subscriptions',subscriptions)
dispatcher.addTelegramCommandHandler('watch',watch)
dispatcher.addTelegramMessageHandler(default)
# start command handler
updater.start_polling()
# start notifier
Notifier(bot=updater.bot).start()