look up most recent tweet by username

This commit is contained in:
Brian S. Stephan 2010-12-15 23:31:26 -06:00
parent e4edc7f6f4
commit 7e4e6ab23f
1 changed files with 7 additions and 0 deletions

View File

@ -87,6 +87,13 @@ class Twitter(Module):
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))
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)
except twitter.TwitterError as e:
return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))
# vi:tabstop=4:expandtab:autoindent
# kate: indent-mode python;indent-width 4;replace-tabs on;