3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00
dbot/modules/rc/rc.js
Douglas Gardner 184d70d3a7 add shizzle
2013-03-06 16:34:59 +00:00

23 lines
603 B
JavaScript

/**
* Module Name: RC
* Description: Relays UDP packets, intended for
* a feed of RecentChanges on a MediaWiki install.
*/
var dgram = require('dgram');
var rc = function(dbot) {
var server = dgram.createSocket("udp4");
server.on("message", function(msg, msginfo) {
var message = msg.toString();
console.log(message);
if (msginfo.address == dbot.config.rc.address) {
dbot.say(dbot.config.rc.server, dbot.config.rc.channel, message);
}
});
server.bind(dbot.config.rc.port);
};
exports.fetch = function(dbot) {
return new rc(dbot);
};