This bot was written using OO methods. Thus to write a new module you need
to inherit your new module from baseactor and settle it into the bot class hierarchy:
package zebot::newmodule;
use zebot::baseactor;
our @ISA = ("zebot::baseactor");
.
Baseactor supplies all the callbacks that might be used on a module, providing a default response. Just copy over the method prototypes you want to use into your new class and extend them (e.g. PUBLICaction, PRIVMSGaction, etc.).
The irc answers are all allready parsed up by the bot framework, all methods
of the modules receive a hash as argument, in which is stored the information
to be send off. This hash is build in a consistent way for all calls, even if
the meaning of the fields my vary in function of the event that was processed :
my $subargs = {
"kernel" => $kernel,
"heap" => $heap,
"usernick" =>$nick,
"username" =>$name,
"userhost" =>$host,
"line" =>$line,
"addressed" =>\$addressed,
"channel" =>$addressed->[0],
"context" =>$_[SENDER], #this one holds the link to the actual server, can be used as post target
};
The bot holds a reference of all installed modules by type name. And certan modules are rated as vital, letting the bot stop if they aren't present. Those modules are pam and messageHandler. once a reference to those 2 modules fetched you can ask them for user authntification and rights and for text by tokens.
An example fetching such a reference would be: my $msgHand =
($this->sysdata())->{"actors"}->{"messageHandler"};
Otherwise, look at how the other modules were made, and ask back if more explanations should appear here, and what.