The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ZenIRCBot - Perl API for ZenIRCBot

SYNOPSIS

use ZenIRCBot;

my $bot = ZenIRCBot->new();
$bot->register_commands('ZenIRCBot::Test', [
    { name => 'foo', description => 'Returns bar' }
]);

$bot->subscribe(sub {
    my ($msg, $channel) = @_;
    
    if ($msg->{version} == 1 and $msg->{type} eq 'privmsg') {
        if ($msg->{data}->{message} =~ m/foo/) {
            $bot->send_privmsg(
                $msg->{data}->{channel},
                sprintf("%s: bar", $msg->{data}->{sender})
            );
        }
    }
});

$bot->run;

DESCRIPTION

Perl API for ZenIRCBot.

METHODS

Standard API Methods

See the ZenIRCBot documentation for more information.

subscribe($func)

Set callback for redis publish events.

callback($message, $channel)

The callback function is called on Redis subscribe events, with the message hashref and channel name.

SEE ALSO

ZenIRCBot

ZenIRCBot Documentation

AUTHOR

Anthony Johnson <aj@ohess.org>