From 2c6973890816b969c97a9165077f7246149931d0 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Thu, 25 Jun 2020 18:33:05 +0200 Subject: [PATCH] :zap: Add error message when the song can't be played --- commands/play.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/play.js b/commands/play.js index f8b1d41..a84bd9c 100644 --- a/commands/play.js +++ b/commands/play.js @@ -16,6 +16,8 @@ exports.run = async (client, message, args) => { // Add the track to the queue const result = await client.player.addToQueue(message.guild.id, args[0]); + if(!result) return message.channel.send(`This song provider is not supported...`); + if(result.type === 'playlist'){ message.channel.send(`${result.tracks.length} songs added to the queue ${emotes.music}`); } else { @@ -25,7 +27,9 @@ exports.run = async (client, message, args) => { } else { // Else, play the song - const result = await client.player.play(message.member.voice.channel, args.join(" ")); + const result = await client.player.play(message.member.voice.channel, args.join(" ")).catch(() => {}); + if(!result) return message.channel.send(`This song provider is not supported...`); + if(result.type === 'playlist'){ message.channel.send(`${result.tracks.length} songs added to the queue ${emotes.music}\nCurrently playing ${result.tracks[0].name} !`); } else {