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/shuffle.py | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'code/cogs/shuffle.py') diff --git a/code/cogs/shuffle.py b/code/cogs/shuffle.py index 5c2f381..78213d6 100644 --- a/code/cogs/shuffle.py +++ b/code/cogs/shuffle.py @@ -4,7 +4,7 @@ from discord import app_commands from discord.ext import commands from cogs.music import Music -from utils.config import BOT_COLOR +from utils.config import create_embed class Shuffle(commands.GroupCog, name="shuffle"): @@ -19,16 +19,9 @@ class Shuffle(commands.GroupCog, name="shuffle"): player.shuffle = True - embed = discord.Embed( - title=f"Shuffle Enabled 🔀", - description=f"All music will now be shuffled.", - color=BOT_COLOR, - ) - embed.set_footer( - text=datetime.datetime.now(datetime.timezone.utc).strftime( - "%Y-%m-%d %H:%M:%S" - ) - + " UTC" + embed = create_embed( + title="Shuffle Enabled 🔀", + description="All music will now be shuffled.", ) await interaction.response.send_message(embed=embed) @@ -40,16 +33,9 @@ class Shuffle(commands.GroupCog, name="shuffle"): player.shuffle = False - embed = discord.Embed( - title=f"Disabled 🔀", - description=f"Music will no longer be shuffled.", - color=BOT_COLOR, - ) - embed.set_footer( - text=datetime.datetime.now(datetime.timezone.utc).strftime( - "%Y-%m-%d %H:%M:%S" - ) - + " UTC" + embed = create_embed( + title="Shuffle Disabled 🔀", + description="Music will no longer be shuffled.", ) await interaction.response.send_message(embed=embed) -- cgit v1.2.3-70-g09d2