aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2020-12-28 12:02:23 +1300
committerDavid Phillips <david@yeah.nah.nz>2020-12-28 12:03:20 +1300
commite22bcfc0c5c6aa5f9d64e2ce2db2f47a0b194016 (patch)
tree53a9de7511a265a7195248c35b51aa4eddc1fbbb
parent26ce84ffb9875747896104d99c9fc29a29cc918e (diff)
downloadidalius-e22bcfc0c5c6aa5f9d64e2ce2db2f47a0b194016.tar.xz
Random: add 8ball commanddevel
-rw-r--r--Plugin/Random.pm34
1 files changed, 33 insertions, 1 deletions
diff --git a/Plugin/Random.pm b/Plugin/Random.pm
index 26d5250..03a050b 100644
--- a/Plugin/Random.pm
+++ b/Plugin/Random.pm
@@ -11,10 +11,15 @@ sub configure {
$cmdref->($self, "shuffle", sub { $self->shuffle(@_); } );
$cmdref->($self, "choose", sub { $self->choose(@_); } );
+ $cmdref->($self, "8ball", sub { $self->eight_ball(@_); } );
return $self;
}
+sub _choose {
+ return (List::Util::shuffle(@_))[0];
+}
+
sub shuffle {
my ($self, $irc, $logger, $who, $where, $ided, $rest, $no_reenter, @arguments) = @_;
@@ -23,6 +28,33 @@ sub shuffle {
sub choose {
my ($self, $irc, $logger, $who, $where, $ided, $rest, $no_reenter, @arguments) = @_;
- return (List::Util::shuffle(@arguments))[0];
+ return _choose(@arguments);
+}
+
+sub eight_ball {
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, $no_reenter, @arguments) = @_;
+ my @responses = (
+ "It is certain.",
+ "Without a doubt.",
+ "You may rely on it",
+ "Yes. Definitely.",
+ "It is decidedly so.",
+ "As I see it, yes.",
+ "Most likely.",
+ "Yes.",
+ "Outlook good.",
+ "Signs point to yes.",
+ "Reply hazy, try again.",
+ "Better not tell you now.",
+ "Ask again later.",
+ "Cannot predict now.",
+ "Concentrate and ask again.",
+ "Don't count on it.",
+ "Outlook not so good.",
+ "My sources say no.",
+ "Very doubtful.",
+ "My reply is no.",
+ );
+ return _choose(@responses);
}
1;