thelounge/server/plugins/irc-events/motd.ts

30 lines
604 B
TypeScript
Raw Normal View History

import {IrcEventHandler} from "../../client";
import Msg, {MessageType} from "../../models/msg";
2014-09-13 23:29:45 +02:00
export default <IrcEventHandler>function (irc, network) {
const client = this;
irc.on("motd", function (data) {
const lobby = network.getLobby();
if (data.motd) {
2018-02-13 12:05:49 +01:00
const msg = new Msg({
type: MessageType.MONOSPACE_BLOCK,
command: "motd",
2018-02-13 12:05:49 +01:00
text: data.motd,
});
2018-02-13 12:05:49 +01:00
lobby.pushMessage(client, msg);
}
if (data.error) {
const msg = new Msg({
type: MessageType.MONOSPACE_BLOCK,
command: "motd",
text: data.error,
2014-09-13 23:29:45 +02:00
});
lobby.pushMessage(client, msg);
}
2014-09-13 23:29:45 +02:00
});
};