script/pug.rb in boty-0.0.14 vs script/pug.rb in boty-0.0.15

- old
+ new

@@ -1,12 +1,12 @@ desc "pug me", I18n.t("scripts.pug_me") -respond(/pug me/i) do - response = JSON.parse Net::HTTP.get(URI "http://pugme.herokuapp.com/random") +command(/pug me/i) do + response = http.get "http://pugme.herokuapp.com/random" say "<#{response["pug"]}>" end desc "pug bomb X", I18n.t("scripts.pug_bomb") -respond(/pug bomb( (\d+))?/i) do |message| - count = message.match[2] || 5 - response = JSON.parse Net::HTTP.get(URI "http://pugme.herokuapp.com/bomb?count=#{count}") +command(/pug bomb( \d+)?/i) do |count| + count = (count || "5").strip + response = http.get "http://pugme.herokuapp.com/bomb", count: count response["pugs"].each do |pug| say "<#{pug}>" end end