 # Configuration
 #   HUBOT_DARK_SKY_API_KEY
 #   HUBOT_DARK_SKY_DEFAULT_LOCATION
-#   HUBOT_DARK_SKY_UNITS (optional - us, si, ca, or uk)
+#   HUBOT_DARK_SKY_SEPARATOR (optional - defaults to "\n")
 #
 # Commands:
 #   hubot weather - Get the weather for HUBOT_DARK_SKY_DEFAULT_LOCATION

        if result.results.length > 0
          lat = result.results[0].geometry.location.lat
          lng = result.results[0].geometry.location.lng
          darkSkyMe msg, lat,lng , (darkSkyText) ->
            response = "Weather for #{result.results[0].formatted_address}\n#{darkSkyText}"
            msg.send response
        else
          msg.send "Couldn't find #{location}"

darkSkyMe = (msg, lat, lng, cb) ->
  url = "https://api.forecast.io/forecast/#{process.env.HUBOT_DARK_SKY_API_KEY}/#{lat},#{lng}/"
  if process.env.HUBOT_DARK_SKY_UNITS
    url += "?units=#{process.env.HUBOT_DARK_SKY_UNITS}"
  msg.http(url)
    .get() (err, res, body) ->
      result = JSON.parse(body)

        cb "#{result.error}"
        return

      response = "Currently: #{result.currently.summary} #{result.currently.temperature}°C"
      response += "#{separator}Today: #{result.hourly.summary}"
      response += "#{separator}Coming week: #{result.daily.summary}"
      cb response
