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:
parent
a0a61ff0d5
commit
4cf8583a1e
@ -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');
|
||||
}
|
||||
|
@ -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",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user