24 lines
643 B
JavaScript
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;
|