thelounge/src/plugins/irc-events/invite.js

25 lines
526 B
JavaScript
Raw Normal View History

"use strict";
2016-02-12 12:24:13 +01:00
var Msg = require("../../models/msg");
module.exports = function(irc, network) {
var client = this;
irc.on("invite", function(data) {
2016-03-20 15:28:47 +01:00
var chan = network.getChannel(data.channel);
2016-02-12 12:24:13 +01:00
if (typeof chan === "undefined") {
chan = network.channels[0];
}
var msg = new Msg({
type: Msg.Type.INVITE,
2016-03-26 00:26:53 +01:00
time: data.time,
from: data.nick,
invited: data.invited,
channel: data.channel,
highlight: true,
invitedYou: data.invited === irc.user.nick,
2016-02-12 12:24:13 +01:00
});
chan.pushMessage(client, msg);
2016-02-12 12:24:13 +01:00
});
};