thelounge/src/plugins/irc-events/motd.js
2020-07-20 10:07:49 +03:00

30 lines
542 B
JavaScript

"use strict";
const Msg = require("../../models/msg");
module.exports = function (irc, network) {
const client = this;
irc.on("motd", function (data) {
const lobby = network.channels[0];
if (data.motd) {
const msg = new Msg({
type: Msg.Type.MONOSPACE_BLOCK,
command: "motd",
text: data.motd,
});
lobby.pushMessage(client, msg);
}
if (data.error) {
const msg = new Msg({
type: Msg.Type.MONOSPACE_BLOCK,
command: "motd",
text: data.error,
});
lobby.pushMessage(client, msg);
}
});
};