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
);
let data;
let data = null;
if (request) {
data = await client.player.lyrics.search(request);
}
const queue = client.player.queues.get(interaction.guildId ?? "");
if (queue) {
data = await client.player.lyrics.search(
(queue.current?.author + " " ?? "") + queue.current?.title
);
try {
data = await client.player.lyrics.search(request);
} catch {
return await interaction.reply(loc.get("c_lyrics3") + ` \`${request}\``);
}
} else {
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) {

View file

@ -114,5 +114,6 @@
"c_lyrics_opt1_name": "chanson",
"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_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"
}