From 2e75728d11e9497f25766817eed650183a9e93d3 Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Sun, 13 Jun 2021 18:31:15 +0545 Subject: [PATCH] implement back method to play previous track --- src/Structures/Queue.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index 4a9cdfa..e978785 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -115,6 +115,10 @@ class Queue { return this.connection.volume; } + async back() { + return await this.play(Util.last(this.previousTracks), { immediate: true }); + } + async play(src?: Track, options: PlayOptions = {}) { if (!this.connection || !this.connection.voiceConnection) throw new Error("Voice connection is not available, use .connect()!"); if (src && (this.playing || this.tracks.length) && !options.immediate) return this.addTrack(src);