ability to look up tweets for a user, relative to the latest

This commit is contained in:
Brian S. Stephan 2010-12-16 15:23:35 -06:00
parent 57ddba744e
commit efafb95f5a
1 changed files with 11 additions and 3 deletions

View File

@ -87,11 +87,19 @@ class Twitter(Module):
return self.reply(connection, replypath, self.tweet_or_retweet_text(tweet=tweet, print_source=True))
except twitter.TwitterError as 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:
if len(whats) >= 4:
index = int(whats[3])
if index < 0:
index = 0
else:
index = 0
count = (-1*index) + 1
try:
tweets = self.twit.GetUserTimeline(screen_name=whats[2], count=30, include_rts=True)
tweets = self.twit.GetUserTimeline(screen_name=whats[2], count=count, include_rts=True)
if tweets:
tweet = tweets[0]
tweet = tweets[-1*index]
return self.reply(connection, replypath, self.tweet_or_retweet_text(tweet=tweet))
except twitter.TwitterError as e:
return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))