2020-02-05 20:02:53 +00:00
|
|
|
module.exports = async function (client, msg, youtube, voiceChannel, url) {
|
|
|
|
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
|
2020-03-12 11:56:31 +00:00
|
|
|
const lmsg = await msg.channel.send(client.messages.loadingSongs);
|
2020-02-05 20:02:53 +00:00
|
|
|
const playlist = await youtube.getPlaylist(url);
|
|
|
|
const videos = await playlist.getVideos();
|
|
|
|
for (const video of Object.values(videos)) {
|
|
|
|
const video2 = await youtube.getVideoByID(video.id);
|
|
|
|
await client.funcs.handleVideo(video2, msg, voiceChannel, client, true);
|
|
|
|
}
|
2020-03-13 14:20:23 +00:00
|
|
|
let message;
|
|
|
|
message = client.messages.playlistAdded.replace("%TITLE%", playlist.title);
|
|
|
|
lmsg.edit(message);
|
2020-02-05 20:02:53 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|