mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
fix: Improvement to play command autocomplete search
This commit is contained in:
1 parent
912080e8d4
commit
f59055807f
1 file changed
+6
-1
@@ -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 }) => {
|
||||
|
||||
Reference in new issue
Block a user