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

27 lines
561 B
JavaScript
Raw Normal View History

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