2024-06-14 09:43:17 -04:00
|
|
|
import Message from "./Message.js";
|
|
|
|
|
|
|
|
class AudioMessage extends Message {
|
2024-06-15 02:52:20 -04:00
|
|
|
constructor(peerName, peerAvatar, topic, timestamp, audioUrl, audioType) {
|
2024-06-14 09:43:17 -04:00
|
|
|
super("audio", peerName, peerAvatar, topic, timestamp);
|
2024-06-15 02:52:20 -04:00
|
|
|
this.audioUrl = audioUrl;
|
2024-06-14 09:43:17 -04:00
|
|
|
this.audioType = audioType;
|
|
|
|
}
|
|
|
|
|
|
|
|
toJsonString() {
|
|
|
|
return JSON.stringify({
|
|
|
|
...this.toJson(),
|
2024-06-15 02:52:20 -04:00
|
|
|
audioUrl: this.audioUrl,
|
2024-06-14 09:43:17 -04:00
|
|
|
audioType: this.audioType
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-06-15 02:52:20 -04:00
|
|
|
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;
|