mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
Registry: add dont_save option to set()
This commit is contained in:
parent
8185c7399f
commit
532fc9c8fc
@ -35,8 +35,8 @@ sub new {
|
|||||||
sub initialize {
|
sub initialize {
|
||||||
my ($self, %conf) = @_;
|
my ($self, %conf) = @_;
|
||||||
|
|
||||||
$self->{pbot} = delete $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
$self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
||||||
my $filename = delete $conf{filename};
|
my $filename = $conf{filename} // Carp::croak("Missing filename reference in " . __FILE__);
|
||||||
|
|
||||||
$self->{registry} = PBot::DualIndexHashObject->new(name => 'Registry', filename => $filename, pbot => $self->{pbot});
|
$self->{registry} = PBot::DualIndexHashObject->new(name => 'Registry', filename => $filename, pbot => $self->{pbot});
|
||||||
$self->{triggers} = {};
|
$self->{triggers} = {};
|
||||||
@ -106,7 +106,7 @@ sub set_default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub set {
|
sub set {
|
||||||
my ($self, $section, $item, $key, $value, $is_default) = @_;
|
my ($self, $section, $item, $key, $value, $is_default, $dont_save) = @_;
|
||||||
|
|
||||||
$section = lc $section;
|
$section = lc $section;
|
||||||
$item = lc $item;
|
$item = lc $item;
|
||||||
@ -127,7 +127,7 @@ sub set {
|
|||||||
$self->process_trigger($section, $item, $value);
|
$self->process_trigger($section, $item, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->save if $result =~ m/set to/ && not $is_default;
|
$self->save if !$dont_save && $result =~ m/set to/ && not $is_default;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user