Class | Irc::Bot::Plugins::PluginManagerClass |
In: |
lib/rbot/plugins.rb
|
Parent: | Object |
DEFAULT_DELEGATE_PATTERNS | = | %r{^(?: connect|names|nick| listen|ctcp_listen|privmsg|unreplied| kick|join|part|quit| save|cleanup|flush_registry| set_.*|event_.* )$}x | This is the list of patterns commonly delegated to plugins. A fast delegation lookup is enabled for them. |
bot | [R] | |
botmodules | [R] | |
maps | [R] |
add one or more directories to the list of directories to load botmodules from
TODO find a way to specify necessary plugins which must be loaded
see if each plugin handles method, and if so, call it, passing m as a parameter (if present). BotModules are called in order of priority from lowest to highest.
If the passed m is a BasicUserMessage and is marked as ignored?, it will only be delegated to plugins with negative priority. Conversely, if it‘s a fake message (see BotModule#fake_message), it will only be delegated to plugins with positive priority.
Note that m can also be an exploded Array, but in this case the last element of it cannot be a Hash, or it will be interpreted as the options Hash for delegate itself. The last element can be a subclass of a Hash, though. To be on the safe side, you can add an empty Hash as last parameter for delegate when calling it with an exploded Array:
@bot.plugins.delegate(method, *(args.push Hash.new))
Currently supported options are the following:
:above : | if specified, the delegation will only consider plugins with a priority higher than the specified value |
:below : | if specified, the delegation will only consider plugins with a priority lower than the specified value |
Tells the PluginManager that the next time it delegates an event, it should sort the modules by priority
see if we have a plugin that wants to handle this message, if so, pass it to the plugin and return true, otherwise false
Registers botmodule botmodule with map map. This adds the map to the maps hash which has three keys:
botmodule: | the associated botmodule |
auth: | an array of auth keys checked by the map; the first is the full_auth_path of the map |
map: | the actual MessageTemplate object |