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
This commit is contained in:
Brian S. Stephan 2010-12-15 23:52:59 -06:00
parent 7e4e6ab23f
commit 37a677946d

View File

@ -89,9 +89,13 @@ class Twitter(Module):
return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e)) return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))
elif whats[1] == 'user' and len(whats) == 3: elif whats[1] == 'user' and len(whats) == 3:
try: try:
tweets = self.twit.GetUserTimeline(screen_name=whats[2], count=1, include_rts=False) # TODO: on the fence about this. including native retweets could be confusing
tweet = tweets[0] # (the displayed user would be someone other than who was searched for), but
return self.reply(connection, replypath, tweet.user.name + ': ' + tweet.text) # 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: except twitter.TwitterError as e:
return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e)) return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))