v5.3.11
Somewhat working Spotify support
This commit is contained in:
parent
641ef8ee85
commit
ca53b6da0c
2 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "discord-player-play-dl",
|
||||
"version": "5.3.10",
|
||||
"version": "5.3.11",
|
||||
"description": "Complete framework to facilitate music commands using discord.js and play-dl",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -628,11 +628,20 @@ class Queue<T = unknown> {
|
|||
const hasCustomDownloader = typeof this.onBeforeCreateStream === "function";
|
||||
|
||||
if (["youtube", "spotify", "soundcloud"].includes(track.raw.source)) {
|
||||
|
||||
let spotifyResolved = false;
|
||||
if (track.raw.source === "spotify" && !track.raw.engine) {
|
||||
track.raw.engine = await play.search(`${track.author} ${track.title}`, { limit: 5 })
|
||||
.then(res => res[0].url)
|
||||
.catch(Util.noop);
|
||||
spotifyResolved = true;
|
||||
}
|
||||
|
||||
const url = track.raw.source === "spotify" ? track.raw.engine : track.url;
|
||||
if (!url) return void this.play(this.tracks.shift(), { immediate: true });
|
||||
|
||||
if (hasCustomDownloader) {
|
||||
stream = (await this.onBeforeCreateStream(track, "youtube", this)) || null;
|
||||
stream = (await this.onBeforeCreateStream(track, spotifyResolved ? "youtube" : track.raw.source, this)) || null;
|
||||
}
|
||||
|
||||
if (!stream) {
|
||||
|
|
Loading…
Reference in a new issue