gecko-dev/webtools/mozbot/BotModules/HelloWorld.bm

30 строки
663 B
Plaintext

################################
# Hello World Module #
################################
package BotModules::HelloWorld;
use vars qw(@ISA);
@ISA = qw(BotModules);
1;
sub Help {
my $self = shift;
my ($event) = @_;
return {
'' => 'This is the demo module that says Hello World.',
'hi' => 'Requests that the bot emit a hello world string.',
};
}
sub Told {
my $self = shift;
my ($event, $message) = @_;
if ($message =~ /^\s*hi\s*$/osi) {
$self->say($event, 'Hello World!');
} else {
return $self->SUPER::Told(@_);
}
return 0; # we've dealt with it, no need to do anything else.
}