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

22 lines
505 B
JavaScript
Raw Normal View History

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