aboutsummaryrefslogtreecommitdiff
path: root/code/cogs
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-08-08 18:42:49 -0500
committerParker <contact@pkrm.dev>2024-08-08 18:42:49 -0500
commit936f9772ee2fa9da4ad583c33edbeeea6ce33a3a (patch)
treed9b2a52dd63c6f0db2cddf52e4f7c5011ca87031 /code/cogs
parent4a4e042b6fe85c84f73874f92d4d2ef448494e1a (diff)
Fix 404 errors when searching for lyrics
Diffstat (limited to 'code/cogs')
-rw-r--r--code/cogs/lyrics.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/code/cogs/lyrics.py b/code/cogs/lyrics.py
index b3a918f..135aa01 100644
--- a/code/cogs/lyrics.py
+++ b/code/cogs/lyrics.py
@@ -32,6 +32,10 @@ class Lyrics(commands.Cog):
)
return await interaction.response.send_message(embed=embed, ephemeral=True)
+ # Defer the interaction to avoid getting 404 Not Found errors
+ # if fetching the lyrics takes a long time
+ await interaction.response.defer(ephemeral=True)
+
# Search for the songs lyrics with Genius
song = self.bot.genius.search_song(player.current.title, player.current.author)
@@ -49,8 +53,7 @@ class Lyrics(commands.Cog):
)
+ " UTC"
)
-
- return await interaction.response.send_message(embed=embed, ephemeral=True)
+ return await interaction.edit_original_response(embed=embed)
# Remove unwanted text
lyrics = song.lyrics
@@ -70,8 +73,7 @@ class Lyrics(commands.Cog):
)
+ " UTC"
)
-
- await interaction.response.send_message(embed=embed, ephemeral=True)
+ await interaction.edit_original_response(embed=embed)
async def setup(bot):