3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 20:09:43 +01:00

Factoids: fix export errors upon exit by correcting atexit registration order

This commit is contained in:
Pragmatic Software 2020-05-29 20:43:07 -07:00
parent 75eac99ea1
commit b57fea8120

View File

@ -70,9 +70,11 @@ our %factoid_metadata = (
sub initialize {
my ($self, %conf) = @_;
my $filename = $conf{filename};
$self->{factoids} = PBot::DualIndexSQLiteObject->new(name => 'Factoids', filename => $filename, pbot => $self->{pbot});
$self->{pbot} = $self->{pbot};
$self->{pbot} = $self->{pbot};
$self->{pbot}->{atexit}->register(sub { $self->save_factoids; return; });
$self->{factoids} = PBot::DualIndexSQLiteObject->new(name => 'Factoids', filename => $filename, pbot => $self->{pbot});
$self->{commands} = PBot::FactoidCommands->new(pbot => $self->{pbot});
$self->{pbot}->{registry}->add_default('text', 'factoids', 'default_rate_limit', 15);
@ -80,7 +82,6 @@ sub initialize {
$self->{pbot}->{registry}->add_default('text', 'factoids', 'max_content_length', 1024 * 8);
$self->{pbot}->{registry}->add_default('text', 'factoids', 'max_channel_length', 20);
$self->{pbot}->{atexit}->register(sub { $self->save_factoids; return; });
$self->load_factoids;
}