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

24 lines
664 B
JavaScript
Raw Normal View History

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