mirror of
				https://github.com/reality/dbot.git
				synced 2025-10-31 06:37:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			651 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			651 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Module Name: Rain
 | |
|  * Description: Quietly judges your choice of climate. 
 | |
|  */
 | |
| var request = require('request'),
 | |
|     _ = require('underscore')._;
 | |
| 
 | |
| var rain = function(dbot) {
 | |
|     var commands = {
 | |
|         '~rain': function(event) {
 | |
|             var apikey = dbot.config.rain.apikey;
 | |
|             var precip = event.params[1];
 | |
|             var score = 2 * Math.pow(precip,0.5); 
 | |
|             score = Math.ceil(score);
 | |
|             if (score > 10) { score = 11; }
 | |
|             event.reply(dbot.t("rain-"+score));
 | |
|         }
 | |
|     };
 | |
| 
 | |
|     this.commands = commands;
 | |
|     this.on = 'PRIVMSG';
 | |
| 
 | |
| };
 | |
| 
 | |
| exports.fetch = function(dbot) {
 | |
|     return new rain(dbot);
 | |
| };
 | 
