NAME
Whatbot::Component - Base component for all whatbot modules.
SYNOPSIS
use MooseX::Declare;
use Method::Signatures::Modifiers;
class Whatbot::Command extends Whatbot::Component {
method foo() {
$self->log->write('I am so awesome.');
}
}
DESCRIPTION
Whatbot::Component is the base component for all whatbot modules. This requires a little bit of magic from the caller, as the accessors all need to be filled by Whatbot::Controller.
PUBLIC ACCESSORS
- parent
-
The parent component of this module.
- config
-
The Whatbot::Config instance.
- ios
-
A HashRef of available Whatbot::IO instances.
- log
-
The available Whatbot::Log instance, commonly used as $self->log->write('Foo');.
PUBLIC METHODS
- model($model_name)
-
Retrieve the model (or Whatbot::Database::Table::*) instance associated with the provided name. For example, to retrieve the active instance of Whatbot::Database::Table::Factoid, call $self->model('Factoid'). This will warn and return nothing if the model is not found.
- search_ios($search_string)
-
Retrieve the IO with a partial match to the given string. This is handy for getting the reference to an IO that may have an odd name, like IRC_127.0.0.1.
- dispatch_message( $io_path, $message )
-
Dispatch a Whatbot::Message, corresponding to the given IO path, through the command dispatcher.
- dispatch_message( $io_path, $message )
-
Send a Whatbot::Message via the given IO name or partial IO name.
LICENSE/COPYRIGHT
Be excellent to each other and party on, dudes.