don't recall
This commit is contained in:
parent
0d053da481
commit
6b878c6143
2 changed files with 10 additions and 3 deletions
|
@ -13,6 +13,7 @@ use POE;
|
|||
use List::Util qw/reduce/;
|
||||
use Math::Random::MT;
|
||||
use Random::Quantum;
|
||||
use Data::Dumper;
|
||||
|
||||
print "Seeding the PRNG from Quantum Source\n";
|
||||
my $cl = new Random::Quantum(user => 'simcop2387', 'password' => 'sindarin');
|
||||
|
@ -47,6 +48,10 @@ sub said {
|
|||
if ($body =~ /^!dice\s*(?:(\d+)d(\d+))?/) {
|
||||
my ($dice, $sides) = ($1, $2);
|
||||
$dice ||= 1; $sides ||= 6;
|
||||
if ($dice >= 31) {
|
||||
$self->reply($message, _frm "Can't use that many dice!");
|
||||
return;
|
||||
}
|
||||
|
||||
my @a = map {int($gen->rand($sides)+1)} (1..$dice);
|
||||
my $sum = reduce {$a + $b} @a;
|
||||
|
@ -54,6 +59,7 @@ sub said {
|
|||
|
||||
if ($dice == 1) {$msg = "You rolled a $sum";}
|
||||
else {$msg = "You rolled ".join(" + ", @a)." = $sum";}
|
||||
print "DICE ROLL: ", $msg, "\n";
|
||||
$self->reply($message, _frm $msg);
|
||||
}
|
||||
|
||||
|
|
7
main.pl
7
main.pl
|
@ -9,7 +9,8 @@ use CDBot;
|
|||
|
||||
CDBot->new(
|
||||
channels => [ '#minimafia' ],
|
||||
nick => 'simcop2387-rizon',
|
||||
password => 'sindarin',
|
||||
server => 'localhost',
|
||||
nick => 'countdownbot',
|
||||
# password => 'sindarin',
|
||||
server => 'irc.rizon.net',
|
||||
# port => 6668,
|
||||
)->run
|
||||
|
|
Loading…
Add table
Reference in a new issue