Class: Lita::Handlers::Catme

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/catme.rb

Instance Method Summary collapse

Instance Method Details

#cat_bomb(response) ⇒ Object



13
14
15
16
17
18
# File 'lib/lita/handlers/catme.rb', line 13

def cat_bomb(response)
  count = (response.args[1] || 5).to_i
  count = 20 if count > 20

  Cat.fetch(count: count).each { |cat| response.reply(cat.url) }
end

#cat_categories(response) ⇒ Object



20
21
22
# File 'lib/lita/handlers/catme.rb', line 20

def cat_categories(response)
  Cat.fetch_categories.each { |category| response.reply(category) }
end

#cat_me(response) ⇒ Object



9
10
11
# File 'lib/lita/handlers/catme.rb', line 9

def cat_me(response)
  response.reply(Cat.fetch.first.url)
end

#cat_with_category(response) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/lita/handlers/catme.rb', line 24

def cat_with_category(response)
  if cat = Cat.fetch(category: response.args[1]).first
    response.reply(cat.url)
  else
    response.reply(t('cat_with_category.unrecognized_category'))
  end
end