better paused status
This commit is contained in:
parent
9e3b66ee8a
commit
580f4aa9c6
1 changed files with 4 additions and 3 deletions
|
@ -29,7 +29,6 @@ class BasicStreamDispatcher extends EventEmitter<VoiceEvents> {
|
||||||
public readonly channel: VoiceChannel | StageChannel;
|
public readonly channel: VoiceChannel | StageChannel;
|
||||||
public connectPromise?: Promise<void>;
|
public connectPromise?: Promise<void>;
|
||||||
public audioResource?: AudioResource<Track>;
|
public audioResource?: AudioResource<Track>;
|
||||||
public paused = false;
|
|
||||||
|
|
||||||
constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel) {
|
constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel) {
|
||||||
super();
|
super();
|
||||||
|
@ -118,13 +117,11 @@ class BasicStreamDispatcher extends EventEmitter<VoiceEvents> {
|
||||||
|
|
||||||
pause(interpolateSilence?: boolean) {
|
pause(interpolateSilence?: boolean) {
|
||||||
const success = this.audioPlayer.pause(interpolateSilence);
|
const success = this.audioPlayer.pause(interpolateSilence);
|
||||||
this.paused = success;
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
resume() {
|
resume() {
|
||||||
const success = this.audioPlayer.unpause();
|
const success = this.audioPlayer.unpause();
|
||||||
this.paused = !success;
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,6 +156,10 @@ class BasicStreamDispatcher extends EventEmitter<VoiceEvents> {
|
||||||
if (!this.audioResource) return 0;
|
if (!this.audioResource) return 0;
|
||||||
return this.audioResource.playbackDuration;
|
return this.audioResource.playbackDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get paused() {
|
||||||
|
return [AudioPlayerStatus.AutoPaused, AudioPlayerStatus.Paused].includes(this.audioPlayer.state.status)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { BasicStreamDispatcher as StreamDispatcher };
|
export { BasicStreamDispatcher as StreamDispatcher };
|
||||||
|
|
Loading…
Reference in a new issue