Skip to content

Instantly share code, notes, and snippets.

@onodes
Created August 22, 2009 16:20
Show Gist options
  • Save onodes/172833 to your computer and use it in GitHub Desktop.
Save onodes/172833 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'net/irc'
class ExampleClient < Net::IRC::Client
def hash_make
@hash = Hash.new
@hash["onodes"] = 0.to_i
end
def on_rpl_welcome(m)
hash_make
post JOIN, opts.channel
end
def on_privmsg(m)
channel, message = *m
if message.include?("onodes--") && m.prefix.nick == "reath"
post PRIVMSG, channel, "onodes++"
end
if message.include?("reath--") && m.prefix.nick != "onodes"
post PRIVMSG, channel, "reath--"
end
end
end
client = ExampleClient.new("irc.tokyo.wide.ad.jp", 6667,
{:nick => "onodes_rb", :user => "onodes_rb", :real => "onodes_rb",
:channel => "#LOCAL-students"}
)
client.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment