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

30 lines
535 B
JavaScript
Raw Normal View History

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