Make sure lyrics do not exceed 4096 characters
This commit is contained in:
parent
936f9772ee
commit
2cdaa11af4
@ -61,9 +61,26 @@ class Lyrics(commands.Cog):
|
|||||||
lyrics = lyrics.replace("You might also like", "\n")
|
lyrics = lyrics.replace("You might also like", "\n")
|
||||||
lyrics = lyrics[:-7]
|
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(
|
embed = discord.Embed(
|
||||||
title=f"Lyrics for {player.current.title} by {player.current.author}",
|
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,
|
color=BOT_COLOR,
|
||||||
)
|
)
|
||||||
embed.set_thumbnail(url=player.current.artwork_url)
|
embed.set_thumbnail(url=player.current.artwork_url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user