From 827207c49e3531f35e2b5c9aefa9009f27389a3d Mon Sep 17 00:00:00 2001 From: appujet Date: Thu, 24 Oct 2024 20:48:05 +0530 Subject: [PATCH] fixed: `Error: There is no Track in the Queue, nor provided in the PlayOptions` --- src/commands/music/PlayNext.ts | 2 +- src/commands/music/Search.ts | 2 +- src/commands/playlist/Load.ts | 2 +- src/utils/SetupSystem.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/music/PlayNext.ts b/src/commands/music/PlayNext.ts index a0b167532..40849ac9e 100644 --- a/src/commands/music/PlayNext.ts +++ b/src/commands/music/PlayNext.ts @@ -96,7 +96,7 @@ export default class PlayNext extends Command { ], }); } - if (!player.playing) await player.play({ paused: false }); + if (!player.playing && player.queue.tracks.length > 0) await player.play({ paused: false }); } public async autocomplete(interaction: AutocompleteInteraction): Promise { const focusedValue = interaction.options.getFocused(); diff --git a/src/commands/music/Search.ts b/src/commands/music/Search.ts index 3735bbde7..871c57b69 100644 --- a/src/commands/music/Search.ts +++ b/src/commands/music/Search.ts @@ -89,7 +89,7 @@ export default class Search extends Command { await int.deferUpdate(); if (!track) return; player.queue.add(track); - if (!player.playing) await player.play({ paused: false }); + if (!player.playing && player.queue.tracks.length > 0) await player.play({ paused: false }); await ctx.editMessage({ embeds: [ embed.setDescription( diff --git a/src/commands/playlist/Load.ts b/src/commands/playlist/Load.ts index 9f6ca3689..f031853d7 100644 --- a/src/commands/playlist/Load.ts +++ b/src/commands/playlist/Load.ts @@ -94,7 +94,7 @@ export default class LoadPlaylist extends Command { } player.queue.add(tracks); - if (!player.playing) await player.play({ paused: false }); + if (!player.playing && player.queue.tracks.length > 0) await player.play({ paused: false }); return await ctx.sendMessage({ embeds: [ diff --git a/src/utils/SetupSystem.ts b/src/utils/SetupSystem.ts index a0b1d45c3..9ac11fde7 100644 --- a/src/utils/SetupSystem.ts +++ b/src/utils/SetupSystem.ts @@ -118,7 +118,7 @@ async function setupStart(client: Lavamusic, query: string, player: Player, mess break; } } - if (!player.playing) await player.play(); + if (!player.playing && player.queue.tracks.length > 0) await player.play(); } } catch (error) { client.logger.error(error);