increase autocompletion list

This commit is contained in:
Mylloon 2023-08-08 22:04:53 +02:00
parent 0904bd0d98
commit 49283ae699
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -173,7 +173,7 @@ export default {
/* Create a race between a timeout and the search
* At the end, Discord will always receive a response */
const tracks = await Promise.race([
let tracks = await Promise.race([
delay,
player.search(query, {
requestedBy: interaction.user,
@ -187,7 +187,11 @@ export default {
return [];
});
// Returns a list of songs with their title
// Slice the list if needed
if (tracks.length > 25) {
tracks = tracks.slice(0, 25);
}
return interaction.respond(
tracks.slice(0, 10).map((t) => ({
name: t.title,