1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 03:33:17 +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 .env
serviceAccount.json
package.json
package-lock.json package-lock.json
.vscode/ .vscode/
node_modules/ node_modules/
serviceAccount.json
package.json

View File

@ -36,7 +36,7 @@ module.exports = {
await client.funcs.handleVideo(video2, message, voiceChannel, client, true); 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!`); 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 { try {
var video = await youtube.getVideo(url); var video = await youtube.getVideo(url);
} catch (error) { } catch (error) {
@ -67,6 +67,19 @@ module.exports = {
} }
} }
return client.funcs.handleVideo(video, message, voiceChannel, client, false); 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);
} }
} }
}; };