Why not adopt me?
NAME
Bot::Cobalt::Core::Sugar - Exported sugar for Bot::Cobalt plugins
SYNOPSIS
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"
);
DESCRIPTION
This module provides the sugar imported when you 'use Bot::Cobalt'; these are simple functions that wrap Bot::Cobalt::Core methods.
core
Returns the Bot::Cobalt::Core singleton for the running instance.
Same as calling:
require
Bot::Cobalt::Core;
my
$core
= Bot::Cobalt::Core->instance;
broadcast
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.
irc_context
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
irc_object
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
logger
Returns the core singleton's logger object.
logger->info(
"Log message"
);
Wrapper for core->log->$method
plugin_alias
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
plugin_cfg
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
register
$self
,
'SERVER'
,
@events
;
Register to receive specified syndicated events.
Wrapper for core->plugin_register(); see Bot::Cobalt::Manual::Plugins for details.
unregister
Stop listening for specified syndicated events.
Wrapper for core->plugin_unregister()
AUTHOR
Jon Portnoy <avenj@cobaltirc.org>