3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

AntiRepeat: strip nick-like prefixes

This commit is contained in:
Pragmatic Software 2019-06-24 12:59:09 -07:00
parent 87e0d33870
commit 3e2395370f

View File

@ -96,6 +96,7 @@ sub on_public {
foreach my $string1 (@$messages) {
next if $now - $string1->{timestamp} > 60 * 60 * 2;
next if $allow_bot and $string1->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/;
$string1->{msg} =~ s/^[^;,:]{1,20}//; # remove nick-like prefix if one exists
next if length $string1->{msg} <= 5; # allow really short messages since "yep" "ok" etc are so common
if (exists $self->{offenses}->{$account} and exists $self->{offenses}->{$account}->{$channel}) {
@ -105,6 +106,7 @@ sub on_public {
foreach my $string2 (@$messages) {
next if $now - $string2->{timestamp} > 60 * 60 * 2;
next if $allow_bot and $string2->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/;
$string2->{msg} =~ s/^[^;,:]{1,20}//; # remove nick-like prefix if one exists
next if length $string2->{msg} <= 5; # allow really short messages since "yep" "ok" etc are so common
if (exists $self->{offenses}->{$account} and exists $self->{offenses}->{$account}->{$channel}) {