3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +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) {
if(response.statusCode == "200") {
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);
score = Math.ceil(score);
if (score > 10) { score = 11; }
} else {
var score = "e";
}
event.reply(dbot.t("rain-"+score+"[ " + score + " ]"));
event.reply(dbot.t("rain-"+score));
});
}
};