implement back method to play previous track
This commit is contained in:
parent
fec70a25a1
commit
2e75728d11
1 changed files with 4 additions and 0 deletions
|
@ -115,6 +115,10 @@ class Queue<T = unknown> {
|
||||||
return this.connection.volume;
|
return this.connection.volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async back() {
|
||||||
|
return await this.play(Util.last(this.previousTracks), { immediate: true });
|
||||||
|
}
|
||||||
|
|
||||||
async play(src?: Track, options: PlayOptions = {}) {
|
async play(src?: Track, options: PlayOptions = {}) {
|
||||||
if (!this.connection || !this.connection.voiceConnection) throw new Error("Voice connection is not available, use <Queue>.connect()!");
|
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);
|
if (src && (this.playing || this.tracks.length) && !options.immediate) return this.addTrack(src);
|
||||||
|
|
Loading…
Reference in a new issue