22 lines
505 B
JavaScript
22 lines
505 B
JavaScript
import Message from "./Message.js";
|
|
|
|
class TextMessage extends Message {
|
|
constructor(peerName, peerAvatar, topic, timestamp, message) {
|
|
super("message", peerName, peerAvatar, topic, timestamp);
|
|
this.message = message;
|
|
}
|
|
|
|
toJsonString() {
|
|
return JSON.stringify({
|
|
...this.toJson(),
|
|
message: this.message,
|
|
});
|
|
}
|
|
|
|
static new(bot, message) {
|
|
return new TextMessage(bot.botName, bot.botAvatar, bot.currentTopic, Date.now(), message);
|
|
}
|
|
}
|
|
|
|
export default TextMessage;
|