LinkUp-P2P-Chat/chatBot/includes/AudioMessage.js
2024-06-14 16:43:17 +03:00

24 lines
643 B
JavaScript

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