mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-27 06:19:25 +01:00
Auto-kick people who change nicks to a nick matching $bad_away_nicks
This commit is contained in:
parent
c979efcfa6
commit
5a63fbd705
@ -73,6 +73,8 @@ sub initialize {
|
|||||||
|
|
||||||
$self->{pbot}->{registry}->add_default('text', 'antiflood', 'debug_checkban', $conf{debug_checkban} // 0);
|
$self->{pbot}->{registry}->add_default('text', 'antiflood', 'debug_checkban', $conf{debug_checkban} // 0);
|
||||||
|
|
||||||
|
$self->{pbot}->{registry}->add_default('text', 'antiflood', 'bad_away_nicks', $conf{bad_away_nicks} // '[[:punct:]](afk|away|sleep|z+|work|gone)[[:punct:]]*$');
|
||||||
|
|
||||||
$self->{pbot}->{commands}->register(sub { return $self->unbanme(@_) }, "unbanme", 0);
|
$self->{pbot}->{commands}->register(sub { return $self->unbanme(@_) }, "unbanme", 0);
|
||||||
$self->{pbot}->{commands}->register(sub { return $self->whitelist(@_) }, "whitelist", 10);
|
$self->{pbot}->{commands}->register(sub { return $self->whitelist(@_) }, "whitelist", 10);
|
||||||
}
|
}
|
||||||
@ -196,6 +198,18 @@ sub check_flood {
|
|||||||
|
|
||||||
$self->{nickflood}->{$account}->{changes}++;
|
$self->{nickflood}->{$account}->{changes}++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $bad_away_nicks = $self->{pbot}->{registry}->get_value('antiflood', 'bad_away_nicks');
|
||||||
|
if($newnick =~ m/$bad_away_nicks/i) {
|
||||||
|
$self->{pbot}->{logger}->log("$newnick matches bad away nick regex, kicking...\n");
|
||||||
|
my @channels = $self->{pbot}->{messagehistory}->{database}->get_channels($account);
|
||||||
|
foreach my $chan (@channels) {
|
||||||
|
if($chan =~ m/^#/) {
|
||||||
|
$self->{pbot}->{chanops}->add_op_command($chan, "kick $chan $newnick No away nicks: http://sackheads.org/~bnaylor/spew/away_msgs.html");
|
||||||
|
$self->{pbot}->{chanops}->gain_ops($chan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", lc $channel eq lc $mask ? "QUIT" : $channel, $mask, $text));
|
$self->{pbot}->{logger}->log(sprintf("%-18s | %-65s | %s\n", lc $channel eq lc $mask ? "QUIT" : $channel, $mask, $text));
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 796,
|
BUILD_REVISION => 797,
|
||||||
BUILD_DATE => "2014-10-28",
|
BUILD_DATE => "2014-10-28",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user