From 04858d8a2790ef311b5236f5a54f2bc43dc21e1e Mon Sep 17 00:00:00 2001 From: MatteZ02 <47610069+MatteZ02@users.noreply.github.com> Date: Thu, 4 Jun 2020 08:41:11 +0300 Subject: [PATCH] Timeout Catch --- src/struct/config/messages.js | 1 + src/struct/funcs/play.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/struct/config/messages.js b/src/struct/config/messages.js index d3410120..fb3f4b06 100644 --- a/src/struct/config/messages.js +++ b/src/struct/config/messages.js @@ -176,6 +176,7 @@ module.exports = { statusField4: "Shard: ", statusTitle: "Status for Musix", stop: emojis.stop + "Stopped the music!", + tookTooLong: emojis.redx + "Something took too long! Please try again!", validNumber: emojis.redx + "I'm sorry, But you need to enter a valid __number__.", wrongVoiceChannel: emojis.redx + "I'm sorry but you need to be in the same voice channel as Musix to use this command!", diff --git a/src/struct/funcs/play.js b/src/struct/funcs/play.js index ae1b7672..123f6375 100644 --- a/src/struct/funcs/play.js +++ b/src/struct/funcs/play.js @@ -12,6 +12,14 @@ module.exports = async function (guild, song, client, seek, play) { client.queue.delete(guild.id); return; } + setTimeout(() => { + if (!queue.playing) { + queue.textChannel.send(client.messages.tookTooLong); + queue.voiceChannel.leave(); + client.queue.delete(guild.id); + return; + } + }, 45000); streamConfig.options.seek = seek;