From d12a46398747a1d0ac676665000ba07622937165 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 9 Jul 2022 19:09:27 -0700 Subject: [PATCH] Plugin/FuncBuiltins: do not ucfirst on nicks; add more POS to maybe-the --- lib/PBot/Plugin/FuncBuiltins.pm | 12 ++++++++++-- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/PBot/Plugin/FuncBuiltins.pm b/lib/PBot/Plugin/FuncBuiltins.pm index b3d2f925..5e836b58 100644 --- a/lib/PBot/Plugin/FuncBuiltins.pm +++ b/lib/PBot/Plugin/FuncBuiltins.pm @@ -117,6 +117,14 @@ sub func_title { sub func_ucfirst { my $self = shift; my $text = "@_"; + + my ($word) = $text =~ m/^\s*([^',.;: ]+)/; + + # don't ucfirst on nicks + if ($self->{pbot}->{nicklist}->is_present_any_channel($word)) { + return $text; + } + return ucfirst $text; } @@ -162,7 +170,7 @@ sub func_maybe_the { my $self = shift; my $text = "@_"; - my ($word) = $text =~ m/^\s*([^',.; ]+)/; + my ($word) = $text =~ m/^\s*([^',.;: ]+)/; # don't prepend "the" if a proper-noun nick follows if ($self->{pbot}->{nicklist}->is_present_any_channel($word)) { @@ -171,7 +179,7 @@ sub func_maybe_the { my $tagged = $self->{tagger}->add_tags($word); - if ($tagged !~ m/^\s*<(?:det|prps?|cd|in|nnp|to|rb|wdt|vbg)>/) { + if ($tagged !~ m/^\s*<(?:det|prps?|cd|in|nnp|to|rb|wdt|vbg|rbr|jjr)>/) { $text = "the $text"; } diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index d51d3fa9..131bca89 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 => 4555, - BUILD_DATE => "2022-07-08", + BUILD_REVISION => 4556, + BUILD_DATE => "2022-07-09", }; sub initialize {}