Respond to !forget, even if unaddressed
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 14 Nov 2015 18:43:24 +0000 (18:43 +0000)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 14 Nov 2015 18:43:24 +0000 (18:43 +0000)
lib/POE/Component/IRC/Plugin/Infobot.pm
t/POE-Component-IRC-Plugin-Infobot.t

index bd8d83d6009923cfdf8679bc5e239ebb2795aac1..c2969b63b321d00dda1ddc6235f2bae2f444390a 100644 (file)
@@ -86,8 +86,8 @@ sub runcmd{
                infobot_add $self, $irc, $1, $2, $to, $nick if $addressed
        } elsif (/^(.+)\?$/) {
                infobot_query $self, $irc, $1, $to, $nick, $addressed
-       } elsif (/^forget\s+(.*)$/) {
-               infobot_forget $self, $irc, $1, $to, $nick if $addressed
+       } elsif ($addressed && /^!?forget\s+(.*)$/ || /^!forget\s+(.*)$/) {
+               infobot_forget $self, $irc, $1, $to, $nick
        }
 }
 
index cbe422ebc33114c303ddf7f8a960dbb747cfc3c5..8846b8313a90dcf89e516636cad3e5bfb70b12d3 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 
 use Test::MockObject;
-use Test::More tests => 16;
+use Test::More tests => 17;
 
 BEGIN { use_ok('POE::Component::IRC::Plugin::Infobot') };
 
@@ -42,6 +42,7 @@ runtest 'bot: a is c', '... but a is b!', 'redefine factoid';
 runtest 'a?', 'a is b', 'query';
 runtest 'bot: forget a', 'mgv: I forgot a', 'forget';
 runtest 'bot: forget a', 'I didn\'t have anything matching a, mgv', 'forget inexistent factoid';
+runtest '!forget a', 'I didn\'t have anything matching a, mgv', '!forget';
 runtest 'a?', undef, 'query for inexistent factoid';
 runtest 'bot: a?', 'I don\'t know, mgv', 'addressed query for inexistent factoid';
 
This page took 0.012206 seconds and 4 git commands to generate.