hardlounge/server/plugins/irc-events/motd.ts
Max Leiter dd05ee3a65
TypeScript and Vue 3 (#4559)
Co-authored-by: Eric Nemchik <eric@nemchik.com>
Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
2022-06-18 17:25:21 -07:00

30 lines
605 B
TypeScript

import {IrcEventHandler} from "../../client";
import Msg, {MessageType} from "../../models/msg";
export default <IrcEventHandler>function (irc, network) {
const client = this;
irc.on("motd", function (data) {
const lobby = network.channels[0];
if (data.motd) {
const msg = new Msg({
type: MessageType.MONOSPACE_BLOCK,
command: "motd",
text: data.motd,
});
lobby.pushMessage(client, msg);
}
if (data.error) {
const msg = new Msg({
type: MessageType.MONOSPACE_BLOCK,
command: "motd",
text: data.error,
});
lobby.pushMessage(client, msg);
}
});
};