mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-27 13:12:42 +01:00
Fix minor bug creating empty factoid in factset without key argument
This commit is contained in:
parent
03389d4d08
commit
eb5d90ec48
@ -154,10 +154,10 @@ sub find_index {
|
||||
|
||||
return undef if not defined $primary_index_key;
|
||||
|
||||
return $primary_index_key if not $secondary_index_key;
|
||||
|
||||
return undef if not exists $self->hash->{$primary_index_key};
|
||||
|
||||
return $primary_index_key if not defined $secondary_index_key;
|
||||
|
||||
foreach my $index (keys %{ $self->hash->{$primary_index_key} }) {
|
||||
return $index if $secondary_index_key eq lc $index;
|
||||
}
|
||||
|
@ -161,6 +161,8 @@ sub factset {
|
||||
}
|
||||
}
|
||||
|
||||
my $oldvalue;
|
||||
|
||||
if(defined $owner_channel) {
|
||||
my $factoid = $self->{pbot}->{factoids}->{factoids}->hash->{$owner_channel}->{$owner_trigger};
|
||||
|
||||
@ -169,9 +171,9 @@ sub factset {
|
||||
if(lc $nick ne lc $owner and $level == 0) {
|
||||
return "You are not the owner of $trigger.";
|
||||
}
|
||||
}
|
||||
|
||||
my $oldvalue = $self->{pbot}->{factoids}->{factoids}->hash->{$channel}->{$trigger}->{$key};
|
||||
$oldvalue = $self->{pbot}->{factoids}->{factoids}->hash->{$channel}->{$trigger}->{$key};
|
||||
}
|
||||
|
||||
my $result = $self->{pbot}->{factoids}->{factoids}->set($channel, $trigger, $key, $value);
|
||||
|
||||
@ -226,6 +228,8 @@ sub factunset {
|
||||
}
|
||||
}
|
||||
|
||||
my $oldvalue;
|
||||
|
||||
if(defined $owner_channel) {
|
||||
my $factoid = $self->{pbot}->{factoids}->{factoids}->hash->{$owner_channel}->{$owner_trigger};
|
||||
|
||||
@ -234,9 +238,9 @@ sub factunset {
|
||||
if(lc $nick ne lc $owner and $level == 0) {
|
||||
return "You are not the owner of $trigger.";
|
||||
}
|
||||
$oldvalue = $self->{pbot}->{factoids}->{factoids}->hash->{$channel}->{$trigger}->{$key};
|
||||
}
|
||||
|
||||
my $oldvalue = $self->{pbot}->{factoids}->{factoids}->hash->{$channel}->{$trigger}->{$key};
|
||||
my $result = $self->{pbot}->{factoids}->{factoids}->unset($channel, $trigger, $key);
|
||||
|
||||
if ($result =~ m/unset/) {
|
||||
|
Loading…
Reference in New Issue
Block a user