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