Sha256: 249bcf2a182e2b7614dc519d3b91abd151b6bfc8b6251c49d583ab143513d376

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module Lita
  module Handlers
    # s/chatbot/chatbutt/
    class Butt < Handler
      # insert handler code here
      route(/^b(u*)tt(s?)/, :butt, help: { 'butt' => '(_)_)' })

      def butt(response)
        groups = response.matches.first
        width = groups.first.size

        bottom = '_' * width
        butt = "(#{bottom})#{bottom})"

        if groups.last == 's'
          response.reply [butt, butt].join ' '
        else
          response.reply butt
        end
      end

      Lita.register_handler(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-butt-0.1.1 lib/lita/handlers/butt.rb