From 820f9a675f7ac16df686e7833aee1ce4393f5e6a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 13 Feb 2023 22:31:29 +0100 Subject: [PATCH] may fix lyrics crash --- src/commands/music/lyrics.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/commands/music/lyrics.ts b/src/commands/music/lyrics.ts index 006d1ef..6a82a34 100644 --- a/src/commands/music/lyrics.ts +++ b/src/commands/music/lyrics.ts @@ -42,11 +42,13 @@ export default { ); let data = null; + await interaction.deferReply(); + if (request) { try { data = await client.player.lyrics.search(request); } catch { - return await interaction.reply(loc.get("c_lyrics2") + ` \`${request}\``); + return await interaction.followUp(loc.get("c_lyrics2") + ` \`${request}\``); } } else { const queue = client.player.queues.get(interaction.guildId ?? ""); @@ -56,7 +58,7 @@ export default { try { data = await client.player.lyrics.search(title); } catch { - return await interaction.reply(loc.get("c_lyrics2") + ` \`${title}\``); + return await interaction.followUp(loc.get("c_lyrics2") + ` \`${title}\``); } } } @@ -66,9 +68,6 @@ export default { const limit_desc = 4096; const nb_embed = Math.ceil(data.lyrics.length / limit_desc); - // May send multiples message - await interaction.deferReply(); - // TODO: If lyrics < 6000, only send one message with multiples embed for (let i = 0, j = 0; i < nb_embed; i++, j += limit_desc) { // TODO: Better cut in lyrics @@ -115,6 +114,6 @@ export default { return; } - return await interaction.reply(loc.get("c_lyrics1")); + return await interaction.followUp(loc.get("c_lyrics1")); }, }; -- 2.45.2