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

23 lines
486 B
JavaScript
Raw Normal View History

2014-06-29 19:41:02 +00:00
var Msg = require("../../models/msg");
module.exports = function(irc, network) {
var client = this;
irc.on("notice", function(data) {
var lobby = network.channels[0];
2014-06-30 01:20:54 +00:00
var from = data.from || "";
2014-06-29 19:41:02 +00:00
if (data.to == "*" || data.from.indexOf(".") !== -1) {
2014-06-30 01:20:54 +00:00
from = "";
2014-06-29 19:41:02 +00:00
}
var msg = new Msg({
type: Msg.Type.NOTICE,
from: from,
text: data.message
});
lobby.messages.push(msg);
client.emit("msg", {
chan: lobby.id,
msg: msg
});
});
2014-06-26 23:05:47 +00:00
};