2022-06-18 16:25:21 -08:00
|
|
|
import {IrcEventHandler} from "../../client";
|
2016-10-09 15:14:02 -04:00
|
|
|
|
2022-06-18 16:25:21 -08:00
|
|
|
import Msg, {MessageType} from "../../models/msg";
|
2014-09-13 14:29:45 -07:00
|
|
|
|
2022-06-18 16:25:21 -08:00
|
|
|
export default <IrcEventHandler>function (irc, network) {
|
2017-11-10 22:44:14 +02:00
|
|
|
const client = this;
|
|
|
|
|
2020-03-21 22:55:36 +02:00
|
|
|
irc.on("motd", function (data) {
|
2017-11-10 22:44:14 +02:00
|
|
|
const lobby = network.channels[0];
|
2016-03-07 23:09:42 +02:00
|
|
|
|
|
|
|
if (data.motd) {
|
2018-02-13 13:05:49 +02:00
|
|
|
const msg = new Msg({
|
2022-06-18 16:25:21 -08:00
|
|
|
type: MessageType.MONOSPACE_BLOCK,
|
2020-06-29 10:51:17 +03:00
|
|
|
command: "motd",
|
2018-02-13 13:05:49 +02:00
|
|
|
text: data.motd,
|
2016-03-07 23:09:42 +02:00
|
|
|
});
|
2018-02-13 13:05:49 +02:00
|
|
|
lobby.pushMessage(client, msg);
|
2016-03-07 23:09:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data.error) {
|
2017-11-10 22:44:14 +02:00
|
|
|
const msg = new Msg({
|
2022-06-18 16:25:21 -08:00
|
|
|
type: MessageType.MONOSPACE_BLOCK,
|
2020-06-29 10:51:17 +03:00
|
|
|
command: "motd",
|
2017-11-15 01:35:15 -05:00
|
|
|
text: data.error,
|
2014-09-13 14:29:45 -07:00
|
|
|
});
|
2016-04-19 13:20:18 +03:00
|
|
|
lobby.pushMessage(client, msg);
|
2016-03-07 23:09:42 +02:00
|
|
|
}
|
2014-09-13 14:29:45 -07:00
|
|
|
});
|
|
|
|
};
|