2013-01-30 13:12:10 +01:00
|
|
|
/**
|
2013-01-30 13:21:46 +01:00
|
|
|
* Module Name: Rain
|
|
|
|
* Description: Quietly judges your choice of climate.
|
2013-01-30 13:12:10 +01:00
|
|
|
*/
|
|
|
|
var request = require('request'),
|
|
|
|
_ = require('underscore')._;
|
|
|
|
|
|
|
|
var rain = function(dbot) {
|
|
|
|
var commands = {
|
|
|
|
'~rain': function(event) {
|
|
|
|
var precip = event.params[1];
|
|
|
|
var score = 2 * Math.pow(precip,0.5);
|
|
|
|
score = Math.ceil(score);
|
2013-01-30 13:21:46 +01:00
|
|
|
if (score > 10) { score = 11; }
|
|
|
|
event.reply(dbot.t("rain-"+score));
|
2013-01-30 13:12:10 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
this.commands = commands;
|
|
|
|
this.on = 'PRIVMSG';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return new rain(dbot);
|
|
|
|
};
|