mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 12:29:27 +01:00
Expand factoid variables sooner so argument processing occurs on expanded action
This commit is contained in:
parent
d3944d82d9
commit
ecaa45b3dc
@ -561,6 +561,8 @@ sub interpreter {
|
|||||||
|
|
||||||
my $action = $self->{factoids}->hash->{$channel}->{$keyword}->{action};
|
my $action = $self->{factoids}->hash->{$channel}->{$keyword}->{action};
|
||||||
|
|
||||||
|
$action = $self->expand_factoid_vars($from, $action);
|
||||||
|
|
||||||
if(length $arguments) {
|
if(length $arguments) {
|
||||||
if(exists $self->{factoids}->hash->{$channel}->{$keyword}->{action_with_args}) {
|
if(exists $self->{factoids}->hash->{$channel}->{$keyword}->{action_with_args}) {
|
||||||
$action = $self->{factoids}->hash->{$channel}->{$keyword}->{action_with_args};
|
$action = $self->{factoids}->hash->{$channel}->{$keyword}->{action_with_args};
|
||||||
@ -634,17 +636,15 @@ sub interpreter {
|
|||||||
return undef if $arguments =~ m/\$(?:nick|arg)/;
|
return undef if $arguments =~ m/\$(?:nick|arg)/;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action =~ s/\$nick/$nick/g;
|
|
||||||
$action =~ s/\$channel/$from/g;
|
|
||||||
$action =~ s/\$randomnick/my $random = $self->{pbot}->{nicklist}->random_nick($from); $random ? $random : $nick/ge;
|
|
||||||
|
|
||||||
$action = $self->expand_factoid_vars($from, $action);
|
|
||||||
|
|
||||||
if($self->{factoids}->hash->{$channel}->{$keyword}->{enabled} == 0) {
|
if($self->{factoids}->hash->{$channel}->{$keyword}->{enabled} == 0) {
|
||||||
$self->{pbot}->{logger}->log("$keyword disabled.\n");
|
$self->{pbot}->{logger}->log("$keyword disabled.\n");
|
||||||
return "/msg $nick $ref_from$keyword is currently disabled.";
|
return "/msg $nick $ref_from$keyword is currently disabled.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$action =~ s/\$nick/$nick/g;
|
||||||
|
$action =~ s/\$channel/$from/g;
|
||||||
|
$action =~ s/\$randomnick/my $random = $self->{pbot}->{nicklist}->random_nick($from); $random ? $random : $nick/ge;
|
||||||
|
|
||||||
if($self->{factoids}->hash->{$channel}->{$keyword}->{type} eq 'module') {
|
if($self->{factoids}->hash->{$channel}->{$keyword}->{type} eq 'module') {
|
||||||
my $preserve_whitespace = $self->{factoids}->hash->{$channel}->{$keyword}->{preserve_whitespace};
|
my $preserve_whitespace = $self->{factoids}->hash->{$channel}->{$keyword}->{preserve_whitespace};
|
||||||
$preserve_whitespace = 0 if not defined $preserve_whitespace;
|
$preserve_whitespace = 0 if not defined $preserve_whitespace;
|
||||||
|
Loading…
Reference in New Issue
Block a user