3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Factoids: do not encode JSON in expand_action_arguments()

This commit is contained in:
Pragmatic Software 2021-02-07 13:42:23 -08:00
parent 80a4060dab
commit 0977f9aa1e

View File

@ -908,7 +908,7 @@ sub expand_action_arguments {
if (not defined $input or $input eq '') { %h = (args => $nick); } if (not defined $input or $input eq '') { %h = (args => $nick); }
else { %h = (args => $input); } else { %h = (args => $input); }
my $jsonargs = encode_json \%h; my $jsonargs = to_json \%h;
$jsonargs =~ s/^{".*":"//; $jsonargs =~ s/^{".*":"//;
$jsonargs =~ s/"}$//; $jsonargs =~ s/"}$//;
@ -986,7 +986,7 @@ sub expand_action_arguments {
sub escape_json { sub escape_json {
my ($self, $text) = @_; my ($self, $text) = @_;
my $thing = {thing => $text}; my $thing = {thing => $text};
my $json = encode_json $thing; my $json = to_json $thing;
$json =~ s/^{".*":"//; $json =~ s/^{".*":"//;
$json =~ s/"}$//; $json =~ s/"}$//;
return $json; return $json;