feat: enchance autocompletion & more #103
2 changed files with 17 additions and 13 deletions
|
@ -150,6 +150,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
autocomplete: async (interaction: AutocompleteInteraction) => {
|
autocomplete: async (interaction: AutocompleteInteraction) => {
|
||||||
|
const loc = getLocale(interaction.client, interaction.locale);
|
||||||
const loc_default = interaction.client.locales.get(interaction.client.config.default_lang);
|
const loc_default = interaction.client.locales.get(interaction.client.config.default_lang);
|
||||||
const filename = getFilename(__filename);
|
const filename = getFilename(__filename);
|
||||||
|
|
||||||
|
@ -186,20 +187,22 @@ export default {
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Slice the list if needed
|
// If tracks found
|
||||||
if (tracks.length > 25) {
|
if (tracks.length > 0) {
|
||||||
tracks = tracks.slice(0, 25);
|
// Slice the list if needed
|
||||||
}
|
if (tracks.length > 25) {
|
||||||
|
tracks = tracks.slice(0, 25);
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a list of songs with their title and author
|
// Returns a list of songs with their title and author
|
||||||
return interaction.respond(
|
return interaction.respond(
|
||||||
tracks.map((t) => ({
|
tracks.map((t) => ({
|
||||||
name: `${t.title} • ${t.author}`,
|
name: `${t.title} • ${t.author}`,
|
||||||
value: t.url,
|
value: t.url,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
return interaction.respond([]);
|
|
||||||
}
|
}
|
||||||
|
return interaction.respond([{ name: loc.get("c_play9"), value: query }]);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
"c_play6": "Le bot ne joue rien en ce moment.",
|
"c_play6": "Le bot ne joue rien en ce moment.",
|
||||||
"c_play7": "Joue actuellement",
|
"c_play7": "Joue actuellement",
|
||||||
"c_play8": "Demandé par",
|
"c_play8": "Demandé par",
|
||||||
|
"c_play9": "Aucun résultat trouvé",
|
||||||
|
|
||||||
"c_stop_name": "stop",
|
"c_stop_name": "stop",
|
||||||
"c_stop_desc": "Stop la musique",
|
"c_stop_desc": "Stop la musique",
|
||||||
|
|
Loading…
Reference in a new issue