Start a new instance
Options:
:address
: irc server
:port
: port number, default to 6667
:nicknames
: array of nicknames to cycle through
:nick_passwd
: password for the first nick of :nicknames
if we are not connected with this nick, we will use ghost and take this nick
:channels
: the channels we are going to connect to
:admin
: the nick of the user who can command the bot
# File lib/playbot.rb, line 34 def initialize(options = {}) @admin = options.delete(:admin) raise "You must provide an admin !" if !@admin if options[:nick_passwd] @nick = options[:nicknames].first @nick_paswd = options.delete[:nick_passwd] end options[:username] = BOTNAME options[:realname] = BOTNAME super(options) self.connect_socket self.start_listening end
This metod is called by IRCBot#connect_socket
# File lib/playbot.rb, line 52 def add_custom_handlers() @irc.hearing_welcome self.method(:_in_welcome) @irc.on_msg self.method(:_in_msg) end