3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-05 10:58:44 +02:00

Exclude "Why would I want to do that to myself?" from specific commands

This commit is contained in:
Pragmatic Software 2017-08-26 04:06:36 -07:00
parent 428268a415
commit 2ac7b6feb6

View File

@ -204,26 +204,26 @@ sub interpret {
$tonick = $nick if defined $tonick and $tonick eq 'me'; $tonick = $nick if defined $tonick and $tonick eq 'me';
if ($keyword !~ /^(factadd|add|factfind|find|factshow|show|forget|factdel|factset|factchange|change|msg|tell|cc|eval|u|udict|ud|actiontrigger|urban|perl)/) { if ($keyword !~ /^(factrem|forget|factdel|factadd|add|factfind|find|factshow|show|forget|factdel|factset|factchange|change|msg|tell|cc|eval|u|udict|ud|actiontrigger|urban|perl)/) {
$keyword =~ s/(\w+)([?!.]+)$/$1/; $keyword =~ s/(\w+)([?!.]+)$/$1/;
$arguments =~ s/(?<![\w\/\-\\])me\b/$nick/gi if defined $arguments && $depth <= 2; $arguments =~ s/(?<![\w\/\-\\])me\b/$nick/gi if defined $arguments && $depth <= 2;
$arguments =~ s/(?<![\w\/\-\\])my\b/${nick}'s/gi if defined $arguments && $depth <= 2; $arguments =~ s/(?<![\w\/\-\\])my\b/${nick}'s/gi if defined $arguments && $depth <= 2;
$arguments =~ s/\\my\b/my/gi if defined $arguments && $depth <= 2; $arguments =~ s/\\my\b/my/gi if defined $arguments && $depth <= 2;
$arguments =~ s/\\me\b/me/gi if defined $arguments && $depth <= 2; $arguments =~ s/\\me\b/me/gi if defined $arguments && $depth <= 2;
}
my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick'); my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick');
if (defined $arguments && ($arguments =~ m/^(your|him|her|its|it|them|their)(self|selves)$/i || $arguments =~ m/^$botnick$/i)) { if (defined $arguments && ($arguments =~ m/^(your|him|her|its|it|them|their)(self|selves)$/i || $arguments =~ m/^$botnick$/i)) {
my $delay = (rand 10) + 8; my $delay = (rand 10) + 8;
my $message = { my $message = {
nick => $nick, user => $user, host => $host, command => $command, checkflood => 1, nick => $nick, user => $user, host => $host, command => $command, checkflood => 1,
message => "$nick: Why would I want to do that to myself?" message => "$nick: Why would I want to do that to myself?"
}; };
$self->add_message_to_output_queue($from, $message, $delay); $self->add_message_to_output_queue($from, $message, $delay);
$delay = duration($delay); $delay = duration($delay);
$self->{pbot}->{logger}->log("Final result ($delay delay) [$message->{message}]\n"); $self->{pbot}->{logger}->log("Final result ($delay delay) [$message->{message}]\n");
return undef; return undef;
}
} }
if(not defined $keyword) { if(not defined $keyword) {