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