Class: Lita::Handlers::Dogebomb
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Dogebomb
- Defined in:
- lib/lita/handlers/dogebomb.rb
Constant Summary collapse
- BASE_URL =
"http://dogeme.rowanmanning.com"
Instance Method Summary collapse
Instance Method Details
#bomb(response) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/lita/handlers/dogebomb.rb', line 17 def bomb(response) count = response.matches[0][1] || 5 data = MultiJson.load(http.get(BASE_URL + "/bomb", count: count).body) data['doges'].each do |doge| response.reply doge end end |
#count(response) ⇒ Object
25 26 27 28 29 |
# File 'lib/lita/handlers/dogebomb.rb', line 25 def count(response) data = MultiJson.load(http.get(BASE_URL + "/count").body) doge_count = data['doge_count'] response.reply "There are #{doge_count} doges." end |
#doge(response) ⇒ Object
12 13 14 15 |
# File 'lib/lita/handlers/dogebomb.rb', line 12 def doge(response) data = MultiJson.load(http.get(BASE_URL + "/random").body) response.reply data['doge'] end |