Skip to content

Commit da06042

Browse files
authored
Merge pull request #217 from hadfl/help
fenix: replace default handler with something more useful
2 parents addfcc7 + eccd082 commit da06042

File tree

2 files changed

+14
-56
lines changed

2 files changed

+14
-56
lines changed

lib/Fenix/Model/Handler/Help.pm

+14-6
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@ use Mojo::Base 'Fenix::Model::Handler::base', -signatures;
33

44
use Mojo::Promise;
55

6-
has priority => 100;
6+
# default handler, lowest priority.
7+
# if we get mentioned but don't know what to do we
8+
# DM the user information about our capabilities
9+
has priority => 9999;
710
has generic => 0;
811
has dm => 1;
912

1013
sub process_p($self, $chan, $from, $msg, $mentioned = 0) {
11-
return undef if !$mentioned || $msg !~ /\bhelp\b/i;
14+
return undef if !$mentioned || $self->utils->muted(\$self->mutemap->{help}, $from);
15+
16+
my $preface = $msg =~ /\bhelp\b/i
17+
? "Hi $from, I am glad you asked!\n"
18+
. 'To get my attention, just mention my name in a message to the channel.'
19+
: "Hi $from, it seems that you tried to get my attention.\n"
20+
. 'However, I am afraid I did not understand your request.';
1221

1322
return Mojo::Promise->resolve([ split /\n/, <<"END" ]);
14-
Hi $from, I am glad you asked!
15-
To get my attention, just mention my name in a message to the channel.
23+
$preface
1624
I can look up Redmine issues with 'illumos <issue>', 'issue <issue>' or '#<issue>'
17-
For Joyent/SmartOS issues, use the issue type and number together, e.g. OS-1234.
25+
For SmartOS issues, use the issue type and number together, e.g. OS-1234.
1826
I can also find IPDs - 'IPD123', 'IPD-123' or 'IPD 123'
1927
as well as OpenSolaris issues with a seven digit bug ID. If you want me to, I can also
2028
dig very deeply and find stuff in the OpenSolaris ARC Material Archive, just use e.g. FWARC/2004/510.
@@ -29,7 +37,7 @@ __END__
2937
3038
=head1 COPYRIGHT
3139
32-
Copyright 2023 OmniOS Community Edition (OmniOSce) Association.
40+
Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
3341
3442
=head1 LICENSE
3543

lib/Fenix/Model/Handler/Hi.pm

-50
This file was deleted.

0 commit comments

Comments
 (0)