previous track cache

This commit is contained in:
Snowflake107 2021-06-13 22:42:58 +05:45
parent 397d7c7f30
commit cfb4aaac41

View file

@ -128,7 +128,7 @@ class Queue<T = unknown> {
async play(src?: Track, options: PlayOptions = {}): Promise<void> { async play(src?: Track, options: PlayOptions = {}): Promise<void> {
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);
const track = options.filtersUpdate ? this.current : src ?? this.tracks.shift(); const track = options.filtersUpdate && !options.immediate ? this.current : src ?? this.tracks.shift();
if (!track) return; if (!track) return;
if (!options.filtersUpdate) { if (!options.filtersUpdate) {