thelounge/lib/plugins/motd.js

32 lines
618 B
JavaScript
Raw Normal View History

2014-06-19 17:28:53 +02:00
var Chan = require("../models/chan");
var Msg = require("../models/msg");
2014-06-23 19:28:36 +02:00
module.exports = function(slate, network) {
var client = this;
slate.on("motd", function(data) {
2014-06-19 17:28:53 +02:00
var rows = data.motd;
var chan = network.channels[0];
2014-06-20 02:26:48 +02:00
var msg = new Msg({
type: "motd-toggle",
from: "-!-"
});
chan.addMsg(msg);
2014-06-23 19:28:36 +02:00
client.emit("msg", {
2014-06-20 02:26:48 +02:00
id: chan.id,
msg: msg,
});
2014-06-19 17:28:53 +02:00
rows.forEach(function(text) {
var msg = new Msg({
type: "motd",
from: "-!-",
text: text,
});
chan.addMsg(msg);
2014-06-23 19:28:36 +02:00
client.emit("msg", {
2014-06-19 17:28:53 +02:00
id: chan.id,
msg: msg,
});
});
});
};