3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-05 19:49:32 +01:00

Plugin/AntiAway: improve logic of temp-ban warning

This commit is contained in:
Pragmatic Software 2024-07-22 13:56:44 -07:00
parent a0a61ff0d5
commit 4cf8583a1e
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 5 additions and 3 deletions

View File

@ -33,14 +33,16 @@ sub unload($self) {
sub punish($self, $msg, $channel, $nick, $user, $host) {
$self->{kick_counter}->{$channel}->{$nick}++;
if ($self->{kick_counter}->{$channel}->{$nick} >= 2) {
if ($self->{kick_counter}->{$channel}->{$nick} == 2) {
$msg .= ' (WARNING: next offense will result in a temp ban)';
} elsif ($self->{kick_counter}->{$channel}->{$nick} > 2) {
$msg .= ' (temp ban for repeated offenses)';
}
$self->{pbot}->{chanops}->add_op_command($channel, "kick $channel $nick $msg");
$self->{pbot}->{chanops}->gain_ops($channel);
if ($self->{kick_counter}->{$channel}->{$nick} >= 3) {
if ($self->{kick_counter}->{$channel}->{$nick} > 2) {
my $botnick = $self->{pbot}->{conn}->nick;
$self->{pbot}->{banlist}->ban_user_timed($channel, 'b', "*!*\@$host", 60 * 60 * 2, $botnick, 'anti-away');
}

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4771,
BUILD_REVISION => 4772,
BUILD_DATE => "2024-07-22",
};