1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 02:00:20 +00:00

Option for song selection

This commit is contained in:
MatteZ02 2019-11-14 19:56:01 +02:00
parent 89d010e2e5
commit 1190bd7de3
2 changed files with 16 additions and 3 deletions

4
.gitignore vendored
View File

@ -1,6 +1,6 @@
.env
serviceAccount.json
package.json
package-lock.json
.vscode/
node_modules/
serviceAccount.json
package.json

View File

@ -36,7 +36,7 @@ module.exports = {
await client.funcs.handleVideo(video2, message, voiceChannel, client, true);
}
return message.channel.send(`:white_check_mark: Playlist: **${playlist.title}** has been added to the queue!`);
} else {
} else if (client.global.db.guilds[message.guild.id].songSelection) {
try {
var video = await youtube.getVideo(url);
} catch (error) {
@ -67,6 +67,19 @@ module.exports = {
}
}
return client.funcs.handleVideo(video, message, voiceChannel, client, false);
} else {
try {
var video = await youtube.getVideo(url);
} catch (error) {
try {
var videos = await youtube.searchVideos(searchString, 1);
var video = await youtube.getVideoByID(videos[0].id);
} catch (err) {
console.error(err);
return message.channel.send(':x: I could not obtain any search results!');
}
}
return client.funcs.handleVideo(video, message, voiceChannel, client, false);
}
}
};