11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/lita/handlers/onewheel_moonphase.rb', line 11
def moon(response)
location = response.matches[0][0]
if location.empty?
location = '45.5230622,-122.6764816'
end
Lita.logger.debug "Getting Moon data for #{location}"
uri = "https://j8jqi56gye.execute-api.us-west-2.amazonaws.com/prod/moon?loc=#{URI.encode location}"
Lita.logger.debug uri
moon = JSON.parse(RestClient.get(uri))
reply = "Moon phase #{moon['moondata']['fracillum']}, #{moon['moondata']['curphase']}."
Lita.logger.debug "Replying with #{reply}"
response.reply reply
end
|