Created
June 1, 2009 20:12
-
-
Save sarahhodne/121710 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/home/mint/pavarotti/plugins/irc/irc.rb:46:in `register_events': wrong number of arguments (1 for 2) (ArgumentError) | |
from /home/mint/pavarotti/plugins/irc/irc.rb:15:in `initialize' | |
from /home/mint/pavarotti/pavarotti.rb:95:in `new' | |
from /home/mint/pavarotti/pavarotti.rb:95:in `do_load' | |
from /home/mint/pavarotti/pavarotti.rb:27:in `load!' | |
from bot.rb:6:in `<main>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/yail' | |
require File.dirname(__FILE__) + '/ircevents' | |
class IrcPlugin | |
def initialize(pm) | |
@pm = pm | |
@irc = Net::YAIL.new( | |
:address => @pm[:config]["host"], | |
:username => @pm[:config]["ident"], | |
:realname => @pm[:config]["realname"], | |
:nicknames => [@pm[:config]["address"]] | |
) | |
register_events() | |
@irc.start_listening | |
while @irc.dead_socket == false | |
# Avoid major CPU overuse by taking a very short nap | |
sleep 0.05 | |
end | |
end | |
private | |
include IRCEvents | |
def register_events | |
@irc.prepend_handler :incoming_msg, method(:incoming_msg) | |
@irc.prepend_handler :incoming_act, method(:incoming_act) | |
@irc.prepend_handler :incoming_invite, method(:incoming_invite) | |
@irc.prepend_handler :incoming_ctcp, method(:incoming_ctcp) | |
@irc.prepend_handler :incoming_ctcpreply, method(:incoming_ctcpreply) | |
@irc.prepend_handler :incoming_notice, method(:incoming_notice) | |
@irc.prepend_handler :incoming_mode, method(:incoming_mode) | |
@irc.prepend_handler :incoming_join, method(:incoming_join) | |
@irc.prepend_handler :incoming_part, method(:incoming_part) | |
@irc.prepend_handler :incoming_kick, method(:incoming_kick) | |
@irc.prepend_handler :incoming_quit, method(:incoming_quit) | |
@irc.prepend_handler :incoming_nick, method(:incoming_nick) | |
@irc.prepend_handler :incoming_ping, method(:incoming_ping) | |
@irc.prepend_handler :incoming_miscellany, method(:incoming_miscellany) | |
@irc.prepend_handler :incoming_welcome, method(:incoming_welcome) | |
@irc.prepend_handler :incoming_bannedfromchan, method(:incoming_bannedfromchan) | |
@pm.register(:out_privmsg) {|target, text| @irc.handle(:outgoing_privmsg, target, text) } | |
@pm.register(:out_ctcp) {|target, text| @irc.handle(:outgoing_ctcp, target, text) } | |
@pm.register(:out_act) {|target, text| @irc.handle(:outgoing_act, target, text) } | |
@pm.register(:out_notice) {|target, text| @irc.handle(:outgoing_notice, target, text) } | |
@pm.register(:out_ctcpreply) {|target, text| @irc.handle(:outgoing_ctcpreply, target, text) } | |
@pm.register(:out_mode) {|target, modes, objects| @irc.handle(:outgoing_mode, target, modes, objects) } | |
@pm.register(:out_join) {|target, pass| @irc.handle(:outgoing_join, target, pass) } | |
@pm.register(:out_part) {|target, text| @irc.handle(:outgoing_part, target, text) } | |
@pm.register(:out_quit) {|text| @irc.handle(:outgoing_quit, text) } | |
@pm.register(:out_nick) {|new_nick| @irc.handle(:outgoing_nick, new_nick) } | |
@pm.register(:out_user) {|username, myaddress, address, realname| @irc.handle(:outgoing_user, username, myaddress, address, realname) } | |
@pm.register(:out_pass) {|password| @irc.handle(:outgoing_pass, password) } | |
@pm.register(:out_oper) {|user, password| @irc.handle(:outgoing_oper, user, password) } | |
@pm.register(:out_topic) {|channel, new_topic| @irc.handle(:outgoing_topic, channel, new_topic) } | |
@pm.register(:out_names) {|channel| @irc.handle(:outgoing_names, channel) } | |
@pm.register(:out_list) {|channel, server| @irc.handle(:outgoing_list, channel, server) } | |
@pm.register(:out_invite) {|nick, channel| @irc.handle(:outgoing_invite, nick, channel) } | |
@pm.register(:out_kick) {|nick, channel, comment| @irc.handle(:outgoing_kick, nick, channel, comment) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment