line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DiceBot; |
2
|
1
|
|
|
1
|
|
327
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
304
|
use Bot::BasicBot::CommandBot qw/command/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
6
|
1
|
|
|
1
|
|
9
|
use List::Util qw/sum/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use base 'Bot::BasicBot::CommandBot'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
196
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
command '1d6' => sub { |
11
|
|
|
|
|
|
|
return int(rand 6) + 1; |
12
|
|
|
|
|
|
|
}; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
command qr/\d+d\d+/i => sub { |
15
|
|
|
|
|
|
|
my ($self, $cmd, $message) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($num, $faces) = $cmd =~ /(\d+)d(\d+)/; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my @rolls = map { int(rand $faces) + 1 } 1 .. $num; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return join(", ", @rolls) . " = " . sum(0, @rolls); |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |