3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 22:39:26 +01:00

it was raining cats and dogs; there were poodles all over the road

This commit is contained in:
Douglas Gardner 2013-01-30 12:43:17 +00:00
parent 0e9827a2fc
commit c9161c10ae

View File

@ -14,14 +14,14 @@ var rain = function(dbot) {
request(url, function(error, response, body) { request(url, function(error, response, body) {
if(response.statusCode == "200") { if(response.statusCode == "200") {
var data = JSON.parse(body); var data = JSON.parse(body);
var precip = data["precip_1hr_metric"]; var precip = data["current_observation"]["precip_1hr_metric"];
var score = 2 * Math.pow(precip,0.5); var score = 2 * Math.pow(precip,0.5);
score = Math.ceil(score); score = Math.ceil(score);
if (score > 10) { score = 11; } if (score > 10) { score = 11; }
} else { } else {
var score = "e"; var score = "e";
} }
event.reply(dbot.t("rain-"+score+"[ " + score + " ]")); event.reply(dbot.t("rain-"+score));
}); });
} }
}; };