forked from snxraven/LinkUp-P2P-Chat
handling user icons via HyperDrive
This commit is contained in:
@ -2,8 +2,8 @@ import Message from "./Message.js";
|
||||
import b4a from "b4a";
|
||||
|
||||
class IconMessage extends Message {
|
||||
constructor(peerName, peerAvatar, topic, timestamp) {
|
||||
super("icon", peerName, peerAvatar, topic, timestamp);
|
||||
constructor(peerName, peerAvatar, timestamp) {
|
||||
super("icon", peerName, peerAvatar, null, timestamp);
|
||||
}
|
||||
|
||||
toJsonString() {
|
||||
|
@ -10,7 +10,7 @@ class Message {
|
||||
toJson() {
|
||||
return {
|
||||
type: this.type,
|
||||
name: this.peerName,
|
||||
username: this.peerName,
|
||||
avatar: this.peerAvatar,
|
||||
topic: this.topic,
|
||||
timestamp: this.timestamp
|
||||
|
@ -1,21 +1,21 @@
|
||||
import Message from "./Message.js";
|
||||
|
||||
class TextMessage extends Message {
|
||||
constructor(peerName, peerAvatar, topic, timestamp, message) {
|
||||
super("message", peerName, peerAvatar, topic, timestamp);
|
||||
this.message = 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,
|
||||
});
|
||||
}
|
||||
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);
|
||||
}
|
||||
static new(bot, message) {
|
||||
return new TextMessage(bot.botName, bot.botAvatar, bot.currentTopic, Date.now(), message);
|
||||
}
|
||||
}
|
||||
|
||||
export default TextMessage;
|
||||
|
Reference in New Issue
Block a user