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

Improve the bot's understanding of "me" and "my"

This commit is contained in:
Pragmatic Software 2017-08-01 21:34:57 -07:00
parent 74fe574332
commit e723379c4d

View File

@ -202,18 +202,14 @@ sub interpret {
$keyword = $command; $keyword = $command;
} }
if($keyword ne "factadd" $tonick = $nick if $tonick eq 'me';
and $keyword ne "add"
and $keyword ne "factfind" if ($keyword !~ /^(factadd|add|factfind|find|factshow|show|forget|factdel|factset|factchange|change|msg|tell)/) {
and $keyword ne "find"
and $keyword ne "factshow"
and $keyword ne "show"
and $keyword ne "factset"
and $keyword ne "factchange"
and $keyword ne "change"
and $keyword ne "msg") {
$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/\\my\b/my/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');