mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-10 09:42:18 +02:00
31 lines
661 B
TypeScript
31 lines
661 B
TypeScript
"use strict";
|
|
|
|
import Network from "../../models/network";
|
|
|
|
import Msg from "../../models/msg";
|
|
|
|
export default <IrcEventHandler>function (irc, network) {
|
|
const client = this;
|
|
|
|
irc.on("invite", function (data) {
|
|
let chan = network.getChannel(data.channel);
|
|
|
|
if (typeof chan === "undefined") {
|
|
chan = network.channels[0];
|
|
}
|
|
|
|
const invitedYou = data.invited === irc.user.nick;
|
|
|
|
const msg = new Msg({
|
|
type: MessageType.INVITE,
|
|
time: data.time,
|
|
from: chan.getUser(data.nick),
|
|
target: chan.getUser(data.invited),
|
|
channel: data.channel,
|
|
highlight: invitedYou,
|
|
invitedYou: invitedYou,
|
|
});
|
|
chan.pushMessage(client, msg);
|
|
});
|
|
};
|