3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Add object name to JSON metadata when saving

This commit is contained in:
Pragmatic Software 2020-04-24 23:04:07 -07:00
parent 4fb1ed815b
commit 4e71cb0674
2 changed files with 7 additions and 2 deletions

View File

@ -113,6 +113,8 @@ sub save {
$self->add('$metadata$', '$metadata$', { update_version => PBot::VERSION::BUILD_REVISION });
}
$self->set('$metadata$', '$metadata$', 'name', $self->{name}, 1);
my $json = JSON->new;
my $json_text = $json->pretty->canonical->utf8->encode($self->{hash});

View File

@ -97,6 +97,8 @@ sub save {
$self->add('$metadata$', { update_version => PBot::VERSION::BUILD_REVISION });
}
$self->set('$metadata$', 'name', $self->{name}, 1);
my $json = JSON->new;
my $json_text = $json->pretty->canonical->utf8->encode($self->{hash});
@ -151,8 +153,9 @@ sub set {
return $result;
}
if (not defined $value) { $value = $self->{hash}->{$lc_index}->{$key}; }
else {
if (not defined $value) {
$value = $self->{hash}->{$lc_index}->{$key};
} else {
$self->{hash}->{$lc_index}->{$key} = $value;
$self->save unless $dont_save;
}