2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2017-11-10 20:44:14 +00:00
|
|
|
const Msg = require("../../models/msg");
|
2016-02-12 11:24:13 +00:00
|
|
|
|
|
|
|
module.exports = function(irc, network) {
|
2017-11-10 20:44:14 +00:00
|
|
|
const client = this;
|
|
|
|
|
2016-02-12 11:24:13 +00:00
|
|
|
irc.on("invite", function(data) {
|
2017-11-10 20:44:14 +00:00
|
|
|
let chan = network.getChannel(data.channel);
|
|
|
|
|
2016-02-12 11:24:13 +00:00
|
|
|
if (typeof chan === "undefined") {
|
|
|
|
chan = network.channels[0];
|
|
|
|
}
|
|
|
|
|
2019-02-05 10:03:54 +00:00
|
|
|
const invitedYou = data.invited === irc.user.nick;
|
|
|
|
|
2017-11-10 20:44:14 +00:00
|
|
|
const msg = new Msg({
|
2016-02-12 11:24:13 +00:00
|
|
|
type: Msg.Type.INVITE,
|
2016-03-25 23:26:53 +00:00
|
|
|
time: data.time,
|
2017-11-10 20:44:14 +00:00
|
|
|
from: chan.getUser(data.nick),
|
2017-11-29 06:22:03 +00:00
|
|
|
target: chan.getUser(data.invited),
|
2016-03-25 23:26:53 +00:00
|
|
|
channel: data.channel,
|
2019-02-05 10:03:54 +00:00
|
|
|
highlight: invitedYou,
|
|
|
|
invitedYou: invitedYou,
|
2016-02-12 11:24:13 +00:00
|
|
|
});
|
2016-04-19 10:20:18 +00:00
|
|
|
chan.pushMessage(client, msg);
|
2016-02-12 11:24:13 +00:00
|
|
|
});
|
|
|
|
};
|