Bot::Cobalt::Core::Sugar - Exported sugar for Bot::Cobalt plugins
use Bot::Cobalt; ## Call core methods . . . my $u_lev = core->auth->level($context, $nickname); my $p_cfg = core->get_plugin_cfg($self); # Call plugin_register register $self, 'SERVER', qw/ public_msg /; ## Call send_event broadcast 'message', $context, $channel, $string; ## Call core->log logger->warn("A warning");
This module provides the sugar imported when you 'use Bot::Cobalt'; these are simple functions that wrap Bot::Cobalt::Core methods.
Returns the Bot::Cobalt::Core singleton for the running instance.
Same as calling:
require Bot::Cobalt::Core; my $core = Bot::Cobalt::Core->instance;
Queue an event to send to the plugin pipeline.
broadcast $event, @args;
Wraps the send_event method available via Bot::Cobalt::Core, which is a POE::Component::Syndicator.
my $context_obj = irc_context($context);
Retrieves the Bot::Cobalt::IRC::Server object for the specified context.
Wrapper for core->get_irc_context() -- see Bot::Cobalt::Core::Role::IRC
my $irc_obj = irc_object($context);
Retrieves the IRC object assigned to a context, which is a POE::Component::IRC::State instance unless Bot::Cobalt::IRC has been subclassed or replaced.
Wrapper for core->get_irc_object() -- see Bot::Cobalt::Core::Role::IRC
Returns the core singleton's logger object.
logger->info("Log message");
Wrapper for core->log->$method
my $alias = plugin_alias($self);
Returns the known alias for a specified (loaded) plugin object.
Wrapper for core->get_plugin_alias() -- see Bot::Cobalt::Core::Role::EasyAccessors
my $opts = plugin_cfg($self)->{Opts};
Returns plugin configuration hashref for the specified plugin. Requires a plugin alias or blessed plugin object be specified.
Wrapper for core->get_plugin_cfg() -- see Bot::Cobalt::Core::Role::EasyAccessors
register $self, 'SERVER', @events;
Register to receive specified syndicated events.
Wrapper for core->plugin_register(); see Bot::Cobalt::Manual::Plugins for details.
Stop listening for specified syndicated events.
Wrapper for core->plugin_unregister()
Jon Portnoy <avenj@cobaltirc.org>
http://www.cobaltirc.org
To install Bot::Cobalt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Cobalt
CPAN shell
perl -MCPAN -e shell install Bot::Cobalt
For more information on module installation, please visit the detailed CPAN module installation guide.