Create Discord Music Bot
Can play and queue, can play music in multiple servers at once
This commit is contained in:
15
music_sources/spotify.js
Normal file
15
music_sources/spotify.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const playdl = require('play-dl');
|
||||
|
||||
async function getStream(query) {
|
||||
const trackInfo = await playdl.spotify(query);
|
||||
|
||||
let searched = await play.search(`${trackInfo.name}`, {
|
||||
limit: 1
|
||||
}) // This will search the found track on youtube.
|
||||
|
||||
let stream = await play.stream(searched[0].url) // This will create stream from the above search
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
module.exports.getStream = getStream;
|
||||
Reference in New Issue
Block a user