line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Bot::IRC plugin for dice rolling |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use 5.014; |
4
|
1
|
|
|
1
|
|
304304
|
use exact; |
|
1
|
|
|
|
|
11
|
|
5
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
use Games::Dice 'roll'; |
7
|
1
|
|
|
1
|
|
778
|
|
|
1
|
|
|
|
|
1056
|
|
|
1
|
|
|
|
|
169
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.06'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my ($bot) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
0
|
5719
|
$bot->hook( |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
command => 'PRIVMSG', |
15
|
|
|
|
|
|
|
text => qr/^roll\s+(?<expr>\d*d[\d%]+(?:[+\-*\/]\d+)?)/, |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
sub { |
18
|
|
|
|
|
|
|
my ( $bot, $in, $m ) = @_; |
19
|
|
|
|
|
|
|
$bot->reply( roll( $m->{expr} ) ); |
20
|
1
|
|
|
1
|
|
204
|
}, |
21
|
1
|
|
|
|
|
5
|
); |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
12
|
$bot->helps( dice => 'Simulated dice rolls. Usage: roll <dice expression like "2d6+2">.' ); |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
9
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding UTF-8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Bot::IRC::X::Dice - Bot::IRC plugin for dice rolling |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 VERSION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
version 1.06 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=for markdown [![test](https://github.com/gryphonshafer/Bot-IRC-X-Dice/workflows/test/badge.svg)](https://github.com/gryphonshafer/Bot-IRC-X-Dice/actions?query=workflow%3Atest) |
42
|
|
|
|
|
|
|
[![codecov](https://codecov.io/gh/gryphonshafer/Bot-IRC-X-Dice/graph/badge.svg)](https://codecov.io/gh/gryphonshafer/Bot-IRC-X-Dice) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Bot::IRC; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Bot::IRC->new( |
49
|
|
|
|
|
|
|
connect => { server => 'irc.perl.org' }, |
50
|
|
|
|
|
|
|
plugins => ['Dice'], |
51
|
|
|
|
|
|
|
)->run; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This L<Bot::IRC> plugin provides the means for the bot to perform simulated |
56
|
|
|
|
|
|
|
dice rolls. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
roll <dice expression like "2d6+2"> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
You can look for additional information at: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over 4 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<Bot::IRC> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L<GitHub|https://github.com/gryphonshafer/Bot-IRC-X-Dice> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L<MetaCPAN|https://metacpan.org/pod/Bot::IRC::X::Dice> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L<GitHub Actions|https://github.com/gryphonshafer/Bot-IRC-X-Dice/actions> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L<Codecov|https://codecov.io/gh/gryphonshafer/Bot-IRC-X-Dice> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L<CPANTS|http://cpants.cpanauthors.org/dist/Bot-IRC-X-Dice> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L<CPAN Testers|http://www.cpantesters.org/distro/T/Bot-IRC-X-Dice.html> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=for Pod::Coverage init |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Gryphon Shafer <gryphon@cpan.org> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This software is Copyright (c) 2016-2050 by Gryphon Shafer. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software, licensed under: |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |