-
Notifications
You must be signed in to change notification settings - Fork 0
/
shopperbot.py
33 lines (23 loc) · 1.12 KB
/
shopperbot.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
32
33
import logging
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler
import telegbot
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(filename='./telegbot.log',
format=LOG_FORMAT,
filemode='w',
level=logging.INFO)
logger = logging.getLogger()
token = telegbot.get_token()
updates = Updater(token)
logger.info("adding dispatchers")
updates.dispatcher.add_handler(CommandHandler('start', telegbot.start))
updates.dispatcher.add_handler(CommandHandler('help', telegbot.help))
updates.dispatcher.add_handler(CallbackQueryHandler(telegbot.button_parent,
pattern="paid.*"))
updates.dispatcher.add_handler(CallbackQueryHandler(telegbot.button_category,
pattern="caid.*"))
updates.dispatcher.add_handler(CallbackQueryHandler(telegbot.button_more,
pattern="more.*"))
logger.info("all commands configured")
updates.start_polling()
updates.idle()