implement back method to play previous track

This commit is contained in:
Snowflake107 2021-06-13 18:31:15 +05:45
parent fec70a25a1
commit 2e75728d11

View file

@ -115,6 +115,10 @@ class Queue<T = unknown> {
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 <Queue>.connect()!");
if (src && (this.playing || this.tracks.length) && !options.immediate) return this.addTrack(src);