2017-02-07 21:36:31 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2017-02-08 12:06:17 +00:00
|
|
|
import dbtools, 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 12:06:17 +00:00
|
|
|
bot.sendMessage(chat_id=update.message.chat_id, text=strings.start % (setuptools.botname, setuptools.botname))
|
2017-02-08 11:26:25 +00:00
|
|
|
|
|
|
|
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-08 12:06:17 +00:00
|
|
|
def unauth(bot, update):
|
|
|
|
dbtools.deleteUser(update.message.chat_id)
|
|
|
|
bot.sendMessage(chat_id=update.message.chat_id, text=strings.unauth % setuptools.url)
|
|
|
|
|
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()
|