2022-06-19 00:25:21 +00:00
|
|
|
import {IrcEventHandler} from "../../client";
|
2022-02-08 19:55:39 +00:00
|
|
|
|
2024-02-15 22:01:22 +00:00
|
|
|
import Msg from "../../models/msg";
|
|
|
|
import {MessageType} from "../../../shared/types/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) => {
|
2023-02-27 17:30:33 +00:00
|
|
|
const lobby = network.getLobby();
|
2022-02-08 19:55:39 +00:00
|
|
|
|
|
|
|
const msg = new Msg({
|
2022-06-19 00:25:21 +00:00
|
|
|
type: MessageType.LOGIN,
|
2022-02-08 19:55:39 +00:00
|
|
|
text: "Logged in as: " + data.account,
|
|
|
|
});
|
|
|
|
lobby.pushMessage(client, msg, true);
|
|
|
|
});
|
|
|
|
|
|
|
|
irc.on("loggedout", () => {
|
2023-02-27 17:30:33 +00:00
|
|
|
const lobby = network.getLobby();
|
2022-02-08 19:55:39 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
};
|