twitools/bot.py

22 lines
663 B
Python
Raw Normal View History

2017-02-07 21:36:31 +00:00
#!/usr/bin/env python3
2017-02-08 11:26:25 +00:00
import logging, setuptools, strings, telegram.ext
2017-02-07 21:36:31 +00:00
2017-02-07 22:11:59 +00:00
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
updater = telegram.ext.Updater(token=setuptools.token())
2017-02-07 21:54:22 +00:00
def start(bot, update):
2017-02-08 11:26:25 +00:00
bot.sendMessage(chat_id=update.message.chat_id, text=strings.start)
def auth(bot, update):
bot.sendMessage(chat_id=update.message.chat_id, text="Ooops. Not implemented yet.")
2017-02-07 21:54:22 +00:00
2017-02-07 22:11:59 +00:00
updater.dispatcher.add_handler(telegram.ext.CommandHandler("start", start))
2017-02-08 11:26:25 +00:00
updater.dispatcher.add_handler(telegram.ext.CommandHandler("auth", auth))
2017-02-07 21:54:22 +00:00
2017-02-07 22:11:59 +00:00
try:
updater.start_polling()
except KeyboardInterrupt:
updater.stop()