examples/ping.pl

filter: Statementstmt 95.0% 38 / 40 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.3% 12 / 13 Podpod n/a totaltotal 92.7% 51 / 55 CC 1 SCAR 0.7
CC
1
Cov
93%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/Discord/Client/Model/User.pm ↑ Summary blib/lib/Discord/Client/Error.pm »
1 #!/usr/bin/env perl
2 1 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use lib "$FindBin::Bin/../lib";
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Discord::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # Configure the bot; slash commands do not need Message Content.
10 my $bot = Discord::Client->new(
11 token => $ENV{DISCORD_BOT_TOKEN},
12 1 intents => ['GUILDS'],
13 );
14  
15 # Reply to the ping command.
16 $bot->command(
17 ping => (
18 description => 'Replies with Pong',
19 0 ▶ handler => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 0 my ($interaction) = @_;
21  
22 # Return asynchronous work to the dispatcher for error handling and shutdown.
23 0 return $interaction->reply('Pong!');
24 },
25 1 ),
26 );
27  
28 # Run directly, or return the client when loaded for explicit command deployment.
29 1 ▶$bot->run unless caller;
Branch: 1 branch
BranchTrueFalseTotal
unless caller 0 1 1
30 1 $bot;
« blib/lib/Discord/Client/Model/User.pm ↑ Summary blib/lib/Discord/Client/Error.pm »