From 3de34e5e4a087376f2ffe364fc9640f26580357c Mon Sep 17 00:00:00 2001 From: Max Isom Date: Thu, 19 Mar 2020 17:22:22 -0500 Subject: [PATCH] Fix Queue.removeCurrent() --- src/services/natural-language-commands.ts | 1 + src/services/queue.ts | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/services/natural-language-commands.ts b/src/services/natural-language-commands.ts index af5ae0c..2fe610b 100644 --- a/src/services/natural-language-commands.ts +++ b/src/services/natural-language-commands.ts @@ -57,6 +57,7 @@ export default class { queue.removeCurrent(); if (isPlaying) { + queue.back(); await player.seek(oldPosition); } else { player.disconnect(); diff --git a/src/services/queue.ts b/src/services/queue.ts index c5c8722..70d9a58 100644 --- a/src/services/queue.ts +++ b/src/services/queue.ts @@ -19,7 +19,7 @@ export default class { private position = 0; forward(): void { - if (this.position <= this.size() + 1) { + if (this.position < this.size() + 1) { this.position++; } else { throw new Error('No songs in queue to forward to.'); @@ -85,10 +85,6 @@ export default class { removeCurrent(): void { this.queue = [...this.queue.slice(0, this.position), ...this.queue.slice(this.position + 1)]; - - if (this.position !== 0) { - this.position--; - } } size(): number {