forked from LindseyB/XOmBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/LindseyB/XOmBot into featur…
…e/ruby
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |