thelounge/src/plugins/irc-events/motd.ts
2022-05-21 11:50:55 -07:00

32 lines
620 B
TypeScript

"use strict";
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);
}
});
};