diff --git a/src/commands/player/play.js b/src/commands/player/play.js index b2d6f468..6a0e0ada 100644 --- a/src/commands/player/play.js +++ b/src/commands/player/play.js @@ -30,10 +30,11 @@ module.exports = { return; } const searchResults = await player.search(query); + let response = []; logger.debug(`[Shard ${interaction.guild.shardId}] Autocomplete search responded for query: ${query}`); - let response = searchResults.tracks.slice(0, 5).map((track) => ({ + response = searchResults.tracks.slice(0, 5).map((track) => ({ name: `${track.title} [Author: ${track.author}]`.length > 100 ? `${track.title}`.slice(0, 100) @@ -41,6 +42,10 @@ module.exports = { value: track.url })); + if (!response || response.length === 0) { + return interaction.respond([]); + } + return interaction.respond(response); }, execute: async ({ interaction }) => {