Sha256: 64011bad153fc90fb673a511520420a0e82ac5ee68351f5ac82f5522756ad18a

Contents?: true

Size: 415 Bytes

Versions: 3

Compression:

Stored size: 415 Bytes

Contents

require "lita"

module Lita
  module Handlers
    class Coin < Handler
      route(/^(?:flip|toss)\s+a\s+coin/i, :flip, command: true, help: {
        "flip a coin" => "Flips a coin and tells you the results."
      })

      route(/^coin\s+(?:toss|flip)/i, :flip, command: true)

      def flip(response)
        response.reply %w(Heads! Tails!).sample
      end
    end

    Lita.register_handler(Coin)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lita-coin-0.0.3 lib/lita/handlers/coin.rb
lita-coin-0.0.2 lib/lita/handlers/coin.rb
lita-coin-0.0.1 lib/lita/handlers/coin.rb