mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 11:12:42 +01:00
Channels: add autojoin function
This commit is contained in:
parent
274ee8dcd6
commit
3b93dbe4c3
@ -107,6 +107,20 @@ sub list {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub autojoin {
|
||||
my ($self) = @_;
|
||||
return if $self->{pbot}->{joined_channels};
|
||||
my $chans;
|
||||
foreach my $chan (keys %{ $self->{pbot}->{channels}->{channels}->hash }) {
|
||||
if ($self->{pbot}->{channels}->{channels}->hash->{$chan}{enabled}) {
|
||||
$chans .= "$chan,";
|
||||
}
|
||||
}
|
||||
$self->{pbot}->{logger}->log("Joining channels: $chans\n");
|
||||
$self->{pbot}->{chanops}->join_channel($chans);
|
||||
$self->{pbot}->{joined_channels} = 1;
|
||||
}
|
||||
|
||||
sub is_active {
|
||||
my ($self, $channel) = @_;
|
||||
return exists $self->{channels}->hash->{$channel} && $self->{channels}->hash->{$channel}->{enabled};
|
||||
|
Loading…
Reference in New Issue
Block a user