2016-10-09 15:14:02 -04:00
|
|
|
"use strict";
|
|
|
|
|
2014-09-13 17:29:45 -04:00
|
|
|
var Msg = require("../../models/msg");
|
|
|
|
|
|
|
|
module.exports = function(irc, network) {
|
|
|
|
var client = this;
|
|
|
|
irc.on("motd", function(data) {
|
|
|
|
var lobby = network.channels[0];
|
2016-03-07 16:09:42 -05:00
|
|
|
|
|
|
|
if (data.motd) {
|
2017-04-08 08:34:31 -04:00
|
|
|
data.motd.split("\n").forEach((text) => {
|
2016-03-07 16:09:42 -05:00
|
|
|
var msg = new Msg({
|
|
|
|
type: Msg.Type.MOTD,
|
2017-11-15 01:35:15 -05:00
|
|
|
text: text,
|
2016-03-07 16:09:42 -05:00
|
|
|
});
|
2016-04-19 06:20:18 -04:00
|
|
|
lobby.pushMessage(client, msg);
|
2016-03-07 16:09:42 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.error) {
|
2014-09-13 17:29:45 -04:00
|
|
|
var msg = new Msg({
|
|
|
|
type: Msg.Type.MOTD,
|
2017-11-15 01:35:15 -05:00
|
|
|
text: data.error,
|
2014-09-13 17:29:45 -04:00
|
|
|
});
|
2016-04-19 06:20:18 -04:00
|
|
|
lobby.pushMessage(client, msg);
|
2016-03-07 16:09:42 -05:00
|
|
|
}
|
2014-09-13 17:29:45 -04:00
|
|
|
});
|
|
|
|
};
|