From a0badb849d75d7b4401b3e7d402429ea61f0f1c6 Mon Sep 17 00:00:00 2001 From: DevAndromeda <46562212+DevAndromeda@users.noreply.github.com> Date: Sun, 17 Oct 2021 13:09:30 +0545 Subject: [PATCH] feat(Queue): add spotifyBridge option --- src/Structures/Queue.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index a2f65f1..081ad2f 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -639,16 +639,18 @@ class Queue { const customDownloader = typeof this.onBeforeCreateStream === "function"; if (["youtube", "spotify"].includes(track.raw.source)) { + let spotifyResolved = false; if (this.options.spotifyBridge && track.raw.source === "spotify" && !track.raw.engine) { track.raw.engine = await YouTube.search(`${track.author} ${track.title}`, { type: "video" }) .then((x) => x[0].url) .catch(() => null); + spotifyResolved = true; } const link = track.raw.source === "spotify" ? track.raw.engine : track.url; if (!link) return void this.play(this.tracks.shift(), { immediate: true }); if (customDownloader) { - stream = (await this.onBeforeCreateStream(track, track.raw.source || "youtube", this)) ?? null; + stream = (await this.onBeforeCreateStream(track, spotifyResolved ? "youtube" : track.raw.source, this)) ?? null; if (stream) stream = ytdl .arbitraryStream(stream, {