mirror of
https://github.com/thelounge/thelounge
synced 2024-12-24 11:23:07 +00:00
22 lines
479 B
JavaScript
22 lines
479 B
JavaScript
var Chan = require("../models/chan");
|
|
var Msg = require("../models/msg");
|
|
|
|
module.exports = function(client, sockets) {
|
|
var network = this;
|
|
client.on("motd", function(data) {
|
|
var rows = data.motd;
|
|
var chan = network.channels[0];
|
|
rows.forEach(function(text) {
|
|
var msg = new Msg({
|
|
type: "motd",
|
|
from: "-!-",
|
|
text: text,
|
|
});
|
|
chan.addMsg(msg);
|
|
sockets.in("chat").emit("msg", {
|
|
id: chan.id,
|
|
msg: msg,
|
|
});
|
|
});
|
|
});
|
|
};
|