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:
parent
cbf7c933b0
commit
2424bb9fec
@ -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*([^',.;: ]+)/;
|
||||
|
||||
@ -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",
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user