Skip to content

Commit

Permalink
[Fix] fixed spotify functionality with slash commands as well
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Oct 7, 2021
1 parent d73c8ea commit 13e8967
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions commands/Music/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ module.exports = {
leaveOnEmpty: true,
async onBeforeCreateStream(track, source, _queue) {
if (source === "youtube") {
if (playdl.sp_validate(track.url)) {
if (playdl.is_expired()) {
await playdl.refreshToken();
}
let spotifyInfo = await playdl.spotify(track.url);
let youtube = await playdl.search(`${spotifyInfo.name}`, {
limit: 1,
});
return (await playdl.stream(youtube[0].url)).stream;
}
return (await playdl.stream(track.url)).stream;
}
},
Expand Down

0 comments on commit 13e8967

Please sign in to comment.