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

30 lines
605 B
TypeScript
Raw Normal View History

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