ref: 5dd90f003508a4d47a4cc3880600f3164b19b336
dir: /test.rb/
require 'rubygems' require 'net/yail' irc = Net::YAIL.new( :address => 'irc.ircnow.org', :username => 'Moz_Bot', :realname => 'Moz_Mozak', :nicknames => ['bot1'] ) # Register a proc callback irc.on_welcome proc { |event| irc.join('#fpc') } # Register a block irc.on_invite { |event| irc.join(event.channel) } # Another way to register a block - note that this clobbers the prior callback irc.set_callback(:incoming_invite) { |event| irc.join(event.channel) } # Filter for all incoming pings so we can log them irc.hearing_ping {|event| $stderr.puts event.inspect} # Filter condition: if the message is a pm, ignore it by forcibly ending the event filter chain irc.hearing_message(:if => {:pm? => true}) do |event| event.handle! end def Send(x) for i in 1..10 do x.msg('#fpc', i) sleep(1); end end irc.heard_msg(:if => {:message => "bah"}) do t = Thread.new{Send(irc)} #puts "bah dige" end irc.start_listening!