| 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
| |||||||||||
| 30 | 1 | $bot; | |||||||||