aboutsummaryrefslogtreecommitdiff
path: root/code/utils/source_helpers/apple
diff options
context:
space:
mode:
Diffstat (limited to 'code/utils/source_helpers/apple')
-rw-r--r--code/utils/source_helpers/apple/album.py13
-rw-r--r--code/utils/source_helpers/apple/playlist.py10
-rw-r--r--code/utils/source_helpers/apple/song.py16
3 files changed, 13 insertions, 26 deletions
diff --git a/code/utils/source_helpers/apple/album.py b/code/utils/source_helpers/apple/album.py
index 3195e2d..aa4ea0d 100644
--- a/code/utils/source_helpers/apple/album.py
+++ b/code/utils/source_helpers/apple/album.py
@@ -4,7 +4,7 @@ import requests
from typing import Tuple, Optional
from requests.exceptions import JSONDecodeError
-from utils.config import BOT_COLOR, LOG
+from utils.config import create_embed, LOG
async def load(
@@ -25,13 +25,12 @@ async def load(
)
if response.status_code == 404:
- embed = discord.Embed(
+ embed = create_embed(
title="Album Not Found",
description=(
"The album could not be found as the provided link is"
" invalid. Please try again."
),
- color=BOT_COLOR,
)
return None, embed
@@ -62,18 +61,14 @@ async def load(
if artwork_url:
artwork_url = artwork_url.replace("{w}x{h}", "300x300")
- embed = discord.Embed(
+ embed = create_embed(
title="Album Queued",
description=(
f"**{name}** by **{artist}**\n"
f"` {num_tracks} ` tracks\n\n"
f"Queued by: {user.mention}"
),
- color=BOT_COLOR,
- )
- embed.set_thumbnail(url=artwork_url)
- embed.set_footer(
- text=datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") + " UTC"
+ thumbnail=artwork_url,
)
return album, embed
diff --git a/code/utils/source_helpers/apple/playlist.py b/code/utils/source_helpers/apple/playlist.py
index 8a27315..65dfbf8 100644
--- a/code/utils/source_helpers/apple/playlist.py
+++ b/code/utils/source_helpers/apple/playlist.py
@@ -1,10 +1,9 @@
-import datetime
import discord
import requests
from typing import Tuple, Optional
from requests.exceptions import JSONDecodeError
-from utils.config import BOT_COLOR, LOG
+from utils.config import create_embed, LOG
async def load(
@@ -24,13 +23,12 @@ async def load(
)
if response.status_code == 404:
- embed = discord.Embed(
+ embed = create_embed(
title="Playlist Not Found",
description=(
"The playlist could not be found as the provided link is"
" invalid. Please try again."
),
- color=BOT_COLOR,
)
return None, embed
@@ -71,12 +69,12 @@ async def load(
if artwork_url:
artwork_url = artwork_url.replace("{w}x{h}", "300x300")
- embed = discord.Embed(
+ embed = create_embed(
title="Playlist Queued",
description=(
f"**{name}**\n` {num_tracks} ` tracks\n\nQueued by: {user.mention}"
),
- color=BOT_COLOR,
+ thumbnail=artwork_url,
)
# Add small alert if the playlist is the max size
diff --git a/code/utils/source_helpers/apple/song.py b/code/utils/source_helpers/apple/song.py
index 55db003..4190b63 100644
--- a/code/utils/source_helpers/apple/song.py
+++ b/code/utils/source_helpers/apple/song.py
@@ -1,10 +1,9 @@
-import datetime
import discord
import requests
from typing import Tuple, Optional
from requests.exceptions import JSONDecodeError
-from utils.config import BOT_COLOR, LOG
+from utils.config import create_embed, LOG
async def load(
@@ -25,13 +24,12 @@ async def load(
)
if response.status_code == 404:
- embed = discord.Embed(
+ embed = create_embed(
title="Song Not Found",
description=(
"The song could not be found as the provided link is"
" invalid. Please try again."
),
- color=BOT_COLOR,
)
return None, embed
@@ -61,14 +59,10 @@ async def load(
if artwork_url:
artwork_url = artwork_url.replace("{w}x{h}", "300x300")
- embed = discord.Embed(
+ embed = create_embed(
title="Song Queued",
- description=f"**{name}** by **{artist}**\n\nQueued by: {user.mention}",
- color=BOT_COLOR,
- )
- embed.set_thumbnail(url=artwork_url)
- embed.set_footer(
- text=datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") + " UTC"
+ description=f"**{name}** by **{artist}**\n\nQueued by {user.mention}",
+ thumbnail=artwork_url,
)
return song, embed