From 37a677946dac6848d254fa2ba2fba894fde9086a Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 15 Dec 2010 23:52:59 -0600 Subject: [PATCH] fetch more tweets in case the latest was a RT (which we are filtering) comment about how i'm not really sure about this approach --- modules/Twitter.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/Twitter.py b/modules/Twitter.py index f4fdeed..b0d86a3 100644 --- a/modules/Twitter.py +++ b/modules/Twitter.py @@ -89,9 +89,13 @@ class Twitter(Module): return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e)) elif whats[1] == 'user' and len(whats) == 3: try: - tweets = self.twit.GetUserTimeline(screen_name=whats[2], count=1, include_rts=False) - tweet = tweets[0] - return self.reply(connection, replypath, tweet.user.name + ': ' + tweet.text) + # TODO: on the fence about this. including native retweets could be confusing + # (the displayed user would be someone other than who was searched for), but + # if the user's last 30 tweets are RTs, this will be empty, which also sucks + tweets = self.twit.GetUserTimeline(screen_name=whats[2], count=30, include_rts=False) + if tweets: + tweet = tweets[0] + return self.reply(connection, replypath, tweet.user.name + ': ' + tweet.text) except twitter.TwitterError as e: return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))