Method: Lita::Handlers::Meme#reply

Defined in:
lib/lita/handlers/meme.rb

#reply(meme_id, match, response) ⇒ Object



52
53
54
55
56
57
# File 'lib/lita/handlers/meme.rb', line 52

def reply(meme_id, match, response)
  endpoint = "https://api.imgflip.com/caption_image"
  data = { template_id: meme_id, text0: match[1], text1: match[2], username: config.username, password: config.password }
  json = JSON.parse(http.post(endpoint, data).body)
  response.reply(json["data"]["url"]) if json["success"]
end