Plugin/AntiRepeat: increase min length to allow "thanks"/"thank you"

This commit is contained in:
Pragmatic Software 2024-06-28 18:51:37 -07:00
parent abbe785911
commit dfd56aed57
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@ use POSIX qw/strftime/;
sub initialize($self, %conf) { sub initialize($self, %conf) {
$self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat', $conf{antirepeat} // 1); $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_match', $conf{antirepeat_match} // 0.5);
$self->{pbot}->{registry}->add_default('text', 'antiflood', 'antirepeat_allow_bot', $conf{antirepeat_allow_bot} // 1); $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 $now - $string1->{timestamp} > 60 * 60 * 2;
next if $allow_bot and $string1->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/; next if $allow_bot and $string1->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/;
$string1->{msg} =~ s/^[^;,:]{1,20}[;,:]//; # remove nick-like prefix if one exists $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}) { if (exists $self->{offenses}->{$account} and exists $self->{offenses}->{$account}->{$channel}) {
next if $self->{offenses}->{$account}->{$channel}->{last_offense} >= $string1->{timestamp}; 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 $now - $string2->{timestamp} > 60 * 60 * 2;
next if $allow_bot and $string2->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/; next if $allow_bot and $string2->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/;
$string2->{msg} =~ s/^[^;,:]{1,20}[;,:]//; # remove nick-like prefix if one exists $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}) { if (exists $self->{offenses}->{$account} and exists $self->{offenses}->{$account}->{$channel}) {
next if $self->{offenses}->{$account}->{$channel}->{last_offense} >= $string2->{timestamp}; next if $self->{offenses}->{$account}->{$channel}->{last_offense} >= $string2->{timestamp};

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4762, BUILD_REVISION => 4764,
BUILD_DATE => "2024-06-22", BUILD_DATE => "2024-06-28",
}; };
sub initialize {} sub initialize {}