# identification. Observe that this means the bot may not connect any channels
# until the 'identified' method gets delegated
def connect
- join_channels unless @bot.config['irc.join_after_identify']
+ if @bot.config['irc.join_after_identify']
+ log "waiting for identififcation before JOINing default channels"
+ else
+ join_channels
+ end
end
def ctcp_listen(m)
end
end
+ def bot_channel_list(m, param)
+ ret = _('I am in: ')
+ # sort the channels by the base name and then map with prefixes for the
+ # mode and display.
+ ret << @bot.channels.compact.sort { |a,b|
+ a.name.downcase <=> b.name.downcase
+ }.map { |c|
+ c.modes_of(@bot.myself).map{ |mo|
+ m.server.prefix_for_mode(mo)
+ }.to_s + c.name
+ }.join(', ')
+ m.reply ret
+ end
+
def bot_quit(m, param)
@bot.quit param[:msg].to_s
end
@bot.restart param[:msg].to_s
end
+ def bot_reconnect(m, param)
+ @bot.reconnect param[:msg].to_s
+ end
+
def bot_hide(m, param)
@bot.join 0
end
@bot.say param[:where], param[:what].to_s
end
+ def bot_notify(m, param)
+ @bot.notice param[:where], param[:what].to_s
+ end
+
def bot_action(m, param)
@bot.action param[:where], param[:what].to_s
end
_("quit [<message>] => quit IRC with message <message>")
when "restart"
_("restart => completely stop and restart the bot (including reconnect)")
+ when "reconnect"
+ _("reconnect => ask the bot to disconnect and then connect again")
when "join"
_("join <channel> [<key>] => join channel <channel> with secret key <key> if specified. #{@bot.myself} also responds to invites if you have the required access level")
when "part"
:action => 'bot_restart',
:defaults => { :msg => nil },
:auth_path => 'quit'
+basics.map "reconnect *msg",
+ :action => 'bot_reconnect',
+ :defaults => { :msg => nil },
+ :auth_path => 'quit'
basics.map "quiet [in] [:where]",
:action => 'bot_quiet',
basics.map "say :where *what",
:action => 'bot_say',
:auth_path => 'talk::do'
+basics.map "notify :where *what",
+ :action => 'bot_notify',
+ :auth_path => 'talk::do'
basics.map "action :where *what",
:action => 'bot_action',
:auth_path => 'talk::do'
:action => 'bot_part',
:defaults => {:chan => nil},
:auth_path => 'move'
+basics.map "channels",
+ :action => 'bot_channel_list',
+ :auth_path => 'move'
basics.map "hide",
:action => 'bot_hide',
:auth_path => 'move'