lib/lita/handlers/butt.rb in lita-butt-0.1.0 vs lib/lita/handlers/butt.rb in lita-butt-0.1.1
- old
+ new
@@ -1,16 +1,23 @@
module Lita
module Handlers
# s/chatbot/chatbutt/
class Butt < Handler
# insert handler code here
- route(/^b(u*)tt/, :butt, help: { 'butt' => '(_)_)' })
+ route(/^b(u*)tt(s?)/, :butt, help: { 'butt' => '(_)_)' })
def butt(response)
groups = response.matches.first
width = groups.first.size
- response.reply "(#{'_' * width})#{'_' * width})"
+ 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