Sha256: b26ca8817010d5de685ae3f00ef6a641062f728293b46cf2aa91859bbcfc7add
Contents?: true
Size: 402 Bytes
Versions: 11
Compression:
Stored size: 402 Bytes
Contents
require 'calc' # Let fate decide! class Robut::Plugin::Pick include Robut::Plugin desc "pick <a>, <b>, <c>, ... - randomly selects one of the options" match /^pick (.*)/, :sent_to_me => true do |message| options = message.split(',').map { |s| s.strip } rsp = options[random(options.length)] reply("And the winner is... #{rsp}") if rsp end def random(c) rand(c) end end
Version data entries
11 entries across 11 versions & 2 rubygems