class TextMessage { public TextMessage(peerName, peerAvatar, topic, message, timestamp) { this.peerName = peerName; this.peerAvatar = peerAvatar; this.topic = topic; this.message = message; this.timestamp = timestamp; } public toJsonString() { return JSON.stringify({ type: 'message', name: this.peerName, message: this.message, avatar: this.peerAvatar, topic: this.topic, timestamp: this.timestamp }); } public static new(bot, message) { return new TextMessage(bot.botName, "", bot.currentTopic, message, Date.now()); } } export default TextMessage;