aboutsummaryrefslogtreecommitdiff
path: root/code/cogs
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-08-12 17:30:22 -0500
committerParker <contact@pkrm.dev>2024-08-12 17:30:22 -0500
commit2cdaa11af4ce1a99d7bb51ef311a5262dd656bf1 (patch)
tree131b8c5bb98dd723d3de6810ee2c578a7489029d /code/cogs
parent936f9772ee2fa9da4ad583c33edbeeea6ce33a3a (diff)
Make sure lyrics do not exceed 4096 characters
Diffstat (limited to 'code/cogs')
-rw-r--r--code/cogs/lyrics.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/code/cogs/lyrics.py b/code/cogs/lyrics.py
index 135aa01..c27589e 100644
--- a/code/cogs/lyrics.py
+++ b/code/cogs/lyrics.py
@@ -61,9 +61,26 @@ class Lyrics(commands.Cog):
lyrics = lyrics.replace("You might also like", "\n")
lyrics = lyrics[:-7]
+ # If the lyrics are too long, send just a link to the lyrics
+ if len(lyrics) > 2048:
+ embed = discord.Embed(
+ title=f"Lyrics for {player.current.title} by {player.current.author}",
+ description=f"Song lyrics are too long to display on Discord. [Click here to view the lyrics on Genius]({song.url}).",
+ color=BOT_COLOR,
+ )
+ embed.set_thumbnail(url=player.current.artwork_url)
+ embed.set_footer(
+ text=datetime.datetime.now(datetime.timezone.utc).strftime(
+ "%Y-%m-%d %H:%M:%S"
+ )
+ + " UTC"
+ )
+ return await interaction.response.send_message(embed=embed, ephemeral=True)
+
+ # If everything is successful, send the lyrics
embed = discord.Embed(
title=f"Lyrics for {player.current.title} by {player.current.author}",
- description=lyrics,
+ description=f"Provided from [Genius]({song.url})\n\n" + lyrics,
color=BOT_COLOR,
)
embed.set_thumbnail(url=player.current.artwork_url)