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

26 lines
747 B
JavaScript
Raw Normal View History

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