ggejs
Version:
A powerful JavaScript library for interacting with the server of Goodgame Empire: Four Kingdoms
20 lines (18 loc) • 606 B
JavaScript
const {parseChatJSONMessage} = require("../tools/TextValide");
class ChatMessage {
/**
* @param {Client} client
* @param {{MT: string, MA: number, PID: number, PN: string}} data
*/
constructor(client, data) {
/** @type {string} */
this.message = parseChatJSONMessage(data.MT);
/** @type {Date} */
this.sendDate = new Date(Date.now() - data.MA * 1000);
/** @type {number} */
this.senderPlayerId = data.PID;
/** @type {string} */
this.senderPlayerName = data.PN;
}
}
module.exports = ChatMessage;