1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-01-11 07:54:49 +00:00
musix-oss/src/funcs/urlMatch.js

17 lines
754 B
JavaScript
Raw Normal View History

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);
2020-06-17 13:38:43 +00:00
await client.funcs.handleVideo(video2.url, msg, voiceChannel, client, true);
2020-02-05 20:02:53 +00:00
}
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;
}
};