Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/LindseyB/XOmBot into featur…
Browse files Browse the repository at this point in the history
…e/ruby
  • Loading branch information
wilkie committed Mar 14, 2012
2 parents 83a1177 + b4851f2 commit edb91dd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/xombot/plugins/tweet.rb
Original file line number Diff line number Diff line change
@@ -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.