From 8647d8782f3230ad86fe3b6417396c62da8bb379 Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Thu, 6 Feb 2020 22:06:40 +0200 Subject: [PATCH] Update play.js --- src/struct/funcs/play.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/struct/funcs/play.js b/src/struct/funcs/play.js index fff4de7f..718b9c8f 100644 --- a/src/struct/funcs/play.js +++ b/src/struct/funcs/play.js @@ -18,7 +18,12 @@ module.exports = async function (guild, song, client, seek, play) { dispatcher.on('start', () => { dispatcher.player.streamingData.pausedTime = 0; }); - dispatcher.on('error', error => console.error(error)); + dispatcher.on('error', error => { + console.error(error); + serverQueue.voiceChannel.leave(); + client.queue.delete(guild.id); + return serverQueue.textChannel.send('<:redx:674263474704220182> An error has occured while playing music! The queue has been deleted.'); + }); dispatcher.setVolume(serverQueue.volume / 10); if (client.global.db.guilds[guild.id].startPlaying || play) { const data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));