mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 04:23:13 +00:00
fade6a8d2e
This documents what we actually want and allows us to shift the logic to the network
29 lines
604 B
TypeScript
29 lines
604 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.getLobby();
|
|
|
|
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);
|
|
}
|
|
});
|
|
};
|