From 43850de7060df0b0c29e78ee6437af538d53296b Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Wed, 8 Feb 2017 15:23:15 +0100 Subject: [PATCH] Actually count fish, add missing ')' --- bot.py | 3 ++- dbtools/__init__.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 0ff7782..f73ffa1 100755 --- a/bot.py +++ b/bot.py @@ -21,6 +21,7 @@ def unauth(bot, update): update.message.reply_text(strings.unauth % setuptools.url()) def fish(bot, update): + dbtools.dbHelper().addFish(update.message.chat_id) update.message.reply_text("Yummy! Thanks! :3") def explicitTweet(bot, update): @@ -31,7 +32,7 @@ def tweet(bot, update): def toggleTweet(bot, update): try: - update.message.reply_text(strings.toggleTweet % ("on" if dbtools.dbHelper().toggleTweet(update.message.chat_id) else "off") + update.message.reply_text(strings.toggleTweet % ("on" if dbtools.dbHelper().toggleTweet(update.message.chat_id) else "off")) except: update.message.reply_text(strings.noauth) diff --git a/dbtools/__init__.py b/dbtools/__init__.py index 137ddc3..4a6a514 100644 --- a/dbtools/__init__.py +++ b/dbtools/__init__.py @@ -97,6 +97,10 @@ class dbObject: except: raise ValueError("No such user: %i" % int(cid)) + def addFish(self, cid): + self.executeQuery("UPDATE tokens SET fish = fish + 1 WHERE cid = %i;" % int(cid)) + self.commit() + def dbHelper(): if setuptools.dbtype() == SQLITE: return dbObject(dbtype=SQLITE, path=setuptools.dbpath())