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:58 +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):
|
2017-02-08 12:12:05 +00:00
|
|
|
dbtools.dbHelper().deleteUser(update.message.chat_id)
|
2017-02-08 12:06:58 +00:00
|
|
|
bot.sendMessage(chat_id=update.message.chat_id, text=strings.unauth % setuptools.url())
|
2017-02-08 12:06:17 +00:00
|
|
|
|
2017-02-08 13:09:00 +00:00
|
|
|
def fish(bot, update):
|
|
|
|
bot.sendMessage(chat_id=update.message.chat_id, text="Yummy! Thanks! :3")
|
|
|
|
|
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-08 12:08:09 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("unauth", unauth))
|
2017-02-08 13:09:00 +00:00
|
|
|
updater.dispatcher.add_handler(telegram.ext.CommandHandler("fish", fish))
|
2017-02-07 21:54:22 +00:00
|
|
|
|
2017-02-07 22:11:59 +00:00
|
|
|
try:
|
|
|
|
updater.start_polling()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
updater.stop()
|