Created
August 22, 2009 17:16
-
-
Save onodes/172855 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
#simple_ircbot.rb | |
require 'rubygems' | |
require 'net/irc' | |
require 'twitter' | |
class ExampleClient < Net::IRC::Client | |
def twit_func(message) | |
if message.include?("onodes") | |
httpauth = Twitter::HTTPAuth.new("onodes","passwd") | |
twit = Twitter::Base.new(httpauth) | |
twit.update("今roomでonodesの名前が出たよ!") | |
end | |
end | |
def on_rpl_welcome(m) | |
hash_make | |
post JOIN, opts.channel | |
end | |
def on_privmsg(m) | |
channel, message = *m | |
twit_func(message) | |
end | |
end | |
client = ExampleClient.new("irc.tokyo.wide.ad.jp", 6667, | |
{:nick => "onodes_rb", :user => "onodes_rb", :real => "onodes_rb", | |
:channel => "#onodesroom"} | |
) | |
client.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment