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
1 changed files with 7 additions and 3 deletions

View File

@ -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))