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-11 14:47:42 -04:00
|
|
|
|
2024-06-14 15:09:54 -04:00
|
|
|
toJsonString() {
|
|
|
|
return JSON.stringify({
|
|
|
|
...this.toJson(),
|
|
|
|
message: this.message,
|
|
|
|
});
|
|
|
|
}
|
2024-06-11 14:47:42 -04:00
|
|
|
|
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-10 14:34:50 -04:00
|
|
|
}
|
|
|
|
|
2024-06-11 17:40:02 -04:00
|
|
|
export default TextMessage;
|