mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 04:23:13 +00:00
fade6a8d2e
This documents what we actually want and allows us to shift the logic to the network
28 lines
664 B
TypeScript
28 lines
664 B
TypeScript
import {IrcEventHandler} from "../../client";
|
|
|
|
import Msg, {MessageType} from "../../models/msg";
|
|
|
|
export default <IrcEventHandler>function (irc, network) {
|
|
const client = this;
|
|
|
|
irc.on("loggedin", (data) => {
|
|
const lobby = network.getLobby();
|
|
|
|
const msg = new Msg({
|
|
type: MessageType.LOGIN,
|
|
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
text: "Logged in as: " + data.account,
|
|
});
|
|
lobby.pushMessage(client, msg, true);
|
|
});
|
|
|
|
irc.on("loggedout", () => {
|
|
const lobby = network.getLobby();
|
|
|
|
const msg = new Msg({
|
|
type: MessageType.LOGOUT,
|
|
text: "Logged out",
|
|
});
|
|
lobby.pushMessage(client, msg, true);
|
|
});
|
|
};
|