aboutsummaryrefslogtreecommitdiff
path: root/code/cogs/lyrics.py
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-10-31 05:26:36 +0000
committerGitHub <noreply@github.com>2024-10-31 05:26:36 +0000
commit5be16a998857d1f14410904a41d052070d5f8776 (patch)
tree6b26a4dc377ccf209c37eabf673d6031fdc10987 /code/cogs/lyrics.py
parentc1b229f34c010108b0e7eb92de2102dfc07ae70c (diff)
parent70e612882d1093b133d13302dccfba6aa2778474 (diff)
Merge pull request #9 from PacketParker/dev
`black --line-length 79`
Diffstat (limited to 'code/cogs/lyrics.py')
-rw-r--r--code/cogs/lyrics.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/code/cogs/lyrics.py b/code/cogs/lyrics.py
index f4434d0..e28d2c2 100644
--- a/code/cogs/lyrics.py
+++ b/code/cogs/lyrics.py
@@ -21,7 +21,10 @@ class Lyrics(commands.Cog):
if not self.bot.genius:
embed = discord.Embed(
title="Lyrics Feature Error",
- description="The lyrics feature is currently disabled due to errors with the Genius API.",
+ description=(
+ "The lyrics feature is currently disabled due to errors"
+ " with the Genius API."
+ ),
color=BOT_COLOR,
)
embed.set_footer(
@@ -30,20 +33,27 @@ class Lyrics(commands.Cog):
)
+ " UTC"
)
- return await interaction.response.send_message(embed=embed, ephemeral=True)
+ 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)
+ song = self.bot.genius.search_song(
+ player.current.title, player.current.author
+ )
# If no lyrics are found, send an error message
if song is None:
embed = discord.Embed(
title="Lyrics Not Found",
- description="Unfortunately, I wasn't able to find any lyrics for the song that is currently playing.",
+ description=(
+ "Unfortunately, I wasn't able to find any lyrics for the"
+ " song that is currently playing."
+ ),
color=BOT_COLOR,
)
embed.set_thumbnail(url=player.current.artwork_url)
@@ -64,8 +74,14 @@ class Lyrics(commands.Cog):
# 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}).",
+ title=(
+ f"Lyrics for {player.current.title} by"
+ f" {player.current.author}"
+ ),
+ description=(
+ "Song lyrics are too long to display on Discord. [Click"
+ f" here to view the lyrics on Genius]({song.url})."
+ ),
color=BOT_COLOR,
)
embed.set_thumbnail(url=player.current.artwork_url)
@@ -79,7 +95,9 @@ class Lyrics(commands.Cog):
# If everything is successful, send the lyrics
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=f"Provided from [Genius]({song.url})\n\n" + lyrics,
color=BOT_COLOR,
)