diff --git a/dbtools/__init__.py b/dbtools/__init__.py index 4a6a514..434382c 100644 --- a/dbtools/__init__.py +++ b/dbtools/__init__.py @@ -85,11 +85,8 @@ class dbObject: except: return False - def toggleTweet(self, cid): + def getTStatus(self, cid): try: - self.executeQuery("UPDATE tokens SET tweet = NOT tweet WHERE cid = %i;" % int(cid)) - self.commit() - self.executeQuery("SELECT tweet FROM tokens WHERE cid = %i;" % int(cid)) return True if self.cur.fetchone()[0] == 1 else False @@ -97,6 +94,12 @@ class dbObject: except: raise ValueError("No such user: %i" % int(cid)) + def toggleTweet(self, cid): + self.executeQuery("UPDATE tokens SET tweet = NOT tweet WHERE cid = %i;" % int(cid)) + self.commit() + + return getTStatus + def addFish(self, cid): self.executeQuery("UPDATE tokens SET fish = fish + 1 WHERE cid = %i;" % int(cid)) self.commit()