3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01: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; $channel = lc $channel;
my @words = split /\s+/, $msg; my @words = split /\s+/, $msg;
my @nicks; my @nicks;
my $severity = 0; # increasing severity for each additional unique nick in a single message
foreach my $word (@words) { foreach my $word (@words) {
$word =~ s/[:;\+,\.!?\@\%\$]+$//g; $word =~ s/[:;\+,\.!?\@\%\$]+$//g;
if ($self->{pbot}->{nicklist}->is_present($channel, $word) and not grep { $_ eq $word } @nicks) { if ($self->{pbot}->{nicklist}->is_present($channel, $word) and not grep { $_ eq $word } @nicks) {
$severity++; push @{$self->{nicks}->{$channel}}, [scalar gettimeofday, $word];
for (my $i = 0; $i < $severity; $i++) {
push @{$self->{nicks}->{$channel}}, [scalar gettimeofday, $word];
}
push @nicks, $word; push @nicks, $word;
} }
} }