3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Fix rare case where dont-replace-pronouns was ignored

This commit is contained in:
Pragmatic Software 2021-07-27 23:25:38 -07:00
parent 44a614b716
commit 62a477b7c4
3 changed files with 14 additions and 5 deletions

View File

@ -173,7 +173,7 @@ sub interpreter {
$context->{add_nick} = 1;
}
unless ($self->get_meta($keyword, 'dont-replace-pronouns')) {
unless ($context->{'dont-replace-pronouns'}) {
$context->{arguments} = $self->{pbot}->{factoids}->{variables}->expand_factoid_vars($context, $context->{arguments});
$context->{arglist} = $self->{pbot}->{interpreter}->make_args($context->{arguments});
}

View File

@ -416,10 +416,19 @@ sub interpret {
# unescape any escaped pipes
$arguments =~ s/\\\|\s*\{/| {/g;
# replace pronouns like "i", "my", etc, with "nick", "nick's", etc
if (not $self->{pbot}->{commands}->get_meta($keyword, 'dont-replace-pronouns')
and not $self->{pbot}->{factoids}->{data}->get_meta($context->{from}, $keyword, 'dont-replace-pronouns'))
my $from = $context->{from};
$from = '.*' unless $from =~ /^#/;
if ($self->{pbot}->{commands}->get_meta($keyword, 'dont-replace-pronouns')
or $self->{pbot}->{factoids}->{data}->get_meta($from, $keyword, 'dont-replace-pronouns'))
{
$context->{'dont-replace-pronouns'} = 1;
}
# replace pronouns like "i", "my", etc, with "nick", "nick's", etc
if (not $context->{'dont-replace-pronouns'}) {
$self->{pbot}->{logger}->log("Replacing pronouns for $context->{from}.$keyword\n");
# if command recipient is "me" then replace it with invoker's nick
# e.g., "!tell me about date" or "!give me date", etc

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4320,
BUILD_REVISION => 4322,
BUILD_DATE => "2021-07-27",
};