Implemented tweet handler, shorter reply call

This commit is contained in:
Klaus-Uwe Mitterer 2017-02-08 14:46:59 +01:00
parent 955acb74b4
commit 6beb8f6137

12
bot.py
View file

@ -7,22 +7,26 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s
updater = telegram.ext.Updater(token=setuptools.token())
def start(bot, update):
bot.sendMessage(chat_id=update.message.chat_id, text=strings.start % (setuptools.botname(), setuptools.botname()))
update.message.reply_text(strings.start % (setuptools.botname(), setuptools.botname()))
def auth(bot, update):
bot.sendMessage(chat_id=update.message.chat_id, text="Ooops. Not implemented yet.")
update.message.reply_text("Ooops. Not implemented yet.")
def unauth(bot, update):
dbtools.dbHelper().deleteUser(update.message.chat_id)
bot.sendMessage(chat_id=update.message.chat_id, text=strings.unauth % setuptools.url())
update.message.reply_text(strings.unauth % setuptools.url())
def fish(bot, update):
bot.sendMessage(chat_id=update.message.chat_id, text="Yummy! Thanks! :3")
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()