mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-17 01:19:31 +01:00
Factoid/Variables: minor refactor, no semantic changes
This commit is contained in:
parent
c6f6823df9
commit
73c4ed465d
@ -217,6 +217,7 @@ sub expand_action_arguments($self, $action, $input, $nick) {
|
|||||||
my %h;
|
my %h;
|
||||||
|
|
||||||
if (not defined $input or $input eq '') {
|
if (not defined $input or $input eq '') {
|
||||||
|
$input = '';
|
||||||
%h = (args => $nick);
|
%h = (args => $nick);
|
||||||
} else {
|
} else {
|
||||||
%h = (args => $input);
|
%h = (args => $input);
|
||||||
@ -226,18 +227,16 @@ sub expand_action_arguments($self, $action, $input, $nick) {
|
|||||||
$jsonargs =~ s/^{".*":"//;
|
$jsonargs =~ s/^{".*":"//;
|
||||||
$jsonargs =~ s/"}$//;
|
$jsonargs =~ s/"}$//;
|
||||||
|
|
||||||
if (not defined $input or $input eq '') {
|
|
||||||
$input = "";
|
|
||||||
$action =~ s/\$args:json|\$\{args:json\}/$jsonargs/ge;
|
|
||||||
$action =~ s/\$args(?![[\w])|\$\{args(?![[\w])\}/$nick/g;
|
|
||||||
} else {
|
|
||||||
$action =~ s/\$args:json|\$\{args:json\}/$jsonargs/g;
|
|
||||||
$action =~ s/\$args(?![[\w])|\$\{args(?![[\w])\}/$input/g;
|
|
||||||
}
|
|
||||||
|
|
||||||
my @args = $self->{pbot}->{interpreter}->split_line($input);
|
my @args = $self->{pbot}->{interpreter}->split_line($input);
|
||||||
|
|
||||||
$action =~ s/\$arglen\b|\$\{arglen\}/scalar @args/eg;
|
$action =~ s/\$arglen\b|\$\{arglen\}/scalar @args/eg;
|
||||||
|
$action =~ s/\$args:json|\$\{args:json\}/$jsonargs/g;
|
||||||
|
|
||||||
|
if ($input eq '') {
|
||||||
|
$action =~ s/\$p?args(?![[\w])|\$\{p?args(?![[\w])\}/$nick/g;
|
||||||
|
} else {
|
||||||
|
$action =~ s/\$args(?![[\w])|\$\{args(?![[\w])\}/$input/g;
|
||||||
|
}
|
||||||
|
|
||||||
my $depth = 0;
|
my $depth = 0;
|
||||||
my $const_action = $action;
|
my $const_action = $action;
|
||||||
@ -248,7 +247,7 @@ sub expand_action_arguments($self, $action, $input, $nick) {
|
|||||||
last if ++$depth >= 100;
|
last if ++$depth >= 100;
|
||||||
|
|
||||||
if ($arg eq '*') {
|
if ($arg eq '*') {
|
||||||
if (not defined $input or $input eq '') {
|
if ($input eq '') {
|
||||||
$action =~ s/\$arg\[\*\]|\$\{arg\[\*\]\}/$nick/;
|
$action =~ s/\$arg\[\*\]|\$\{arg\[\*\]\}/$nick/;
|
||||||
} else {
|
} else {
|
||||||
$action =~ s/\$arg\[\*\]|\$\{arg\[\*\]\}/$input/;
|
$action =~ s/\$arg\[\*\]|\$\{arg\[\*\]\}/$input/;
|
||||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4822,
|
BUILD_REVISION => 4823,
|
||||||
BUILD_DATE => "2024-11-02",
|
BUILD_DATE => "2024-11-02",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user