From a34c4ce0a64aa24166521b1f6d407bc8ea33392d Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Wed, 24 Jun 2020 19:11:58 +0200 Subject: [PATCH] :sparkles: Support playlists --- commands/play.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/commands/play.js b/commands/play.js index b70894d..52a2bec 100644 --- a/commands/play.js +++ b/commands/play.js @@ -15,14 +15,22 @@ exports.run = async (client, message, args) => { if(aTrackIsAlreadyPlaying){ // Add the track to the queue - const track = await client.player.addToQueue(message.guild.id, args.join(" ")); - message.channel.send(`Track ${track.name} added to queue ${emotes.music}`); + const result = await client.player.addToQueue(message.guild.id, args[0]); + if(result.type === 'playlist'){ + message.channel.send(`${result.tracks.length} songs added to the queue ${emotes.music}`); + } else { + message.channel.send(`${result.name} added to the queue ${emotes.music}`); + } } else { // Else, play the song - const song = await client.player.play(message.member.voice.channel, args.join(" ")); - message.channel.send(`Currently playing ${song.name} ${emotes.music}`); + const result = await client.player.play(message.member.voice.channel, args.join(" ")); + if(result.type === 'playlist'){ + message.channel.send(`${result.tracks.length} songs added to the queue ${emotes.music}\nCurrently playing **${result.tracks[0].name}**!`); + } else { + message.channel.send(`Currently playing ${result.name} ${emotes.music}`); + } const queue = client.player.getQueue(message.guild.id)