require 'singleton'
module Irc
- BotConfig.register BotConfigArrayValue.new('plugins.blacklist',
+class Bot
+ Config.register Config::ArrayValue.new('plugins.blacklist',
:default => [], :wizard => false, :requires_rescan => true,
:desc => "Plugins that should not be loaded")
module Plugins
functionality. Rather than subclassing BotModule, however, one should
subclass either CoreBotModule (reserved for system modules) or Plugin
(for user plugins).
-
+
A BotModule interacts with Irc events by defining one or more of the following
methods, which get called as appropriate when the corresponding Irc event
happens.
map is the new, cleaner way to respond to specific message formats without
littering your plugin code with regexps, and should be used instead of
#register() and #privmsg() (see below) when possible.
-
+
The difference between map and map! is that map! will not register the new
command as an alternative name for the plugin.
# the rbot instance
# @registry::
# the botmodule's registry, which can be used to store permanent data
- # (see BotRegistryAccessor for additional documentation)
+ # (see Registry::Accessor for additional documentation)
#
# Other instance variables which are defined and should not be overwritten
# byt the user, but aren't usually accessed directly, are:
@botmodule_triggers = Array.new
@handler = MessageMapper.new(self)
- @registry = BotRegistryAccessor.new(@bot, self.class.to_s.gsub(/^.*::/, ""))
+ @registry = Registry::Accessor.new(@bot, self.class.to_s.gsub(/^.*::/, ""))
@manager.add_botmodule(self)
if self.respond_to?('set_language')
key = $1
params = $2
- # Let's see if we can match a plugin by the given name
+ # Let's see if we can match a plugin by the given name
(core_modules + plugins).each { |p|
- next unless p.name == key
+ next unless p.name == key
begin
return p.help(key, params)
rescue Exception => err
end
}
- # Nope, let's see if it's a command, and ask for help at the corresponding botmodule
+ # Nope, let's see if it's a command, and ask for help at the corresponding botmodule
k = key.to_sym
if commands.has_key?(k)
p = commands[k][:botmodule]
end
end
+end