From e73db927c17866793293868d915bf0e37a906737 Mon Sep 17 00:00:00 2001 From: Parker Date: Thu, 28 Nov 2024 00:41:33 -0600 Subject: 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 --- code/cogs/queue.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'code/cogs/queue.py') diff --git a/code/cogs/queue.py b/code/cogs/queue.py index d11a4a9..faaed60 100644 --- a/code/cogs/queue.py +++ b/code/cogs/queue.py @@ -6,7 +6,7 @@ from cogs.music import Music import math import lavalink -from utils.config import BOT_COLOR +from utils.config import create_embed class Queue(commands.Cog): @@ -23,19 +23,12 @@ class Queue(commands.Cog): player = self.bot.lavalink.player_manager.get(interaction.guild.id) if not player.queue: - embed = discord.Embed( + embed = create_embed( title="Nothing Queued", description=( "Nothing is currently in the queue, add a song with the" " command." ), - color=BOT_COLOR, - ) - 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 @@ -60,14 +53,13 @@ class Queue(commands.Cog): f" {track.author} `({track_duration})`\n" ) - embed = discord.Embed( + embed = create_embed( title=f"Queue for {interaction.guild.name}", description=( f"**{len(player.queue)} tracks total**\n\n{queue_list}" ), - color=BOT_COLOR, + footer=f"Viewing page {page}/{pages}", ) - embed.set_footer(text=f"Viewing page {page}/{pages}") await interaction.response.send_message(embed=embed) -- cgit v1.2.3-70-g09d2