3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

AntiNickSpam: Remove severity due to "false-positive" common-word nicks

This commit is contained in:
Pragmatic Software 2018-01-17 17:20:34 -08:00
parent fc5f003465
commit b4df71cd71

View File

@ -65,15 +65,11 @@ sub check_flood {
$channel = lc $channel;
my @words = split /\s+/, $msg;
my @nicks;
my $severity = 0; # increasing severity for each additional unique nick in a single message
foreach my $word (@words) {
$word =~ s/[:;\+,\.!?\@\%\$]+$//g;
if ($self->{pbot}->{nicklist}->is_present($channel, $word) and not grep { $_ eq $word } @nicks) {
$severity++;
for (my $i = 0; $i < $severity; $i++) {
push @{$self->{nicks}->{$channel}}, [scalar gettimeofday, $word];
}
push @{$self->{nicks}->{$channel}}, [scalar gettimeofday, $word];
push @nicks, $word;
}
}