diff options
author | Parker <contact@pkrm.dev> | 2024-11-28 00:41:33 -0600 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-11-28 00:41:33 -0600 |
commit | e73db927c17866793293868d915bf0e37a906737 (patch) | |
tree | e05843e8e4af9b672731a435e8bd8a1f559bece9 /code/utils/source_helpers/apple/playlist.py | |
parent | 1ce91a4b0984407bcd08b4fbf7448d7f4dbcead2 (diff) |
Create `create_embed` template to replace `discord.Embed()`
- Auto-set color to BOT_COLOR
- Set footer to timestamp (overridden is timestamp is passed)
- Optional thumbnail
Diffstat (limited to 'code/utils/source_helpers/apple/playlist.py')
-rw-r--r-- | code/utils/source_helpers/apple/playlist.py | 10 |
1 files changed, 4 insertions, 6 deletions
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 |