3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 06:19:24 +01:00

that should learn it

This commit is contained in:
reality 2016-05-07 16:29:18 +00:00
parent aeea5a7e18
commit e8f657de94

View File

@ -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) {
_.each(servers, function(server) {
server.bind(data.port);
});
}.bind(this);
}.bind(this));
};
exports.fetch = function(dbot) {