Greatly enhance the bot's conversational ability, using the very

latest in AI techniques.
This commit is contained in:
terry%netscape.com 1998-11-06 20:53:22 +00:00
parent 089f06e3bf
commit 88cc417a7b

View File

@ -51,6 +51,7 @@ use Net::IRC;
use LWP::Simple;
use Tinderbox;
use Carp;
use Chatbot::Eliza;
$|++;
@ -222,11 +223,10 @@ sub do_command {
# on_msg: private message received via /msg
sub on_msg
{
my ($self, $event) = @_;
my ($nick) = $event->nick;
my ($arg) = $event->args;
sub on_msg {
my ($self, $event) = @_;
my ($nick) = $event->nick;
my ($arg) = $event->args;
my @arglist = split(' ', $arg);
my $cmd = shift @arglist;
my $rest = join(' ', @arglist);
@ -241,7 +241,10 @@ sub on_msg
if (do_command(\%pubcmds, $nick, $cmd, $rest)) {
return;
}
do_command(\%msgcmds, $nick, $cmd, $rest);
if (do_command(\%msgcmds, $nick, $cmd, $rest)) {
return;
}
do_unknown($nick, $cmd, $rest);
}
@ -329,12 +332,20 @@ sub on_public {
if (do_command(\%pubcmds, $channel, $cmd, $rest)) {
return;
} else {
$self->privmsg($channel, $nick . ": Um, your what hurts?");
do_unknown($channel, $cmd, $rest);
}
}
}
sub do_unknown {
my ($nick, $cmd, $rest) = (@_);
if (!defined $::eliza) {
$::eliza = new Chatbot::Eliza;
}
my $result = $::eliza->transform("$cmd $rest");
$bot->privmsg($nick, $result);
}
sub saylongline {