Created
May 13, 2009 02:00
-
-
Save rduarte/110826 to your computer and use it in GitHub Desktop.
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
class Array | |
def shuffle! | |
size.downto(1) { |n| push delete_at(rand(n)) } | |
self | |
end | |
end | |
require 'rubygems' | |
require 'twibot' | |
configure do |conf| | |
conf.login = "botname" | |
conf.password = "twitterpassword" | |
end | |
messages=[ | |
"Hi!", | |
"Leave me alone!", | |
"How are you?", | |
] | |
message do |message, params| | |
post_tweet "@#{message.sender.screen_name} " + messages.shuffle![0] unless message.sender.screen_name == "botname" | |
end | |
reply do |message, params| | |
post_tweet "@#{message.user.screen_name} " + messages.shuffle![0] unless message.user.screen_name == "botname" | |
end |
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
ruby bot.rb |
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
gem sources -a http://gems.github.com | |
sudo gem install twibot | |
sudo gem install twitter4r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment