use Net::IRC;
use Net::AIML;
use strict;
use warnings;
if (!@ARGV) {
print "\nUSAGE: bot.pl [SERVER] [NICK] [CHAN]\nTo talk to the bot simply/msg [NICK] [MESSAGE]\nOr in the channel [NICK], [MESSAGE]. Within your irc client\n";
exit(0);
}
my $b = Net::AIML->new(botid => 'ba30d497ce360e23');
my $i = new Net::IRC;
my $c = $i->newconn("Server", $ARGV[0], "Nick", $ARGV[1]);
my $x;
$c->add_handler(376, \&o);
$c->add_handler('msg', \&m);
$c->add_handler('public', \&m);
$i->start;
sub o {
(my $s = shift)->join($ARGV[2]);
$x = 1;
}
sub m {
if ($x == 1) {
my ($s, $e) = @_;
if ($e->{type} =~/public/ && $e->{args}[0] =~ /^($ARGV[1]), /i or $e->{type} =~ /msg/) {
my $d = ($e->{type} =~/public/) ? $e->{to}[0] : $e->{nick};
my $r = $e->{args}[0];
$r =~ s/^($ARGV[1]),//i;
my $t = $b->tell($r)."\n";
$t =~ s/^Alice://i;
$t =~ s/<\/?.+?>//g;
$s->privmsg($d, $t);
}
}
}
my @ret = $main->getOpenFile(-multiple => 9999999, -filetypes => $types);
foreach my $path (@ret) {
my $ret = $main->getOpenFile(-multiple => 9999999, -filetypes => $types);
foreach my $path (@$ret) {