Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irc = IRC.new({
- :server => "irc.server.com",
- :port => 6667, # optional
- :password => "foobar", # optional
- :nick => "Rubot",
- :real => "Rubot", #optional
- :debug => true # optional
- })
- ### listeners
- irc.on("connect") do
- # called when you have registered on the server
- end
- irc.on("join") do |channel, nick|
- # called when a user joins a channel
- end
- irc.on("part") do |channel, nick|
- # called when a user leaves a channel
- end
- irc.on("nick") do |nick, new_nick|
- # called when a user changes their nick
- end
- irc.on("message") do |channel, nick, message|
- # called when a user sends a message to a channel
- end
- irc.on("pm") do |nick, message|
- # called when a user sends a private message to you
- end
- irc.on("quit") do |nick|
- # called when a user quits
- end
- ### methods
- irc.connect # connect to the server
- irc.join("channel") # join a channel
- irc.say("channel/nick", "message") # leave a message to a channel or user
Advertisement
Add Comment
Please, Sign In to add comment