fix issue when no lyrics were found

This commit is contained in:
Mylloon 2023-02-11 00:30:32 +01:00
parent 13246cd46b
commit 5ac1d5f7f1
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 20 additions and 10 deletions

View file

@ -42,16 +42,25 @@ export default {
loc_default?.get(`c_${filename}_opt1_name`) as string loc_default?.get(`c_${filename}_opt1_name`) as string
); );
let data; let data = null;
if (request) { if (request) {
data = await client.player.lyrics.search(request); try {
} data = await client.player.lyrics.search(request);
} catch {
const queue = client.player.queues.get(interaction.guildId ?? ""); return await interaction.reply(loc.get("c_lyrics3") + ` \`${request}\``);
if (queue) { }
data = await client.player.lyrics.search( } else {
(queue.current?.author + " " ?? "") + queue.current?.title const queue = client.player.queues.get(interaction.guildId ?? "");
); if (queue) {
const title = queue.current?.title;
if (title) {
try {
data = await client.player.lyrics.search(title);
} catch {
return await interaction.reply(loc.get("c_lyrics3") + ` \`${title}\``);
}
}
}
} }
if (data) { if (data) {

View file

@ -114,5 +114,6 @@
"c_lyrics_opt1_name": "chanson", "c_lyrics_opt1_name": "chanson",
"c_lyrics_opt1_desc": "Chanson recherchée", "c_lyrics_opt1_desc": "Chanson recherchée",
"c_lyrics1": "Le bot ne joue rien en ce moment et aucune chanson n'est renseignée.", "c_lyrics1": "Le bot ne joue rien en ce moment et aucune chanson n'est renseignée.",
"c_lyrics2": "Paroles trop longues pour être affichées." "c_lyrics2": "Paroles trop longues pour être affichées.",
"c_lyrics3": "Impossible de trouver les paroles pour"
} }