wm: irc-h2o-bot

ref: fa731d2f6d93fe6224f369e9dc506b4f284c730d
dir: /ruby-irc.rb/

View raw version

require 'IRC'

bot = IRC.new("h2o", "irc.ircnow.org", "6667", "H2O")
IRCEvent.add_callback('endofmotd') { |event| bot.add_channel('#fpc') }
IRCEvent.add_callback('invite') { |event| bot.add_channel(event.message) }
IRCEvent.add_callback('join') { |event|
    bot.send_message(event.channel, "Hello #{event.from}")
  IRCEvent.add_callback('privmsg') {|e|
    puts e.message
    }
}
bot.connect