blib/lib/Discord/Client/Interaction.pm

filter: Statementstmt 90.4% 264 / 292 Branchbran 64.4% 125 / 194 Conditioncond 39.8% 102 / 256 MC/DCmcdc 5.8% 7 / 120 Subroutinesub 82.8% 53 / 64 Podpod 100% 32 / 32 totaltotal 60.8% 583 / 958 CC 193 SCAR 33.2
CC
193
Cov
66%
new
88.5
autocomplete
58.3
_parse_options
57.6
CRAP 27.7
« blib/lib/Discord/Client/Commands.pm ↑ Summary blib/lib/Discord/Client/REST.pm »
1 package Discord::Client::Interaction;
2  
3 10 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use IO::Async::Loop;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use JSON::PP ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use Scalar::Util qw(blessed refaddr weaken looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use URI::Escape qw(uri_escape_utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶use Discord::Client::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 10 ▶use Discord::Client::REST;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 10 our $VERSION = '0.004';
16  
17 1091 ▶sub new {
Subroutine new: called CC=28 SCAR=44.8
Pod documented
18 1091 my ( $class, %args ) = @_;
19  
20 # Validate injected hooks and receipt time before creating timers.
21 1091 for my $key (qw(clock delay initial_sender)) {
22 3273 ▶ croak "$key must be a code reference" if exists( $args{$key} ) && ref( $args{$key} ) ne 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{$key} and ref $args{$key} ne "CODE" 0 3273 3273
Condition66%2/3
exists $args{$key} and ref $args{$key} ne "CODE"
!ll&&!rl&&r
4032330
MC/DC0%0/2
exists $args{$key} and ref $args{$key} ne "CODE"
exists $args{$key} ref $args{$key} ne "CODE"
Truth table66%2/3
A and B
A= exists $args{$key}B= ref $args{$key} ne "CODE"
ABresult
0X0
100
111
23 }
24 croak 'received_at must be a finite number'
25 if exists( $args{received_at} )
26 && ( !defined( $args{received_at} )
27 || ref( $args{received_at} )
28 || !looks_like_number( $args{received_at} )
29 1091 ▶ || $args{received_at} =~ /(?:inf|nan)/i );
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"received_at"} and !defined($args{"received_at"}) || ref $args{"received_at"} || !&looks_like_number($args{"received_at"}) || $args{"received_at"} =~ /(?:inf|nan)/iu 0 1091 1091
Condition41%5/12
exists $args{"received_at"} and !defined($args{"received_at"}) || ref $args{"received_at"} || !&looks_like_number($args{"received_at"}) || $args{"received_at"} =~ /(?:inf|nan)/iu
!ll&&!rl&&r
1710740
not defined $args{"received_at"} or ref $args{"received_at"} or not &looks_like_number($args{"received_at"}) or $args{"received_at"} =~ /(?:inf|nan)/iu
l!l&&r!l&&!r
001074
not defined $args{"received_at"} or ref $args{"received_at"} or not &looks_like_number($args{"received_at"})
l!l&&r!l&&!r
001074
not defined $args{"received_at"} or ref $args{"received_at"}
l!l&&r!l&&!r
001074
MC/DC0%0/5
exists $args{"received_at"} and !defined($args{"received_at"}) || ref $args{"received_at"} || !&looks_like_number($args{"received_at"}) || $args{"received_at"} =~ /(?:inf|nan)/iu
exists $args{"received_at"} not defined $args{"received_at"} ref $args{"received_at"} not &looks_like_number($args{"received_at"}) $args{"received_at"} =~ /(?:inf|nan)/iu
Truth table33%2/6
A and not(B) or C or not(D) or E
A= exists $args{"received_at"}B= not defined $args{"received_at"}C= ref $args{"received_at"}D= not &looks_like_number($args{"received_at"})E= $args{"received_at"} =~ /(?:inf|nan)/iu
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
30  
31 # Require the routing and token fields shared by supported interaction types.
32 1091 my $payload = $args{payload};
33 croak 'Invalid interaction payload'
34 unless ref($payload) eq 'HASH'
35 && _id( $payload->{id} )
36 && _id( $payload->{application_id} )
37 && defined( $payload->{token} )
38 && !ref( $payload->{token} )
39 && length( $payload->{token} )
40 && defined( $payload->{type} )
41 && !ref( $payload->{type} )
42 && $payload->{type} =~ /\A[2-5]\z/
43 1091 ▶ && ref( $payload->{data} ) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"} and defined $payload->{"type"} and not ref $payload->{"type"} and $payload->{"type"} =~ /\A[2-5]\z/u and ref $payload->{"data"} eq "HASH" 0 1091 1091
Condition33%9/27
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"} and defined $payload->{"type"} and not ref $payload->{"type"} and $payload->{"type"} =~ /\A[2-5]\z/u and ref $payload->{"data"} eq "HASH"
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"} and defined $payload->{"type"} and not ref $payload->{"type"} and $payload->{"type"} =~ /\A[2-5]\z/u
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"} and defined $payload->{"type"} and not ref $payload->{"type"}
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"} and defined $payload->{"type"}
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"}
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"}
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"}
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"})
!ll&&!rl&&r
001091
ref $payload eq "HASH" and _id($payload->{"id"})
!ll&&!rl&&r
001091
MC/DC0%0/10
ref $payload eq "HASH" and _id($payload->{"id"}) and _id($payload->{"application_id"}) and defined $payload->{"token"} and not ref $payload->{"token"} and length $payload->{"token"} and defined $payload->{"type"} and not ref $payload->{"type"} and $payload->{"type"} =~ /\A[2-5]\z/u and ref $payload->{"data"} eq "HASH"
ref $payload eq "HASH" _id($payload->{"id"}) _id($payload->{"application_id"}) defined $payload->{"token"} not ref $payload->{"token"} length $payload->{"token"} defined $payload->{"type"} not ref $payload->{"type"} $payload->{"type"} =~ /\A[2-5]\z/u ref $payload->{"data"} eq "HASH"
Truth table9%1/11
A and B and C and D and not(E) and F and G and not(H) and I and J
A= ref $payload eq "HASH"B= _id($payload->{"id"})C= _id($payload->{"application_id"})D= defined $payload->{"token"}E= not ref $payload->{"token"}F= length $payload->{"token"}G= defined $payload->{"type"}H= not ref $payload->{"type"}I= $payload->{"type"} =~ /\A[2-5]\z/uJ= ref $payload->{"data"} eq "HASH"
ABCDEFGHIJresult
0XXXXXXXXX0
10XXXXXXXX0
110XXXXXXX0
1110XXXXXX0
11110XXXXX0
111110XXXX0
1111110XXX0
11111110XX0
111111110X0
11111111100
11111111111
44  
45 # Derive both response deadlines from receipt time, including time spent in queues.
46 1091 ▶ my $loop = $args{loop} // IO::Async::Loop->new;
Condition66%2/3
$args{"loop"} // "IO::Async::Loop"->new
l!l&&r!l&&!r
108920
MC/DC0%0/2
$args{"loop"} // "IO::Async::Loop"->new
$args{"loop"} "IO::Async::Loop"->new
Truth table66%2/3
A // B
A= $args{"loop"}B= "IO::Async::Loop"->new
ABresult
1X1
011
000
47 0 ▶ my $clock = $args{clock} // sub { clock_gettime(CLOCK_MONOTONIC) };
Subroutine __ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$args{"clock"} // sub { &clock_gettime(scalar CLOCK_MONOTONIC()); }
l!l&&r!l&&!r
109100
MC/DC0%0/2
$args{"clock"} // sub { &clock_gettime(scalar CLOCK_MONOTONIC()); }
$args{"clock"} sub { &clock_gettime(scalar CLOCK_MONOTONIC()); }
Truth table33%1/3
A // B
A= $args{"clock"}B= sub { &clock_gettime(scalar CLOCK_MONOTONIC()); }
ABresult
1X1
011
000
48 1091 ▶ my $received = $args{received_at} // $clock->();
Condition66%2/3
$args{"received_at"} // &$clock()
l!l&&r!l&&!r
1074170
MC/DC0%0/2
$args{"received_at"} // &$clock()
$args{"received_at"} &$clock()
Truth table66%2/3
A // B
A= $args{"received_at"}B= &$clock()
ABresult
1X1
011
000
49 my $self = bless {
50 raw => $payload,
51 id => "$payload->{id}",
52 application_id => "$payload->{application_id}",
53 token => $payload->{token},
54 type => 0 + $payload->{type},
55 loop => $loop,
56 clock => $clock,
57 3 ▶ delay => $args{delay} // sub { $loop->delay_future( after => $_[0] ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
58 rest => $args{rest},
59 initial_sender => $args{initial_sender},
60 1091 ▶ deadline => $received + 3,
Condition66%2/3
$args{"delay"} // sub { $loop->delay_future("after", $_[0]); }
l!l&&r!l&&!r
108830
MC/DC0%0/2
$args{"delay"} // sub { $loop->delay_future("after", $_[0]); }
$args{"delay"} sub { $loop->delay_future("after", $_[0]); }
Truth table66%2/3
A // B
A= $args{"delay"}B= sub { $loop->delay_future("after", $_[0]); }
ABresult
1X1
011
000
61 expires_at => $received + 900,
62 state => 'new',
63 operations => {},
64 options => {},
65 path => [],
66 acknowledgement => $loop->new_future,
67 }, $class;
68  
69 # Parse command values before arming a deadline that could invoke callbacks.
70 1091 ▶ $self->_parse_options( $payload->{data}{options} // [], 0 );
Condition100%2/2
$payload->{"data"}{"options"} // []
l!l
61085
MC/DC100%1/1
$payload->{"data"}{"options"} // []
$payload->{"data"}{"options"}
Truth table100%2/2
A
A= $payload->{"data"}{"options"}
Aresult
11
00
71 croak 'Autocomplete requires a focused value'
72 if $self->{type} == 4
73 1091 ▶ && ( !$self->{focused} || $self->{focused}{type} !~ /\A(?:3|4|10)\z/ );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} == 4 and not $self->{"focused"} && $self->{"focused"}{"type"} =~ /\A(?:3|4|10)\z/u 0 1091 1091
Condition50%3/6
$self->{"type"} == 4 and not $self->{"focused"} && $self->{"focused"}{"type"} =~ /\A(?:3|4|10)\z/u
!ll&&!rl&&r
108830
$self->{'focused'} && $self->{'focused'}{'type'} =~ /\A(?:3|4|10)\z/u
!ll&&!rl&&r
003
MC/DC0%0/3
$self->{"type"} == 4 and not $self->{"focused"} && $self->{"focused"}{"type"} =~ /\A(?:3|4|10)\z/u
$self->{"type"} == 4 $self->{'focused'} $self->{'focused'}{'type'} =~ /\A(?:3|4|10)\z/u
Truth table50%2/4
A and not(B && C)
A= $self->{"type"} == 4B= $self->{'focused'}C= $self->{'focused'}{'type'} =~ /\A(?:3|4|10)\z/u
ABCresult
0XX0
1110
10X1
1101
74  
75 # A pending acknowledgement owns the deadline, without making the timer own the context.
76 1091 my $weak = $self;
77 1091 weaken($weak);
78 0 ▶ $self->{acknowledgement}->on_cancel( sub { $weak->close if $weak } );
Subroutine __ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
if $weak 0 0 0
79 1091 my $after = $self->{deadline} - $clock->();
80 1091 ▶ if ( $after <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($after <= 0) { } 3 1088 1091
81 3 $self->_expire_initial;
82 }
83 else {
84 1088 $self->{initial_timer} = $self->{delay}->($after);
85 1088 ▶ $self->{initial_timer}->on_done( sub { $weak->_expire_initial if $weak } );
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
if $weak 4 0 4
86 }
87 1091 return $self;
88 }
89  
90 2182 ▶sub _id { defined( $_[0] ) && !ref( $_[0] ) && $_[0] =~ /\A\d+\z/ }
Subroutine _id: called CC=3 SCAR=14.2
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] and not ref $_[0] and $_[0] =~ /\A\d+\z/u 2182 0 2182
Condition33%1/3
defined $_[0] and not ref $_[0]
!ll&&!rl&&r
002182
MC/DC0%0/2
defined $_[0] and not ref $_[0]
defined $_[0] not ref $_[0]
Truth table33%1/3
A and not(B)
A= defined $_[0]B= not ref $_[0]
ABresult
0X0
100
111
91  
92 # Payload accessors preserve unknown fields and do not fetch related resources.
93 2155 ▶sub id { $_[0]->{id} }
Subroutine id: called CC=1 SCAR=0.0
Pod documented
94 0 ▶sub application_id { $_[0]->{application_id} }
Subroutine application_id: not called CC=1 SCAR=6.9
Pod documented
95 5376 ▶sub type { $_[0]->{type} }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
96 1074 ▶sub raw { $_[0]->{raw} }
Subroutine raw: called CC=1 SCAR=0.0
Pod documented
97 3 ▶sub state { $_[0]->{state} }
Subroutine state: called CC=1 SCAR=0.0
Pod documented
98 5467 ▶sub acknowledgement { $_[0]->{acknowledgement} }
Subroutine acknowledgement: called CC=1 SCAR=0.0
Pod documented
99 3 ▶sub responded { $_[0]->{state} ne 'new' && $_[0]->{state} ne 'expired' }
Subroutine responded: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"state"} ne "new" and $_[0]{"state"} ne "expired" 1 2 3
100 1071 ▶sub options { +{ %{ $_[0]->{options} } } }
Subroutine options: called CC=1 SCAR=0.0
Pod documented
101 4 ▶sub option { $_[0]->{options}{ $_[1] } }
Subroutine option: called CC=1 SCAR=0.0
Pod documented
102 1074 ▶sub command_path { [ @{ $_[0]->{path} } ] }
Subroutine command_path: called CC=1 SCAR=0.0
Pod documented
103 3 ▶sub focused { $_[0]->{focused} }
Subroutine focused: called CC=1 SCAR=0.0
Pod documented
104 4 ▶sub custom_id { $_[0]->{raw}{data}{custom_id} }
Subroutine custom_id: called CC=1 SCAR=0.0
Pod documented
105 1 ▶sub values { $_[0]->{raw}{data}{values} // [] }
Subroutine values: called CC=2 SCAR=7.6
Pod documented
Condition50%1/2
$_[0]{"raw"}{"data"}{"values"} // []
l!l
10
MC/DC0%0/1
$_[0]{"raw"}{"data"}{"values"} // []
$_[0]{"raw"}{"data"}{"values"}
Truth table50%1/2
A
A= $_[0]{"raw"}{"data"}{"values"}
Aresult
11
00
106  
107 6 ▶sub field {
Subroutine field: called CC=19 SCAR=32.2
Pod documented
108 6 my ( $self, $custom_id ) = @_;
109 6 ▶ croak 'Field ID must be a non-empty string'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $custom_id and not ref $custom_id and length $custom_id 0 6 6
Condition33%2/6
defined $custom_id and not ref $custom_id and length $custom_id
!ll&&!rl&&r
006
defined $custom_id and not ref $custom_id
!ll&&!rl&&r
006
MC/DC0%0/3
defined $custom_id and not ref $custom_id and length $custom_id
defined $custom_id not ref $custom_id length $custom_id
Truth table25%1/4
A and not(B) and C
A= defined $custom_idB= not ref $custom_idC= length $custom_id
ABCresult
0XX0
10X0
1100
1111
110 unless defined($custom_id) && !ref($custom_id) && length($custom_id);
111 6 ▶ return undef unless $self->{type} == 5;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"type"} == 5 1 5 6
112  
113 # Labels use a single child; older Action Rows contain an array of children.
114 5 ▶ for my $container ( @{ $self->{raw}{data}{components} // [] } ) {
Condition50%1/2
$self->{"raw"}{"data"}{"components"} // []
l!l
50
MC/DC0%0/1
$self->{"raw"}{"data"}{"components"} // []
$self->{"raw"}{"data"}{"components"}
Truth table50%1/2
A
A= $self->{"raw"}{"data"}{"components"}
Aresult
11
00
115 12 ▶ next unless ref($container) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $container eq "HASH" 0 12 12
116 12 my @children;
117 12 ▶ if ( ( $container->{type} // 0 ) == 18 ) {
Branch: 2 branches
BranchTrueFalseTotal
if (($container->{'type'} // 0) == 18) { } 7 5 12
elsif (($container->{'type'} // 0) == 1 and ref $container->{'components'} eq 'ARRAY') { } 3 4 7
Condition50%1/2
$container->{"type"} // 0
l!l
120
MC/DC0%0/1
$container->{"type"} // 0
$container->{"type"}
Truth table50%1/2
A
A= $container->{"type"}
Aresult
11
00
118 7 @children = ( $container->{component} );
119 }
120 ▶ elsif ( ( $container->{type} // 0 ) == 1 && ref( $container->{components} ) eq 'ARRAY' ) {
Condition60%3/5
($container->{"type"} // 0) == 1 and ref $container->{"components"} eq "ARRAY"
!ll&&!rl&&r
203
$container->{"type"} // 0
l!l
50
MC/DC0%0/2
($container->{"type"} // 0) == 1 and ref $container->{"components"} eq "ARRAY"
$container->{"type"} ref $container->{"components"} eq "ARRAY"
Truth table33%1/3
A and B
A= $container->{"type"}B= ref $container->{"components"} eq "ARRAY"
ABresult
0X0
100
111
121 3 @children = @{ $container->{components} };
122 }
123 12 for my $input (@children) {
124 10 ▶ next unless ref($input) eq 'HASH' && ( $input->{type} // 0 ) == 4;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $input eq "HASH" and ($input->{"type"} // 0) == 4 2 8 10
Condition60%3/5
ref $input eq "HASH" and ($input->{"type"} // 0) == 4
!ll&&!rl&&r
028
$input->{"type"} // 0
l!l
100
MC/DC0%0/2
ref $input eq "HASH" and ($input->{"type"} // 0) == 4
ref $input eq "HASH" $input->{"type"}
Truth table33%1/3
A and B
A= ref $input eq "HASH"B= $input->{"type"}
ABresult
0X0
100
111
125 8 ▶ return $input->{value} if ( $input->{custom_id} // '' ) eq $custom_id;
Branch: 1 branch
BranchTrueFalseTotal
if ($input->{"custom_id"} // "") eq $custom_id 3 5 8
Condition50%1/2
$input->{"custom_id"} // ""
l!l
80
MC/DC0%0/1
$input->{"custom_id"} // ""
$input->{"custom_id"}
Truth table50%1/2
A
A= $input->{"custom_id"}
Aresult
11
00
126 }
127 }
128 2 return undef;
129 }
130  
131 2 ▶sub guild_id { $_[0]->{raw}{guild_id} }
Subroutine guild_id: called CC=1 SCAR=0.0
Pod documented
132  
133 0 ▶sub channel_id {
Subroutine channel_id: not called CC=3 SCAR=24.8
Pod documented
134 0 my ($self) = @_;
135 0 ▶ return $self->{raw}{channel_id} // ( ref( $self->{raw}{channel} ) eq 'HASH' ? $self->{raw}{channel}{id} : undef );
Branch: 1 branch
BranchTrueFalseTotal
ref $self->{'raw'}{'channel'} eq 'HASH' ? : 0 0 0
Condition0%0/3
$self->{"raw"}{"channel_id"} // (ref $self->{"raw"}{"channel"} eq "HASH" ? $self->{"raw"}{"channel"}{"id"} : undef)
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"raw"}{"channel_id"} // (ref $self->{"raw"}{"channel"} eq "HASH" ? $self->{"raw"}{"channel"}{"id"} : undef)
$self->{"raw"}{"channel_id"} (ref $self->{"raw"}{"channel"} eq "HASH" ? $self->{"raw"}{"channel"}{"id"} : undef)
Truth table0%0/3
A // B
A= $self->{"raw"}{"channel_id"}B= (ref $self->{"raw"}{"channel"} eq "HASH" ? $self->{"raw"}{"channel"}{"id"} : undef)
ABresult
1X1
011
000
136 }
137  
138 0 ▶sub user {
Subroutine user: not called CC=3 SCAR=24.8
Pod documented
139 0 my ($self) = @_;
140 0 ▶ return $self->{raw}{user} // ( ref( $self->{raw}{member} ) eq 'HASH' ? $self->{raw}{member}{user} : undef );
Branch: 1 branch
BranchTrueFalseTotal
ref $self->{'raw'}{'member'} eq 'HASH' ? : 0 0 0
Condition0%0/3
$self->{"raw"}{"user"} // (ref $self->{"raw"}{"member"} eq "HASH" ? $self->{"raw"}{"member"}{"user"} : undef)
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"raw"}{"user"} // (ref $self->{"raw"}{"member"} eq "HASH" ? $self->{"raw"}{"member"}{"user"} : undef)
$self->{"raw"}{"user"} (ref $self->{"raw"}{"member"} eq "HASH" ? $self->{"raw"}{"member"}{"user"} : undef)
Truth table0%0/3
A // B
A= $self->{"raw"}{"user"}B= (ref $self->{"raw"}{"member"} eq "HASH" ? $self->{"raw"}{"member"}{"user"} : undef)
ABresult
1X1
011
000
141 }
142 0 ▶sub member { $_[0]->{raw}{member} }
Subroutine member: not called CC=1 SCAR=6.9
Pod documented
143  
144 1 ▶sub resolved {
Subroutine resolved: called CC=5 SCAR=17.5
Pod documented
145 1 my ( $self, $kind, $id ) = @_;
146  
147 # Support the full resolved payload, one resource collection, or one resource ID.
148 1 ▶ my $resolved = $self->{raw}{data}{resolved} // {};
Condition50%1/2
$self->{"raw"}{"data"}{"resolved"} // {}
l!l
10
MC/DC0%0/1
$self->{"raw"}{"data"}{"resolved"} // {}
$self->{"raw"}{"data"}{"resolved"}
Truth table50%1/2
A
A= $self->{"raw"}{"data"}{"resolved"}
Aresult
11
00
149 1 ▶ return $resolved unless $kind;
Branch: 1 branch
BranchTrueFalseTotal
unless $kind 0 1 1
150 1 ▶ return $resolved->{$kind} unless defined $id;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id 0 1 1
151 1 ▶ return ref( $resolved->{$kind} ) eq 'HASH' ? $resolved->{$kind}{$id} : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $resolved->{$kind} eq 'HASH' ? : 1 0 1
152 }
153  
154 1094 ▶sub _parse_options {
Subroutine _parse_options: called CC=23 SCAR=40.5
155 1094 my ( $self, $options, $depth ) = @_;
156  
157 # Bound each level and reject duplicate names before flattening selected values.
158 1094 ▶ croak 'Invalid interaction options' unless ref($options) eq 'ARRAY' && @$options <= 25 && $depth <= 2;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $options eq "ARRAY" and @$options <= 25 and $depth <= 2 0 1094 1094
Condition33%2/6
ref $options eq "ARRAY" and @$options <= 25 and $depth <= 2
!ll&&!rl&&r
001094
ref $options eq "ARRAY" and @$options <= 25
!ll&&!rl&&r
001094
MC/DC0%0/3
ref $options eq "ARRAY" and @$options <= 25 and $depth <= 2
ref $options eq "ARRAY" @$options <= 25 $depth <= 2
Truth table25%1/4
A and B and C
A= ref $options eq "ARRAY"B= @$options <= 25C= $depth <= 2
ABCresult
0XX0
10X0
1100
1111
159 1094 my %names;
160 1094 for my $option (@$options) {
161 croak 'Invalid interaction option'
162 unless ref($option) eq 'HASH'
163 && defined( $option->{name} )
164 && !ref( $option->{name} )
165 && length( $option->{name} )
166 && defined( $option->{type} )
167 && !ref( $option->{type} )
168 9 ▶ && $option->{type} =~ /\A(?:[1-9]|10|11)\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"} and length $option->{"name"} and defined $option->{"type"} and not ref $option->{"type"} and $option->{"type"} =~ /\A(?:[1-9]|10|11)\z/u 0 9 9
Condition33%6/18
ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"} and length $option->{"name"} and defined $option->{"type"} and not ref $option->{"type"} and $option->{"type"} =~ /\A(?:[1-9]|10|11)\z/u
!ll&&!rl&&r
009
ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"} and length $option->{"name"} and defined $option->{"type"} and not ref $option->{"type"}
!ll&&!rl&&r
009
ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"} and length $option->{"name"} and defined $option->{"type"}
!ll&&!rl&&r
009
ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"} and length $option->{"name"}
!ll&&!rl&&r
009
ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"}
!ll&&!rl&&r
009
ref $option eq "HASH" and defined $option->{"name"}
!ll&&!rl&&r
009
MC/DC0%0/7
ref $option eq "HASH" and defined $option->{"name"} and not ref $option->{"name"} and length $option->{"name"} and defined $option->{"type"} and not ref $option->{"type"} and $option->{"type"} =~ /\A(?:[1-9]|10|11)\z/u
ref $option eq "HASH" defined $option->{"name"} not ref $option->{"name"} length $option->{"name"} defined $option->{"type"} not ref $option->{"type"} $option->{"type"} =~ /\A(?:[1-9]|10|11)\z/u
Truth table12%1/8
A and B and not(C) and D and E and not(F) and G
A= ref $option eq "HASH"B= defined $option->{"name"}C= not ref $option->{"name"}D= length $option->{"name"}E= defined $option->{"type"}F= not ref $option->{"type"}G= $option->{"type"} =~ /\A(?:[1-9]|10|11)\z/u
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
169 9 ▶ croak 'Invalid interaction option' if $names{ $option->{name} };
Branch: 1 branch
BranchTrueFalseTotal
if $names{$option->{"name"}} 0 9 9
170 9 $names{ $option->{name} } = 1;
171  
172 # Nested selectors form the command path; leaf options hold values and focus state.
173 9 ▶ if ( $option->{type} == 1 || $option->{type} == 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option->{"type"} == 1 or $option->{"type"} == 2) 3 6 9
Condition100%3/3
$option->{"type"} == 1 or $option->{"type"} == 2
l!l&&r!l&&!r
216
MC/DC100%2/2
$option->{"type"} == 1 or $option->{"type"} == 2
$option->{"type"} == 1 $option->{"type"} == 2
Truth table100%3/3
A or B
A= $option->{"type"} == 1B= $option->{"type"} == 2
ABresult
1X1
011
000
174 3 ▶ croak 'Invalid nested interaction option' if exists $option->{value};
Branch: 1 branch
BranchTrueFalseTotal
if exists $option->{"value"} 0 3 3
175 3 push @{ $self->{path} }, $option->{name};
176 3 ▶ $self->_parse_options( $option->{options} // [], $depth + 1 );
Condition50%1/2
$option->{"options"} // []
l!l
30
MC/DC0%0/1
$option->{"options"} // []
$option->{"options"}
Truth table50%1/2
A
A= $option->{"options"}
Aresult
11
00
177 3 next;
178 }
179  
180 # Leaf values are flattened for handlers; only one may drive autocomplete.
181 croak 'Invalid interaction option value'
182 if exists( $option->{options} )
183 || !exists( $option->{value} )
184 6 ▶ || ( ref( $option->{value} ) && !JSON::PP::is_bool( $option->{value} ) );
Branch: 1 branch
BranchTrueFalseTotal
if exists $option->{"options"} or not exists $option->{"value"} or ref $option->{"value"} and not JSON::PP::is_bool($option->{"value"}) 0 6 6
Condition33%3/9
exists $option->{"options"} or not exists $option->{"value"} or ref $option->{"value"} and not JSON::PP::is_bool($option->{"value"})
l!l&&r!l&&!r
006
exists $option->{"options"} or not exists $option->{"value"}
l!l&&r!l&&!r
006
ref $option->{"value"} and not JSON::PP::is_bool($option->{"value"})
!ll&&!rl&&r
600
MC/DC0%0/4
exists $option->{"options"} or not exists $option->{"value"} or ref $option->{"value"} and not JSON::PP::is_bool($option->{"value"})
exists $option->{"options"} not exists $option->{"value"} ref $option->{"value"} not JSON::PP::is_bool($option->{"value"})
Truth table20%1/5
A or not(B) or C and not(D)
A= exists $option->{"options"}B= not exists $option->{"value"}C= ref $option->{"value"}D= not JSON::PP::is_bool($option->{"value"})
ABCDresult
1XXX1
01XX1
00111
000X0
00100
185 6 $self->{options}{ $option->{name} } = $option->{value};
186 6 ▶ if ( $option->{focused} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option->{"focused"}) 3 3 6
187 3 ▶ croak 'Multiple focused interaction options' if $self->{focused};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"focused"} 0 3 3
188 3 $self->{focused} = {%$option};
189 }
190 }
191 }
192  
193 26 ▶sub _failed {
Subroutine _failed: called CC=1 SCAR=0.0
194 26 my ( $self, $message, $category, %fields ) = @_;
195 26 my $future = $self->{loop}->new_future;
196 26 my $error = Discord::Client::Error->new( message => $message, category => $category, %fields );
197 26 return $future->fail( $message, $category, $error );
198 }
199  
200 7 ▶sub _expire_initial {
Subroutine _expire_initial: called CC=6 SCAR=18.2
201 7 my ($self) = @_;
202 7 ▶ return if $self->{acknowledgement}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"acknowledgement"}->is_ready 0 7 7
203  
204 # Mark expiry before notifying observers so no callback can start another response.
205 7 $self->{state} = 'expired';
206 7 my $failed = $self->_failed( 'Interaction initial response deadline exceeded', 'deadline' );
207 7 $self->{acknowledgement}->fail( $failed->failure );
208 7 ▶ if ( my $initial = $self->{initial_operation} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $initial = $self->{"initial_operation"}) 1 6 7
209 1 ▶ $initial->fail( $failed->failure ) unless $initial->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $initial->is_ready 1 0 1
210 }
211  
212 # Cancel outstanding delivery after publishing the deadline failure.
213 7 ▶ if ( my $source = delete $self->{initial_source} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $source = delete $self->{"initial_source"}) 1 6 7
214 1 ▶ $source->cancel unless $source->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $source->is_ready 1 0 1
215 }
216 }
217  
218 1076 ▶sub _message {
Subroutine _message: called CC=10 SCAR=27.4
219 1076 my ( $self, $message, %options ) = @_;
220  
221 # Copy caller data before adding SDK-controlled visibility flags.
222 1076 ▶ croak 'Message must be a string or hash reference'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $message and !ref($message) || ref $message eq "HASH" 0 1076 1076
Condition50%3/6
defined $message and !ref($message) || ref $message eq "HASH"
!ll&&!rl&&r
001076
not ref $message or ref $message eq "HASH"
l!l&&r!l&&!r
107060
MC/DC0%0/3
defined $message and !ref($message) || ref $message eq "HASH"
defined $message not ref $message ref $message eq "HASH"
Truth table50%2/4
A and not(B) or C
A= defined $messageB= not ref $messageC= ref $message eq "HASH"
ABCresult
0XX0
1000
11X1
1011
223 unless defined($message)
224 && ( !ref($message) || ref($message) eq 'HASH' );
225 1076 ▶ my $data = ref($message) ? {%$message} : { content => "$message" };
Branch: 1 branch
BranchTrueFalseTotal
ref $message ? : 6 1070 1076
226 1076 ▶ if ( $options{ephemeral} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"ephemeral"}) 7 1069 1076
227 croak 'Invalid message flags'
228 if defined( $data->{flags} )
229 7 ▶ && ( ref( $data->{flags} ) || $data->{flags} !~ /\A\d+\z/ );
Branch: 1 branch
BranchTrueFalseTotal
if defined $data->{"flags"} and ref $data->{"flags"} || !($data->{"flags"} =~ /\A\d+\z/u) 0 7 7
Condition16%1/6
defined $data->{"flags"} and ref $data->{"flags"} || !($data->{"flags"} =~ /\A\d+\z/u)
!ll&&!rl&&r
700
ref $data->{"flags"} or not $data->{"flags"} =~ /\A\d+\z/u
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $data->{"flags"} and ref $data->{"flags"} || !($data->{"flags"} =~ /\A\d+\z/u)
defined $data->{"flags"} ref $data->{"flags"} not $data->{"flags"} =~ /\A\d+\z/u
Truth table25%1/4
A and B or not(C)
A= defined $data->{"flags"}B= ref $data->{"flags"}C= not $data->{"flags"} =~ /\A\d+\z/u
ABCresult
0XX0
1000
11X1
1011
230 7 ▶ $data->{flags} = ( $data->{flags} // 0 ) | 64;
Condition50%1/2
$data->{"flags"} // 0
l!l
07
MC/DC0%0/1
$data->{"flags"} // 0
$data->{"flags"}
Truth table50%1/2
A
A= $data->{"flags"}
Aresult
11
00
231 }
232 1076 return $data;
233 }
234  
235 1072 ▶sub reply {
Subroutine reply: called CC=6 SCAR=18.0
Pod documented
236 1072 my ( $self, $message, %options ) = @_;
237 1072 ▶ return $self->_failed( 'Autocomplete interactions require choices', 'state' ) if $self->{type} == 4;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} == 4 1 1071 1072
238 1071 my $data = eval { $self->_message( $message, %options ) };
239 1071 ▶ return $self->_failed( 'Invalid interaction message', 'request' ) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1071 1071
240  
241 # Complete a confirmed deferral by editing its original message exactly once.
242 1071 ▶ if ( $self->{state} eq 'deferred' || $self->{state} eq 'deferred_update' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"state"} eq "deferred" or $self->{"state"} eq "deferred_update") 5 1066 1071
Condition66%2/3
$self->{"state"} eq "deferred" or $self->{"state"} eq "deferred_update"
l!l&&r!l&&!r
501066
MC/DC50%1/2
$self->{"state"} eq "deferred" or $self->{"state"} eq "deferred_update"
$self->{"state"} eq "deferred" $self->{"state"} eq "deferred_update"
Truth table66%2/3
A or B
A= $self->{"state"} eq "deferred"B= $self->{"state"} eq "deferred_update"
ABresult
1X1
011
000
243 return $self->_failed( 'Deferred response visibility is already fixed', 'request' )
244 5 ▶ if exists $options{ephemeral};
Branch: 1 branch
BranchTrueFalseTotal
if exists $options{"ephemeral"} 1 4 5
245 4 $self->{state} = 'completing';
246 4 my $future = $self->_webhook( 'PATCH', '/messages/@original', json => $data );
247 4 ▶ $future->on_ready( sub { $self->{state} = $future->is_done ? 'replied' : 'failed' } );
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$future->is_done ? : 4 0 4
248 4 return $future;
249 }
250 1066 return $self->_initial( 4, $data, 'replied' );
251 }
252  
253 16 ▶sub defer {
Subroutine defer: called CC=6 SCAR=18.2
Pod documented
254 16 my ( $self, %options ) = @_;
255 16 ▶ return $self->_failed( 'Autocomplete cannot be deferred', 'state' ) if $self->{type} == 4;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} == 4 0 16 16
256  
257 # Message updates and new deferred replies have different visibility rules.
258 16 ▶ if ( $options{update} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options{"update"}) 1 15 16
259 1 ▶ return $self->_failed( 'Update deferral requires a message component', 'state' ) unless $self->_can_update;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_can_update 0 1 1
260 1 ▶ return $self->_failed( 'Update deferral cannot set ephemeral visibility', 'request' ) if $options{ephemeral};
Branch: 1 branch
BranchTrueFalseTotal
if $options{"ephemeral"} 0 1 1
261 1 return $self->_initial( 6, undef, 'deferred_update' );
262 }
263 15 ▶ return $self->_initial( 5, $options{ephemeral} ? { flags => 64 } : undef, 'deferred' );
Branch: 1 branch
BranchTrueFalseTotal
$options{'ephemeral'} ? : 4 11 15
264 }
265  
266 1 ▶sub _can_update { $_[0]->{type} == 3 || ( $_[0]->{type} == 5 && ref( $_[0]->{raw}{message} ) eq 'HASH' ) }
Subroutine _can_update: called CC=3 SCAR=17.3
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"type"} == 3 or $_[0]{"type"} == 5 and ref $_[0]{"raw"}{"message"} eq "HASH" 1 0 1
Condition16%1/6
$_[0]{'type'} == 3 || $_[0]{'type'} == 5 && ref $_[0]{'raw'}{'message'} eq 'HASH'
l!l&&r!l&&!r
100
$_[0]{"type"} == 5 and ref $_[0]{"raw"}{"message"} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
$_[0]{'type'} == 3 || $_[0]{'type'} == 5 && ref $_[0]{'raw'}{'message'} eq 'HASH'
$_[0]{'type'} == 3 $_[0]{"type"} == 5 ref $_[0]{"raw"}{"message"} eq "HASH"
Truth table25%1/4
A || B and C
A= $_[0]{'type'} == 3B= $_[0]{"type"} == 5C= ref $_[0]{"raw"}{"message"} eq "HASH"
ABCresult
1XX1
0111
00X0
0100
267  
268 0 ▶sub update {
Subroutine update: not called CC=3 SCAR=24.8
Pod documented
269 0 my ( $self, $message ) = @_;
270 0 ▶ return $self->_failed( 'Update requires a message component', 'state' ) unless $self->_can_update;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_can_update 0 0 0
271 0 my $data = eval { $self->_message($message) };
272 0 ▶ return $self->_failed( 'Invalid interaction message', 'request' ) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
273 0 return $self->_initial( 7, $data, 'replied' );
274 }
275  
276 3 ▶sub autocomplete {
Subroutine autocomplete: called CC=20 SCAR=40.7
Pod documented
277 3 my ( $self, $choices ) = @_;
278 3 ▶ return $self->_failed( 'Choices require an autocomplete interaction', 'state' ) unless $self->{type} == 4;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"type"} == 4 0 3 3
279 3 ▶ return $self->_failed( 'Invalid autocomplete choices', 'request' )
Branch: 1 branch
BranchTrueFalseTotal
unless ref $choices eq "ARRAY" and @$choices <= 25 0 3 3
Condition33%1/3
ref $choices eq "ARRAY" and @$choices <= 25
!ll&&!rl&&r
003
MC/DC0%0/2
ref $choices eq "ARRAY" and @$choices <= 25
ref $choices eq "ARRAY" @$choices <= 25
Truth table33%1/3
A and B
A= ref $choices eq "ARRAY"B= @$choices <= 25
ABresult
0X0
100
111
280 unless ref($choices) eq 'ARRAY' && @$choices <= 25;
281  
282 # Validate each suggestion against the focused option and normalize JSON value types.
283 3 my @wire;
284 3 for my $choice (@$choices) {
285 return $self->_failed( 'Invalid autocomplete choice', 'request' )
286 unless ref($choice) eq 'HASH'
287 && defined( $choice->{name} )
288 && !ref( $choice->{name} )
289 && length( $choice->{name} ) >= 1
290 && length( $choice->{name} ) <= 100
291 && defined( $choice->{value} )
292 3 ▶ && !ref( $choice->{value} );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"} and length $choice->{"name"} >= 1 and length $choice->{"name"} <= 100 and defined $choice->{"value"} and not ref $choice->{"value"} 0 3 3
Condition33%6/18
ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"} and length $choice->{"name"} >= 1 and length $choice->{"name"} <= 100 and defined $choice->{"value"} and not ref $choice->{"value"}
!ll&&!rl&&r
003
ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"} and length $choice->{"name"} >= 1 and length $choice->{"name"} <= 100 and defined $choice->{"value"}
!ll&&!rl&&r
003
ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"} and length $choice->{"name"} >= 1 and length $choice->{"name"} <= 100
!ll&&!rl&&r
003
ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"} and length $choice->{"name"} >= 1
!ll&&!rl&&r
003
ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"}
!ll&&!rl&&r
003
ref $choice eq "HASH" and defined $choice->{"name"}
!ll&&!rl&&r
003
MC/DC0%0/7
ref $choice eq "HASH" and defined $choice->{"name"} and not ref $choice->{"name"} and length $choice->{"name"} >= 1 and length $choice->{"name"} <= 100 and defined $choice->{"value"} and not ref $choice->{"value"}
ref $choice eq "HASH" defined $choice->{"name"} not ref $choice->{"name"} length $choice->{"name"} >= 1 length $choice->{"name"} <= 100 defined $choice->{"value"} not ref $choice->{"value"}
Truth table12%1/8
A and B and not(C) and D and E and F and not(G)
A= ref $choice eq "HASH"B= defined $choice->{"name"}C= not ref $choice->{"name"}D= length $choice->{"name"} >= 1E= length $choice->{"name"} <= 100F= defined $choice->{"value"}G= not ref $choice->{"value"}
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
293 3 my $type = $self->{focused}{type};
294 3 ▶ if ( $type == 3 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == 3) { } 2 1 3
295 return $self->_failed( 'Invalid autocomplete choice value', 'request' )
296 2 ▶ if length( $choice->{value} ) > 100;
Branch: 1 branch
BranchTrueFalseTotal
if length $choice->{"value"} > 100 0 2 2
297 }
298 else {
299 return $self->_failed( 'Invalid autocomplete choice value', 'request' )
300 if !looks_like_number( $choice->{value} )
301 || abs( $choice->{value} ) > 9007199254740992
302 || ( $type == 4
303 1 ▶ && ( $choice->{value} != int( $choice->{value} ) || abs( $choice->{value} ) >= 9007199254740992 ) );
Branch: 1 branch
BranchTrueFalseTotal
if not &looks_like_number($choice->{"value"}) or abs $choice->{"value"} > '9007199254740992' or $type == 4 and $choice->{"value"} != int $choice->{"value"} || abs $choice->{"value"} >= '9007199254740992' 0 1 1
Condition33%4/12
not &looks_like_number($choice->{"value"}) or abs $choice->{"value"} > '9007199254740992' or $type == 4 and $choice->{"value"} != int $choice->{"value"} || abs $choice->{"value"} >= '9007199254740992'
l!l&&r!l&&!r
001
not &looks_like_number($choice->{"value"}) or abs $choice->{"value"} > '9007199254740992'
l!l&&r!l&&!r
001
$type == 4 and $choice->{"value"} != int $choice->{"value"} || abs $choice->{"value"} >= '9007199254740992'
!ll&&!rl&&r
010
$choice->{"value"} != int $choice->{"value"} or abs $choice->{"value"} >= '9007199254740992'
l!l&&r!l&&!r
001
MC/DC0%0/5
not &looks_like_number($choice->{"value"}) or abs $choice->{"value"} > '9007199254740992' or $type == 4 and $choice->{"value"} != int $choice->{"value"} || abs $choice->{"value"} >= '9007199254740992'
not &looks_like_number($choice->{"value"}) abs $choice->{"value"} > '9007199254740992' $type == 4 $choice->{"value"} != int $choice->{"value"} abs $choice->{"value"} >= '9007199254740992'
Truth table16%1/6
not(A) or B or C and D or E
A= not &looks_like_number($choice->{"value"})B= abs $choice->{"value"} > '9007199254740992'C= $type == 4D= $choice->{"value"} != int $choice->{"value"}E= abs $choice->{"value"} >= '9007199254740992'
ABCDEresult
1XXXX1
01XXX1
0011X1
001011
000XX0
001000
304 }
305 3 ▶ push @wire, { %$choice, value => $type == 3 ? "$choice->{value}" : 0 + $choice->{value} };
Branch: 1 branch
BranchTrueFalseTotal
$type == 3 ? : 2 1 3
306 }
307 3 return $self->_initial( 8, { choices => \@wire }, 'replied' );
308 }
309  
310 1 ▶sub modal {
Subroutine modal: called CC=13 SCAR=38.2
Pod documented
311 1 my ( $self, $data ) = @_;
312  
313 # A modal opens only from a command or message component, never a modal submission.
314 return $self->_failed( 'Modal response is invalid for this interaction', 'state' )
315 1 ▶ unless $self->{type} == 2 || $self->{type} == 3;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"type"} == 2 or $self->{"type"} == 3 0 1 1
Condition33%1/3
$self->{"type"} == 2 or $self->{"type"} == 3
l!l&&r!l&&!r
100
MC/DC0%0/2
$self->{"type"} == 2 or $self->{"type"} == 3
$self->{"type"} == 2 $self->{"type"} == 3
Truth table33%1/3
A or B
A= $self->{"type"} == 2B= $self->{"type"} == 3
ABresult
1X1
011
000
316 return $self->_failed( 'Invalid modal response', 'request' )
317 unless ref($data) eq 'HASH'
318 && defined( $data->{custom_id} )
319 && !ref( $data->{custom_id} )
320 && length( $data->{custom_id} ) <= 100
321 && length( $data->{custom_id} ) > 0
322 && defined( $data->{title} )
323 && !ref( $data->{title} )
324 && length( $data->{title} ) > 0
325 && length( $data->{title} ) <= 45
326 1 ▶ && ref( $data->{components} ) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"} and not ref $data->{"title"} and length $data->{"title"} > 0 and length $data->{"title"} <= 45 and ref $data->{"components"} eq "ARRAY" 0 1 1
Condition33%9/27
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"} and not ref $data->{"title"} and length $data->{"title"} > 0 and length $data->{"title"} <= 45 and ref $data->{"components"} eq "ARRAY"
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"} and not ref $data->{"title"} and length $data->{"title"} > 0 and length $data->{"title"} <= 45
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"} and not ref $data->{"title"} and length $data->{"title"} > 0
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"} and not ref $data->{"title"}
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"}
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"}
!ll&&!rl&&r
001
ref $data eq "HASH" and defined $data->{"custom_id"}
!ll&&!rl&&r
001
MC/DC0%0/10
ref $data eq "HASH" and defined $data->{"custom_id"} and not ref $data->{"custom_id"} and length $data->{"custom_id"} <= 100 and length $data->{"custom_id"} > 0 and defined $data->{"title"} and not ref $data->{"title"} and length $data->{"title"} > 0 and length $data->{"title"} <= 45 and ref $data->{"components"} eq "ARRAY"
ref $data eq "HASH" defined $data->{"custom_id"} not ref $data->{"custom_id"} length $data->{"custom_id"} <= 100 length $data->{"custom_id"} > 0 defined $data->{"title"} not ref $data->{"title"} length $data->{"title"} > 0 length $data->{"title"} <= 45 ref $data->{"components"} eq "ARRAY"
Truth table9%1/11
A and B and not(C) and D and E and F and not(G) and H and I and J
A= ref $data eq "HASH"B= defined $data->{"custom_id"}C= not ref $data->{"custom_id"}D= length $data->{"custom_id"} <= 100E= length $data->{"custom_id"} > 0F= defined $data->{"title"}G= not ref $data->{"title"}H= length $data->{"title"} > 0I= length $data->{"title"} <= 45J= ref $data->{"components"} eq "ARRAY"
ABCDEFGHIJresult
0XXXXXXXXX0
10XXXXXXXX0
110XXXXXXX0
1110XXXXXX0
11110XXXXX0
111110XXXX0
1111110XXX0
11111110XX0
111111110X0
11111111100
11111111111
327 1 return $self->_initial( 9, $data, 'replied' );
328 }
329  
330 1086 ▶sub _initial {
Subroutine _initial: called CC=9 SCAR=22.4
331 1086 my ( $self, $type, $data, $next_state ) = @_;
332  
333 # Reject closed, expired or already-answered contexts before attempting delivery.
334 1086 ▶ return $self->_failed( 'Interaction is closed', 'shutdown' ) if $self->{closed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"closed"} 0 1086 1086
335 return $self->_failed( 'Interaction initial response deadline exceeded', 'deadline' )
336 1086 ▶ if $self->{clock}->() >= $self->{deadline} || $self->{state} eq 'expired';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"clock"}->() >= $self->{"deadline"} or $self->{"state"} eq "expired" 2 1084 1086
Condition66%2/3
$self->{"clock"}->() >= $self->{"deadline"} or $self->{"state"} eq "expired"
l!l&&r!l&&!r
201084
MC/DC50%1/2
$self->{"clock"}->() >= $self->{"deadline"} or $self->{"state"} eq "expired"
$self->{"clock"}->() >= $self->{"deadline"} $self->{"state"} eq "expired"
Truth table66%2/3
A or B
A= $self->{"clock"}->() >= $self->{"deadline"}B= $self->{"state"} eq "expired"
ABresult
1X1
011
000
337 1084 ▶ return $self->_failed( 'Interaction already has an initial response', 'state' ) unless $self->{state} eq 'new';
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"state"} eq "new" 5 1079 1084
338  
339 # Validate serialization before consuming the one initial-response opportunity.
340 1079 my $payload = { type => $type };
341 1079 ▶ $payload->{data} = $data if defined $data;
Branch: 1 branch
BranchTrueFalseTotal
if defined $data 1067 12 1079
342 return $self->_failed( 'Interaction response is not JSON encodable', 'request' )
343 1079 ▶ unless eval {
Branch: 1 branch
BranchTrueFalseTotal
unless eval { do { "JSON::PP"->new->encode($payload); 1 } } 0 1079 1079
344 1079 JSON::PP->new->encode($payload);
345 1079 1;
346 };
347  
348 # Reserve the response before invoking either REST or an inline HTTP sender.
349 1079 $self->{state} = 'responding';
350 1079 my $source = eval { $self->_send_initial_response($payload) };
351 1079 my $future = $self->_observe($source);
352 1079 $self->{initial_operation} = $future;
353 1079 ▶ $self->{initial_source} = $source if blessed($source) && $source->isa('Future');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($source) and $source->isa("Future") 1079 0 1079
Condition33%1/3
builtin::blessed($source) and $source->isa("Future")
!ll&&!rl&&r
001079
MC/DC0%0/2
builtin::blessed($source) and $source->isa("Future")
builtin::blessed($source) $source->isa("Future")
Truth table33%1/3
A and B
A= builtin::blessed($source)B= $source->isa("Future")
ABresult
0X0
100
111
354 1079 ▶ $future->on_ready( sub { $self->_complete_initial_response( $future, $next_state ) } );
Subroutine __ANON__: called CC=1 SCAR=0.0
355 1079 return $future;
356 }
357  
358 1079 ▶sub _send_initial_response {
Subroutine _send_initial_response: called CC=2 SCAR=6.9
359 1079 my ( $self, $payload ) = @_;
360  
361 # HTTP delivery can answer inline; Gateway delivery uses the unauthenticated callback endpoint.
362 1079 ▶ return $self->{initial_sender}->($payload) if $self->{initial_sender};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"initial_sender"} 1048 31 1079
363 31 my $path = '/interactions/' . $self->{id} . '/' . uri_escape_utf8( $self->{token} ) . '/callback';
364 31 return $self->_rest->request( 'POST', $path, auth => 0, json => $payload );
365 }
366  
367 1079 ▶sub _complete_initial_response {
Subroutine _complete_initial_response: called CC=9 SCAR=22.3
368 1079 my ( $self, $future, $next_state ) = @_;
369 1079 ▶ return if $self->{state} eq 'expired' || $self->{closed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"state"} eq "expired" or $self->{"closed"} 1 1078 1079
Condition66%2/3
$self->{"state"} eq "expired" or $self->{"closed"}
l!l&&r!l&&!r
101078
MC/DC50%1/2
$self->{"state"} eq "expired" or $self->{"closed"}
$self->{"state"} eq "expired" $self->{"closed"}
Truth table66%2/3
A or B
A= $self->{"state"} eq "expired"B= $self->{"closed"}
ABresult
1X1
011
000
370  
371 # Release delivery state and deadline before notifying acknowledgement observers.
372 1078 delete @{$self}{qw(initial_operation initial_source)};
373 1078 ▶ if ( my $timer = delete $self->{initial_timer} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $timer = delete $self->{"initial_timer"}) 1078 0 1078
374 1078 ▶ $timer->cancel unless $timer->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $timer->is_ready 1078 0 1078
375 }
376  
377 # Only confirmed delivery enables webhook operations; failure remains non-retryable.
378 1078 ▶ if ( $future->is_done ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($future->is_done) 1076 2 1078
379 1076 $self->{state} = $next_state;
380 1076 ▶ $self->{acknowledgement}->done unless $self->{acknowledgement}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"acknowledgement"}->is_ready 1076 0 1076
381 1076 return;
382 }
383  
384 # Cancellation cannot distinguish a rejected response from one already delivered.
385 2 $self->{state} = 'failed';
386 2 my $failure = $future;
387 2 ▶ unless ( $future->is_failed ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($future->is_failed) 1 1 2
388 1 $failure = $self->_failed( 'Interaction response cancelled; delivery is uncertain', 'cancelled' );
389 }
390 2 ▶ $self->{acknowledgement}->fail( $failure->failure ) unless $self->{acknowledgement}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"acknowledgement"}->is_ready 2 0 2
391 }
392  
393 38 ▶sub _rest {
Subroutine _rest: called CC=2 SCAR=8.4
394 38 my ($self) = @_;
395  
396 # Standalone contexts lazily create token-only REST and own its cleanup.
397 38 ▶ unless ( $self->{rest} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"rest"}) 0 38 38
398 0 $self->{rest} = Discord::Client::REST->new( auth => 0, loop => $self->{loop} );
399 0 $self->{own_rest} = 1;
400 }
401 38 return $self->{rest};
402 }
403  
404 1086 ▶sub _observe {
Subroutine _observe: called CC=3 SCAR=11.6
405 1086 my ( $self, $source ) = @_;
406 1086 ▶ return $self->_failed( 'Interaction transport failed', 'transport' )
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($source) and $source->isa("Future") 0 1086 1086
Condition33%1/3
builtin::blessed($source) and $source->isa("Future")
!ll&&!rl&&r
001086
MC/DC0%0/2
builtin::blessed($source) and $source->isa("Future")
builtin::blessed($source) $source->isa("Future")
Truth table33%1/3
A and B
A= builtin::blessed($source)B= $source->isa("Future")
ABresult
0X0
100
111
407 unless blessed($source) && $source->isa('Future');
408  
409 # Track operations so context shutdown can cancel both the observer and transport.
410 1086 my $future = $self->{loop}->new_future;
411 1086 my $key = refaddr($future);
412 1086 $self->{operations}{$key} = $future;
413 1086 ▶ $future->on_cancel( sub { $source->cancel unless $source->is_ready } );
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
unless $source->is_ready 1 0 1
414  
415 # Detach completed work before forwarding its outcome to application callbacks.
416 $source->on_ready(
417 1086 ▶ sub {
Subroutine __ANON__: called CC=13 SCAR=28.3
418 1086 delete $self->{operations}{$key};
419 1086 ▶ return if $future->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if $future->is_ready 1 1085 1086
420 1085 ▶ if ( $source->is_done ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($source->is_done) 1083 2 1085
421 1083 $future->done( $source->result );
422 1083 return;
423 }
424 2 ▶ if ( $source->is_cancelled ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($source->is_cancelled) 1 1 2
425 1 $future->cancel;
426 1 return;
427 }
428  
429 # Preserve useful error codes while excluding raw transport details and tokens.
430 1 my ( undef, $category, $error ) = $source->failure;
431 1 my %fields;
432 1 ▶ if ( blessed($error) && $error->isa('Discord::Client::Error') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($error) and $error->isa("Discord::Client::Error")) 1 0 1
Condition33%1/3
builtin::blessed($error) and $error->isa("Discord::Client::Error")
!ll&&!rl&&r
001
MC/DC0%0/2
builtin::blessed($error) and $error->isa("Discord::Client::Error")
builtin::blessed($error) $error->isa("Discord::Client::Error")
Truth table33%1/3
A and B
A= builtin::blessed($error)B= $error->isa("Discord::Client::Error")
ABresult
0X0
100
111
433 1 %fields = ( status => $error->status, discord_code => $error->discord_code );
434 1 ▶ $self->{invalidated} = 1
Branch: 1 branch
BranchTrueFalseTotal
if ($error->status // 0) == 401 or ($error->discord_code // 0) == 10015 or ($error->discord_code // 0) == 10062 0 1 1
Condition41%5/12
($error->status // 0) == 401 or ($error->discord_code // 0) == 10015 or ($error->discord_code // 0) == 10062
l!l&&r!l&&!r
001
($error->status // 0) == 401 or ($error->discord_code // 0) == 10015
l!l&&r!l&&!r
001
$error->status // 0
l!l
01
$error->discord_code // 0
l!l
01
$error->discord_code // 0
l!l
01
MC/DC0%0/3
($error->status // 0) == 401 or ($error->discord_code // 0) == 10015 or ($error->discord_code // 0) == 10062
$error->status $error->discord_code $error->discord_code
Truth table25%1/4
A or B or C
A= $error->statusB= $error->discord_codeC= $error->discord_code
ABCresult
1XX1
01X1
0011
0000
435 if ( $error->status // 0 ) == 401
436 || ( $error->discord_code // 0 ) == 10015
437 || ( $error->discord_code // 0 ) == 10062;
438 }
439 1 ▶ my $failed = $self->_failed( 'Interaction request failed', $category // 'transport', %fields );
Condition50%1/2
$category // "transport"
l!l
10
MC/DC0%0/1
$category // "transport"
$category
Truth table50%1/2
A
A= $category
Aresult
11
00
440 1 $future->fail( $failed->failure );
441 }
442 1086 );
443 1086 return $future;
444 }
445  
446 9 ▶sub _webhook {
Subroutine _webhook: called CC=5 SCAR=16.2
447 9 my ( $self, $method, $suffix, %args ) = @_;
448  
449 # Webhook operations require a confirmed acknowledgement and a still-valid token.
450 9 ▶ return $self->_failed( 'Interaction is closed', 'shutdown' ) if $self->{closed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"closed"} 1 8 9
451 return $self->_failed( 'Interaction token expired or invalidated', 'expired' )
452 8 ▶ if $self->{invalidated} || $self->{clock}->() >= $self->{expires_at};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"invalidated"} or $self->{"clock"}->() >= $self->{"expires_at"} 1 7 8
Condition66%2/3
$self->{"invalidated"} or $self->{"clock"}->() >= $self->{"expires_at"}
l!l&&r!l&&!r
017
MC/DC50%1/2
$self->{"invalidated"} or $self->{"clock"}->() >= $self->{"expires_at"}
$self->{"invalidated"} $self->{"clock"}->() >= $self->{"expires_at"}
Truth table66%2/3
A or B
A= $self->{"invalidated"}B= $self->{"clock"}->() >= $self->{"expires_at"}
ABresult
1X1
011
000
453 return $self->_failed( 'Interaction requires a confirmed initial response', 'state' )
454 7 ▶ unless $self->{acknowledgement}->is_done;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"acknowledgement"}->is_done 0 7 7
455  
456 # Escape the token as one path segment and never attach Bot authorization.
457 7 my $source = eval {
458 $self->_rest->request(
459 $method, '/webhooks/'
460 . $self->{application_id}
461 . '/'
462 . uri_escape_utf8( $self->{token} )
463 7 . $suffix,
464 auth => 0,
465 %args
466 );
467 };
468 7 return $self->_observe($source);
469 }
470  
471 1 ▶sub edit_original {
Subroutine edit_original: called CC=2 SCAR=7.0
Pod documented
472 1 my ( $self, $message ) = @_;
473 1 my $data = eval { $self->_message($message) };
474 1 ▶ return $self->_failed( 'Invalid interaction message', 'request' ) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
475 1 return $self->_webhook( 'PATCH', '/messages/@original', json => $data );
476 }
477 0 ▶sub get_original { $_[0]->_webhook( 'GET', '/messages/@original' ) }
Subroutine get_original: not called CC=1 SCAR=6.9
Pod documented
478 0 ▶sub delete_original { $_[0]->_webhook( 'DELETE', '/messages/@original' ) }
Subroutine delete_original: not called CC=1 SCAR=6.9
Pod documented
479  
480 4 ▶sub followup {
Subroutine followup: called CC=2 SCAR=7.0
Pod documented
481 4 my ( $self, $message, %options ) = @_;
482 4 my $data = eval { $self->_message( $message, %options ) };
483 4 ▶ return $self->_failed( 'Invalid interaction message', 'request' ) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 4 4
484 4 return $self->_webhook( 'POST', '', json => $data, query => { wait => 'true' } );
485 }
486  
487 0 ▶sub edit_followup {
Subroutine edit_followup: not called CC=3 SCAR=24.8
Pod documented
488 0 my ( $self, $id, $message ) = @_;
489 0 ▶ return $self->_failed( 'Invalid followup message ID', 'request' ) unless _id($id);
Branch: 1 branch
BranchTrueFalseTotal
unless _id($id) 0 0 0
490 0 my $data = eval { $self->_message($message) };
491 0 ▶ return $self->_failed( 'Invalid interaction message', 'request' ) if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
492 0 return $self->_webhook( 'PATCH', '/messages/' . $id, json => $data );
493 }
494  
495 0 ▶sub delete_followup {
Subroutine delete_followup: not called CC=2 SCAR=17.9
Pod documented
496 0 my ( $self, $id ) = @_;
497 0 ▶ return $self->_failed( 'Invalid followup message ID', 'request' ) unless _id($id);
Branch: 1 branch
BranchTrueFalseTotal
unless _id($id) 0 0 0
498 0 return $self->_webhook( 'DELETE', '/messages/' . $id );
499 }
500  
501 30 ▶sub close {
Subroutine close: called CC=7 SCAR=19.5
Pod documented
502 30 my ($self) = @_;
503  
504 # Stop the deadline and prevent future operations before cancelling current work.
505 30 ▶ return $self->{loop}->new_future->done if $self->{closed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"closed"} 8 22 30
506 22 $self->{closed} = 1;
507 22 ▶ if ( my $timer = delete $self->{initial_timer} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $timer = delete $self->{"initial_timer"}) 10 12 22
508 10 ▶ $timer->cancel unless $timer->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
unless $timer->is_ready 6 4 10
509 }
510 22 ▶ if ( !$self->{acknowledgement}->is_ready ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"acknowledgement"}->is_ready) 6 16 22
511 6 $self->{acknowledgement}->fail( $self->_failed( 'Interaction is closed', 'shutdown' )->failure );
512 }
513  
514 # Use a snapshot because cancellation callbacks mutate the operation registry.
515 22 my @operations = CORE::values %{ $self->{operations} };
516 0 $_->cancel for grep { !$_->is_ready } @operations;
517 22 $self->{operations} = {};
518 22 ▶ return $self->{own_rest} ? $self->{rest}->close : $self->{loop}->new_future->done;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'own_rest'} ? : 0 22 22
519 }
520  
521 1091 ▶sub DESTROY {
Subroutine DESTROY: called CC=4 SCAR=16.1
522 1091 my ($self) = @_;
523  
524 # Release lazily owned resources even when the caller simply drops the context.
525 1091 ▶ $self->{initial_timer}->cancel if $self->{initial_timer} && !$self->{initial_timer}->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"initial_timer"} and not $self->{"initial_timer"}->is_ready 0 1091 1091
Condition33%1/3
$self->{"initial_timer"} and not $self->{"initial_timer"}->is_ready
!ll&&!rl&&r
109100
MC/DC0%0/2
$self->{"initial_timer"} and not $self->{"initial_timer"}->is_ready
$self->{"initial_timer"} not $self->{"initial_timer"}->is_ready
Truth table33%1/3
A and not(B)
A= $self->{"initial_timer"}B= not $self->{"initial_timer"}->is_ready
ABresult
0X0
100
111
526 1091 ▶ $self->{rest}->close if $self->{own_rest};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"own_rest"} 0 1091 1091
527 }
528  
529 10 1;
530  
531 __END__
« blib/lib/Discord/Client/Commands.pm ↑ Summary blib/lib/Discord/Client/REST.pm »