mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-27 13:12:42 +01:00
Channels: add get_meta() convenience subroutine
This commit is contained in:
parent
4e996717c8
commit
1f43e003d8
@ -107,25 +107,28 @@ sub list {
|
||||
|
||||
sub is_active {
|
||||
my ($self, $channel) = @_;
|
||||
|
||||
return exists $self->{channels}->hash->{$channel} && $self->{channels}->hash->{$channel}->{enabled};
|
||||
}
|
||||
|
||||
sub is_active_op {
|
||||
my ($self, $channel) = @_;
|
||||
|
||||
return $self->is_active($channel) && $self->{channels}->hash->{$channel}->{chanop};
|
||||
}
|
||||
|
||||
sub get_meta {
|
||||
my ($self, $channel, $key) = @_;
|
||||
my $index = $self->{channels}->find_hash($channel);
|
||||
return undef if not defined $index;
|
||||
return $self->{channels}->{hash}->{$index}->{$key};
|
||||
}
|
||||
|
||||
sub load_channels {
|
||||
my $self = shift;
|
||||
|
||||
$self->{channels}->load();
|
||||
}
|
||||
|
||||
sub save_channels {
|
||||
my $self = shift;
|
||||
|
||||
$self->{channels}->save();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user