From 580f4aa9c6576ca0f36ff8fb3647267c628f7519 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Sun, 13 Jun 2021 16:13:02 +0545 Subject: [PATCH] better paused status --- src/VoiceInterface/BasicStreamDispatcher.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/VoiceInterface/BasicStreamDispatcher.ts b/src/VoiceInterface/BasicStreamDispatcher.ts index 7bf8544..91301be 100644 --- a/src/VoiceInterface/BasicStreamDispatcher.ts +++ b/src/VoiceInterface/BasicStreamDispatcher.ts @@ -29,7 +29,6 @@ class BasicStreamDispatcher extends EventEmitter { public readonly channel: VoiceChannel | StageChannel; public connectPromise?: Promise; public audioResource?: AudioResource; - public paused = false; constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel) { super(); @@ -118,13 +117,11 @@ class BasicStreamDispatcher extends EventEmitter { pause(interpolateSilence?: boolean) { const success = this.audioPlayer.pause(interpolateSilence); - this.paused = success; return success; } resume() { const success = this.audioPlayer.unpause(); - this.paused = !success; return success; } @@ -159,6 +156,10 @@ class BasicStreamDispatcher extends EventEmitter { if (!this.audioResource) return 0; return this.audioResource.playbackDuration; } + + get paused() { + return [AudioPlayerStatus.AutoPaused, AudioPlayerStatus.Paused].includes(this.audioPlayer.state.status) + } } export { BasicStreamDispatcher as StreamDispatcher };