twitools/bot.py
2017-02-08 14:46:59 +01:00

33 lines
1.1 KiB
Python
Executable file

#!/usr/bin/env python3
import dbtools, logging, setuptools, strings, telegram.ext
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
updater = telegram.ext.Updater(token=setuptools.token())
def start(bot, update):
update.message.reply_text(strings.start % (setuptools.botname(), setuptools.botname()))
def auth(bot, update):
update.message.reply_text("Ooops. Not implemented yet.")
def unauth(bot, update):
dbtools.dbHelper().deleteUser(update.message.chat_id)
update.message.reply_text(strings.unauth % setuptools.url())
def fish(bot, update):
update.message.reply_text("Yummy! Thanks! :3")
def tweet(bot, update):
update.message.reply_text("Ooops. Not implemented yet.")
updater.dispatcher.add_handler(telegram.ext.CommandHandler("start", start))
updater.dispatcher.add_handler(telegram.ext.CommandHandler("auth", auth))
updater.dispatcher.add_handler(telegram.ext.CommandHandler("unauth", unauth))
updater.dispatcher.add_handler(telegram.ext.CommandHandler("fish", fish))
updater.dispatcher.add_handler(telegram.ext.MessageHandler(telegram.ext.Filters.text, tweet))
updater.start_polling()
updater.idle()