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
}
}
use warnings;
use Test::MockObject;
-use Test::More tests => 16;
+use Test::More tests => 17;
BEGIN { use_ok('POE::Component::IRC::Plugin::Infobot') };
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';