]> ruin.nu Git - NDIRC.git/commitdiff
Learn from background talk, not only direkt talk
authorMichael Andreen <harv@ruin.nu>
Sat, 20 Nov 2010 14:18:15 +0000 (15:18 +0100)
committerMichael Andreen <harv@ruin.nu>
Sat, 20 Nov 2010 14:18:15 +0000 (15:18 +0100)
Commands/Misc.pm
Delling.pm

index ae4b561b5b5bb872c75dd7a5ddaf021666249124..fb05348fe33da5f8d30bc4b937aef44d813907eb 100644 (file)
@@ -55,5 +55,14 @@ FROM (SELECT now() - time AS time FROM last_smokes WHERE nick = $1) l
        }
 };
 
+command teachbot => {
+       help => q(dummy command),
+       acl => 'irc_teachbot',
+       type => q(teachbot),
+}, class extends NDIRC::Command {
+       method execute($c,$msg) {
+       }
+};
+
 1;
 
index f19bf2a366271e06525641a03ffbe6115be75874..df44711f1188df078221b8a546afd6c4fc47fda6 100644 (file)
@@ -61,10 +61,11 @@ after irc_public => sub {
                unless ($irc->is_channel_member($channel,$1) || /(Constructing|Researching)/){
                        $msg = ".anon $_ $text";
                }
-
-       }
-       if ($self->parseCommand($msg,$irc,$nick,$address,$channel,$dbh)){
+       }elsif ($self->parseCommand($msg,$irc,$nick,$address,$channel,$dbh)){
                #Command parsed and run successfully
+       }elsif($self->disp->has_command('teachbot',$channel)){
+               $msg =~ s/^\S+:\s*//;
+               $self->hal->learn($msg);
        }
 };