ModuleDocumentation/whatbot/Command.pm

NAME

whatbot::Command - Base class for whatbot commands

SYNOPSIS

 package whatbot::Command::Example;
 use Moose;
 BEGIN { extends 'whatbot::Command' }
 
 sub register {
     my ($self) = @_;
     
     $self->require_direct(0);
 }

DESCRIPTION

whatbot::Command is a base class, meant to be subclassed by any additional whatbot command or extension. It provides a skeleton structure to create a new command, parses command attributes, and gives the warnings necessary when a command is not implemented properly.

To create a new command, subclass this module using Moose's 'extends' pragma, and override the given methods with your own. Set attributes to your methods to hook into events.

RETURN VALUES

Each subroutine called by the Controller can return either a string or a whatbot::Message. Anywhere in an outgoing message where the word '!who' is found will be replaced by the name of the sender of the triggering message.

PUBLIC ACCESSORS

command_priority
Determines at what point in the processing order this command will fire. Valid entries are 'Primary', 'Core', 'Extension', and defaults to Extension. Primary are first runners, Core are components considered essential, and Extension is parsed in order after those components.
require_direct
Forces the module to only respond if the name of the bot is used in the message.
my_config
Contains the configuration for this module from the whatbot config file, if any.

PUBLIC METHODS

register()
Called after class instantiation to set properties and instantiate any persistent objects required by the Command.
help()
Returned when a user asks for help on a command.

INHERITANCE

LICENSE/COPYRIGHT

Be excellent to each other and party on, dudes.