From dfd56aed57eff2c7041e6a46b84340df69c47bad Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 28 Jun 2024 18:51:37 -0700 Subject: [PATCH] Plugin/AntiRepeat: increase min length to allow "thanks"/"thank you" --- lib/PBot/Plugin/AntiRepeat.pm | 6 +++--- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PBot/Plugin/AntiRepeat.pm b/lib/PBot/Plugin/AntiRepeat.pm index 314ae6c2..cc0d9e07 100644 --- a/lib/PBot/Plugin/AntiRepeat.pm +++ b/lib/PBot/Plugin/AntiRepeat.pm @@ -16,7 +16,7 @@ use POSIX qw/strftime/; sub initialize($self, %conf) { $self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat', $conf{antirepeat} // 1); - $self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat_threshold', $conf{antirepeat_threshold} // 2.5); + $self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat_threshold', $conf{antirepeat_threshold} // 3); $self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat_match', $conf{antirepeat_match} // 0.5); $self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat_allow_bot', $conf{antirepeat_allow_bot} // 1); @@ -83,7 +83,7 @@ sub on_public($self, $event_type, $event) { 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 + next if length $string1->{msg} <= 10; # allow really short messages since "yep" "ok" "thanks" etc are so common if (exists $self->{offenses}->{$account} and exists $self->{offenses}->{$account}->{$channel}) { next if $self->{offenses}->{$account}->{$channel}->{last_offense} >= $string1->{timestamp}; @@ -93,7 +93,7 @@ sub on_public($self, $event_type, $event) { 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 + next if length $string2->{msg} <= 10; # allow really short messages since "yep" "ok" "thanks" etc are so common if (exists $self->{offenses}->{$account} and exists $self->{offenses}->{$account}->{$channel}) { next if $self->{offenses}->{$account}->{$channel}->{last_offense} >= $string2->{timestamp}; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 1d0d26f1..79ff4d73 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4762, - BUILD_DATE => "2024-06-22", + BUILD_REVISION => 4764, + BUILD_DATE => "2024-06-28", }; sub initialize {}