Skip to content

Instantly share code, notes, and snippets.

@onodes
Created August 22, 2009 17:16
Show Gist options
  • Save onodes/172855 to your computer and use it in GitHub Desktop.
Save onodes/172855 to your computer and use it in GitHub Desktop.
#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