3
0
mirror of https://github.com/pragma-/pbot.git synced 2026-02-21 00:38:00 +01:00

Plugin/FuncBuiltins: add maybe-ucfirst

This commit is contained in:
Pragmatic Software 2026-02-19 22:12:20 -08:00
parent cbf7c933b0
commit 2424bb9fec
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 14 additions and 1 deletions

View File

@ -34,6 +34,14 @@ sub initialize($self, %conf) {
subref => sub { $self->func_ucfirst(@_) }
}
);
$self->{pbot}->{functions}->register(
'maybe-ucfirst',
{
desc => 'Uppercases first character unless nick',
usage => 'maybe-ucfirst <text>',
subref => sub { $self->func_maybe_ucfirst(@_) }
}
);
$self->{pbot}->{functions}->register(
'uc',
{
@ -144,6 +152,7 @@ sub initialize($self, %conf) {
sub unload($self) {
$self->{pbot}->{functions}->unregister('title');
$self->{pbot}->{functions}->unregister('maybe-ucfirst');
$self->{pbot}->{functions}->unregister('ucfirst');
$self->{pbot}->{functions}->unregister('uc');
$self->{pbot}->{functions}->unregister('lc');
@ -182,6 +191,10 @@ sub func_title($self, @rest) {
}
sub func_ucfirst($self, @rest) {
return ucfirst "@rest";
}
sub func_maybe_ucfirst($self, @rest) {
my $text = "@rest";
my ($word) = $text =~ m/^\s*([^',.;: ]+)/;

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4936,
BUILD_REVISION => 4937,
BUILD_DATE => "2026-02-19",
};