3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

Factoids: revert $var expansion relocation

This commit is contained in:
Pragmatic Software 2020-07-06 20:56:06 -07:00
parent ab6ffc0a5e
commit be06b8e241

View File

@ -1252,6 +1252,20 @@ sub handle_action {
$ref_from = $context->{ref_from} ? "[$context->{ref_from}] " : '';
}
unless ($self->{factoids}->exists($channel, $keyword, 'interpolate') and $self->{factoids}->get_data($channel, $keyword, 'interpolate') eq '0') {
my ($root_channel, $root_keyword) =
$self->find_factoid($context->{ref_from} ? $context->{ref_from} : $context->{from}, $context->{root_keyword}, arguments => $context->{arguments}, exact_channel => 1);
if (not defined $root_channel or not defined $root_keyword) {
$root_channel = $channel;
$root_keyword = $keyword;
}
if (not length $context->{keyword_override} and length $self->{factoids}->get_data($root_channel, $root_keyword, 'keyword_override')) {
$context->{keyword_override} = $self->{factoids}->get_data($root_channel, $root_keyword, 'keyword_override');
}
$action = $self->expand_factoid_vars($context, $action);
}
if (length $context->{arguments}) {
if ($action =~ m/\$\{?args/ or $action =~ m/\$\{?arg\[/) {
unless (defined $self->{factoids}->get_data($channel, $keyword, 'interpolate') and $self->{factoids}->get_data($channel, $keyword, 'interpolate') eq '0') {
@ -1322,20 +1336,6 @@ sub handle_action {
return $self->{pbot}->{interpreter}->interpret($context);
}
unless ($self->{factoids}->exists($channel, $keyword, 'interpolate') and $self->{factoids}->get_data($channel, $keyword, 'interpolate') eq '0') {
my ($root_channel, $root_keyword) =
$self->find_factoid($context->{ref_from} ? $context->{ref_from} : $context->{from}, $context->{root_keyword}, arguments => $context->{arguments}, exact_channel => 1);
if (not defined $root_channel or not defined $root_keyword) {
$root_channel = $channel;
$root_keyword = $keyword;
}
if (not length $context->{keyword_override} and length $self->{factoids}->get_data($root_channel, $root_keyword, 'keyword_override')) {
$context->{keyword_override} = $self->{factoids}->get_data($root_channel, $root_keyword, 'keyword_override');
}
$action = $self->expand_factoid_vars($context, $action);
}
$self->{pbot}->{logger}
->log("(" . (defined $context->{from} ? $context->{from} : "(undef)") . "): $context->{nick}!$context->{user}\@$context->{host}: $trigger_name: action: \"$action\"\n");