Added random play

This commit is contained in:
Lucas
2020-12-19 12:27:48 +01:00
parent b728d76f52
commit 3050c91f4f

View File

@@ -32,13 +32,23 @@ client.on('message', message => {
}
else if (command === "play") {
Genius.search_song(args.join(" "), (err, song) => {
if (err) {
message.channel.send("Je connais pas \"" + args.join(" ") + "\".");
} else {
play(message, song.id);
}
});
if (args.length == 0) {
getList(message.author.id, songs => {
if (songs === undefined) {
message.channel.send("Vous devez ajouter des musiques à votre liste pour jouer aléatoirement.");
} else {
play(message, songs[Math.floor(Math.random() * songs.length)].id);
}
})
} else {
Genius.search_song(args.join(" "), (err, song) => {
if (err) {
message.channel.send("Je connais pas \"" + args.join(" ") + "\".");
} else {
play(message, song.id);
}
});
}
}
else if (command === "add") {