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

27 lines
562 B
JavaScript
Raw Normal View History

"use strict";
const Msg = require("../../models/msg");
2016-02-12 12:24:13 +01:00
module.exports = function(irc, network) {
const client = this;
2016-02-12 12:24:13 +01:00
irc.on("invite", function(data) {
let chan = network.getChannel(data.channel);
2016-02-12 12:24:13 +01:00
if (typeof chan === "undefined") {
chan = network.channels[0];
}
const msg = new Msg({
2016-02-12 12:24:13 +01:00
type: Msg.Type.INVITE,
2016-03-26 00:26:53 +01:00
time: data.time,
from: chan.getUser(data.nick),
invited: chan.getUser(data.invited),
2016-03-26 00:26:53 +01:00
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
});
};