2022-06-19 00:25:21 +00:00
|
|
|
import {IrcEventHandler} from "../../client";
|
2022-02-08 19:55:39 +00:00
|
|
|
|
2022-06-19 00:25:21 +00:00
|
|
|
import Msg, {MessageType} from "../../models/msg";
|
2022-02-08 19:55:39 +00:00
|
|
|
|
2022-06-19 00:25:21 +00:00
|
|
|
export default <IrcEventHandler>function (irc, network) {
|
2022-02-08 19:55:39 +00:00
|
|
|
const client = this;
|
|
|
|
|
|
|
|
irc.on("loggedin", (data) => {
|
|
|
|
const lobby = network.channels[0];
|
|
|
|
|
|
|
|
const msg = new Msg({
|
2022-06-19 00:25:21 +00:00
|
|
|
type: MessageType.LOGIN,
|
|
|
|
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
2022-02-08 19:55:39 +00:00
|
|
|
text: "Logged in as: " + data.account,
|
|
|
|
});
|
|
|
|
lobby.pushMessage(client, msg, true);
|
|
|
|
});
|
|
|
|
|
|
|
|
irc.on("loggedout", () => {
|
|
|
|
const lobby = network.channels[0];
|
|
|
|
|
|
|
|
const msg = new Msg({
|
2022-06-19 00:25:21 +00:00
|
|
|
type: MessageType.LOGOUT,
|
2022-02-08 19:55:39 +00:00
|
|
|
text: "Logged out",
|
|
|
|
});
|
|
|
|
lobby.pushMessage(client, msg, true);
|
|
|
|
});
|
|
|
|
};
|