forked from GitHub/dbot
		
	that should learn it
This commit is contained in:
		
							parent
							
								
									aeea5a7e18
								
							
						
					
					
						commit
						e8f657de94
					
				@ -6,20 +6,24 @@
 | 
			
		||||
var dgram = require('dgram');
 | 
			
		||||
 | 
			
		||||
var udp = function(dbot) {
 | 
			
		||||
  var servers = [];
 | 
			
		||||
 | 
			
		||||
  _.each(dbot.config.modules.udp.servers, function(data) {
 | 
			
		||||
    var server = dgram.createSocket("udp4");
 | 
			
		||||
 | 
			
		||||
    server.on("message", function(msg, msginfo) {
 | 
			
		||||
        var message = msg.toString();
 | 
			
		||||
        if (msginfo.address == data.address) {
 | 
			
		||||
            dbot.say(data.server, data.channel, message);
 | 
			
		||||
        }
 | 
			
		||||
    }.bind(this));
 | 
			
		||||
    this.onLoad = function() {
 | 
			
		||||
      _.each(dbot.config.modules.udp.servers, function(data) {
 | 
			
		||||
        server.bind(data.port);
 | 
			
		||||
      });
 | 
			
		||||
    }.bind(this);
 | 
			
		||||
  }.bind(this));
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  this.onLoad = function() {
 | 
			
		||||
    _.each(servers, function(server) {
 | 
			
		||||
      server.bind(data.port);
 | 
			
		||||
    });
 | 
			
		||||
  }.bind(this);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.fetch = function(dbot) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user