mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-07 01:20:48 +00:00
Fix code to work on this decade 1/x
This commit is contained in:
17
src/funcs/urlMatch.js
Normal file
17
src/funcs/urlMatch.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = async function (client, msg, youtube, voiceChannel, url) {
|
||||
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
|
||||
const lmsg = await msg.channel.send(client.messages.loadingSongs);
|
||||
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.url, msg, voiceChannel, client, true);
|
||||
}
|
||||
let message;
|
||||
message = client.messages.playlistAdded.replace("%TITLE%", playlist.title);
|
||||
lmsg.edit(message);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user