mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
Do not attempt to enforce antiaway/rejoin if not chanop
This commit is contained in:
parent
fea56842d3
commit
0d4c5c301f
@ -37,10 +37,11 @@ sub on_nickchange {
|
||||
|
||||
my $bad_nicks = $self->{pbot}->{registry}->get_value('antiaway', 'bad_nicks');
|
||||
if($newnick =~ m/$bad_nicks/i) {
|
||||
$self->{pbot}->{logger}->log("$newnick matches bad away nick regex, kicking...\n");
|
||||
my $kick_msg = $self->{pbot}->{registry}->get_value('antiaway', 'kick_msg');
|
||||
my $channels = $self->{pbot}->{nicklist}->get_channels($newnick);
|
||||
foreach my $chan (@$channels) {
|
||||
next if not exists $self->{pbot}->{channels}->{channels}->hash->{$chan} or not $self->{pbot}->{channels}->{channels}->hash->{$chan}{chanop};
|
||||
$self->{pbot}->{logger}->log("$newnick matches bad away nick regex, kicking from $chan\n");
|
||||
$self->{pbot}->{chanops}->add_op_command($chan, "kick $chan $newnick $kick_msg");
|
||||
$self->{pbot}->{chanops}->gain_ops($chan);
|
||||
}
|
||||
@ -54,6 +55,7 @@ sub on_action {
|
||||
my ($nick, $user, $host, $msg, $channel) = ($event->{event}->nick, $event->{event}->user, $event->{event}->host, $event->{event}->{args}[0], $event->{event}->{to}[0]);
|
||||
|
||||
return 0 if $channel !~ /^#/;
|
||||
return 0 if not exists $self->{pbot}->{channels}->{channels}->hash->{$channel} or not $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop};
|
||||
|
||||
my $bad_actions = $self->{pbot}->{registry}->get_value('antiaway', 'bad_actions');
|
||||
if($msg =~ m/$bad_actions/i) {
|
||||
|
@ -38,6 +38,8 @@ sub on_kick {
|
||||
my ($self, $event_type, $event) = @_;
|
||||
my ($nick, $user, $host, $target, $channel, $reason) = ($event->{event}->nick, $event->{event}->user, $event->{event}->host, $event->{event}->to, $event->{event}->{args}[0], $event->{event}->{args}[1]);
|
||||
|
||||
return 0 if not exists $self->{pbot}->{channels}->{channels}->hash->{$channel} or not $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop};
|
||||
|
||||
if (not exists $self->{kicks}->{$channel}
|
||||
or not exists $self->{kicks}->{$channel}->{$target}) {
|
||||
$self->{kicks}->{$channel}->{$target}->{rejoins} = 0;
|
||||
@ -52,6 +54,8 @@ sub on_join {
|
||||
my ($self, $event_type, $event) = @_;
|
||||
my ($nick, $user, $host, $channel) = ($event->{event}->nick, $event->{event}->user, $event->{event}->host, $event->{event}->to);
|
||||
|
||||
return 0 if not exists $self->{pbot}->{channels}->{channels}->hash->{$channel} or not $self->{pbot}->{channels}->{channels}->hash->{$channel}{chanop};
|
||||
|
||||
if (exists $self->{kicks}->{$channel}
|
||||
and exists $self->{kicks}->{$channel}->{$nick}) {
|
||||
my $now = gettimeofday;
|
||||
|
Loading…
Reference in New Issue
Block a user