LinkUp-P2P-Chat/chatBot/includes/TextMessage.js

22 lines
549 B
JavaScript
Raw Normal View History

2024-06-14 09:43:17 -04:00
import Message from "./Message.js";
class TextMessage extends Message {
constructor(peerName, peerAvatar, topic, timestamp, message) {
super("message", peerName, peerAvatar, topic, timestamp);
this.message = message;
}
2024-06-11 17:40:02 -04:00
toJsonString() {
return JSON.stringify({
2024-06-14 09:43:17 -04:00
...this.toJson(),
message: this.message,
});
}
2024-06-11 17:40:02 -04:00
static new(bot, message) {
2024-06-14 09:43:17 -04:00
return new TextMessage(bot.botName, bot.botAvatar, bot.currentTopic, Date.now(), message);
}
}
2024-06-11 17:40:02 -04:00
export default TextMessage;