aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-14 23:24:21 +1200
committerDavid Phillips <david@sighup.nz>2018-09-14 23:29:35 +1200
commit09f1ca71c2652a029577d23b615c1ebfb8d27f71 (patch)
treeff5a64fe789e3953bcdc345ca8db29cace126280 /Plugin
parentf3f894f685292bfc427f93df2eb9a71fda8ae669 (diff)
downloadidalius-09f1ca71c2652a029577d23b615c1ebfb8d27f71.tar.xz
Rename Shuffle to Random, add choose command
Diffstat (limited to 'Plugin')
-rw-r--r--Plugin/Random.pm (renamed from Plugin/Shuffle.pm)8
1 files changed, 7 insertions, 1 deletions
diff --git a/Plugin/Shuffle.pm b/Plugin/Random.pm
index dc39898..bd1c4d2 100644
--- a/Plugin/Shuffle.pm
+++ b/Plugin/Random.pm
@@ -1,4 +1,4 @@
-package Plugin::Shuffle;
+package Plugin::Random;
use strict;
use warnings;
@@ -14,6 +14,7 @@ sub configure {
%config = %$cref;
$cmdref->("shuffle", sub { $self->shuffle(@_); } );
+ $cmdref->("choose", sub { $self->choose(@_); } );
return $self;
}
@@ -23,4 +24,9 @@ sub shuffle {
return join " ", List::Util::shuffle(@arguments);
}
+
+sub choose {
+ my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ return (List::Util::shuffle(@arguments))[0];
+}
1;