From a4357a3ee77ce830db5673c898a3b942aa4fa0b4 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Mon, 16 Mar 2015 20:59:49 +0000 Subject: [PATCH] twitter: Fix last id initialization The previous code was right, I got confused with reddit. It just needs to guard against it not being in the DB - init to 0. --- tipbot/modules/twitter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tipbot/modules/twitter.py b/tipbot/modules/twitter.py index ce22c38..7ed5b33 100644 --- a/tipbot/modules/twitter.py +++ b/tipbot/modules/twitter.py @@ -65,8 +65,8 @@ class TwitterNetwork(Network): return False self.items_cache=dict() - self.last_seen_tweet_id=redis_get('twitter:last_seen_tweet_id') - self.last_seen_dm_id=redis_get('twitter:last_seen_dm_id') + self.last_seen_tweet_id=long(redis_get('twitter:last_seen_tweet_id') or 0) + self.last_seen_dm_id=long(redis_get('twitter:last_seen_dm_id') or 0) log_log('loaded last seen id: tweet %s, dm %s' % (str(self.last_seen_tweet_id),str(self.last_seen_dm_id))) auth=tweepy.OAuthHandler(ckey,csecret)