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