thelounge/src/plugins/irc-events/motd.js

29 lines
515 B
JavaScript
Raw Normal View History

"use strict";
2014-09-13 23:29:45 +02:00
var Msg = require("../../models/msg");
module.exports = function(irc, network) {
var client = this;
irc.on("motd", function(data) {
var lobby = network.channels[0];
if (data.motd) {
data.motd.split("\n").forEach((text) => {
var msg = new Msg({
type: Msg.Type.MOTD,
text: text
});
lobby.pushMessage(client, msg);
});
}
if (data.error) {
2014-09-13 23:29:45 +02:00
var msg = new Msg({
type: Msg.Type.MOTD,
text: data.error
2014-09-13 23:29:45 +02:00
});
lobby.pushMessage(client, msg);
}
2014-09-13 23:29:45 +02:00
});
};