Permalink
Browse files

Merge branch 'master' of git://github.com/LindseyB/XOmBot into featur…

…e/ruby
  • Loading branch information...
2 parents 83a1177 + b4851f2 commit edb91ddb8ffd5f8f8de256363b8ef0caaad768b8 @wilkie committed Mar 14, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/xombot/plugins/tweet.rb
@@ -1,10 +1,18 @@
class Tweet < XOmBot::Plugin
- match /tweet (\d+)/
+ match /tweet (\d+)/, :method => :tweet_by_id
help "Displays the tweet with the given id"
usage "tweet 12345678 -- displays the twitter update with that id"
+
+ match /tweet (\w.*)/, :method => :tweet_by_username
+ help "Displays the latest tweet by the given user"
+ usage "tweet noob -- displays the last tweet by noob"
- def execute(m, id)
+ def tweet_by_id(m, id)
status = Twitter.status(id)
m.reply "@#{status.user.screen_name}: #{status.text}"
end
+
+ def tweet_by_username(m, username)
+ m.reply "@#{username}: #{Twitter.user_timeline(username).first.text}"
+ end
end

0 comments on commit edb91dd

Please sign in to comment.