From e689aadbd89d43309e2a5c8343f3e50316eb30a0 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 16 Oct 2025 23:09:21 -0500 Subject: [PATCH] CLAUDE: Fix double emoji issue in Discord embeds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed 13 instances where EmbedTemplate methods were receiving titles with emojis, resulting in double emojis (e.g., "✅ ✅ Command Created"). Changes: - tasks/custom_command_cleanup.py: Removed emojis from warning/error titles (2 fixes) - views/help_commands.py: Removed emoji from success title (1 fix) - views/custom_commands.py: Removed emojis from titles or switched to create_base_embed() for custom emojis (10 fixes) The following template methods auto-add emoji prefixes: - EmbedTemplate.success() → adds ✅ - EmbedTemplate.error() → adds ❌ - EmbedTemplate.warning() → adds ⚠️ - EmbedTemplate.info() → adds ℹ️ - EmbedTemplate.loading() → adds ⏳ For custom emojis, use EmbedTemplate.create_base_embed() with explicit color parameter. All 69 related tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tasks/custom_command_cleanup.py | 4 ++-- views/custom_commands.py | 26 ++++++++++++++------------ views/help_commands.py | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/tasks/custom_command_cleanup.py b/tasks/custom_command_cleanup.py index e21115a..87af4ec 100644 --- a/tasks/custom_command_cleanup.py +++ b/tasks/custom_command_cleanup.py @@ -233,7 +233,7 @@ class CustomCommandCleanupTask: plural = len(commands) > 1 embed = EmbedTemplate.warning( - title="⚠️ Custom Command Cleanup Warning", + title="Custom Command Cleanup Warning", description=f"The following custom command{'s' if plural else ''} will be deleted in 30 days if not used:" ) @@ -273,7 +273,7 @@ class CustomCommandCleanupTask: plural = len(commands) > 1 embed = EmbedTemplate.error( - title="🗑️ Custom Commands Deleted", + title="Custom Commands Deleted", description=f"The following custom command{'s' if plural else ''} {'have' if plural else 'has'} been automatically deleted due to inactivity:" ) diff --git a/views/custom_commands.py b/views/custom_commands.py index d59ed06..c070c0c 100644 --- a/views/custom_commands.py +++ b/views/custom_commands.py @@ -119,18 +119,18 @@ class CustomCommandCreateConfirmationView(BaseView): ) embed = EmbedTemplate.success( - title="✅ Command Created", + title="Command Created", description=f"The command `/cc {self.command_data['name']}` has been created successfully!" ) except BotException as e: embed = EmbedTemplate.error( - title="❌ Creation Failed", + title="Creation Failed", description=f"Failed to create command: {str(e)}" ) except Exception as e: embed = EmbedTemplate.error( - title="❌ Unexpected Error", + title="Unexpected Error", description="An unexpected error occurred while creating the command." ) @@ -268,18 +268,18 @@ class CustomCommandEditConfirmationView(BaseView): ) embed = EmbedTemplate.success( - title="✅ Command Updated", + title="Command Updated", description=f"The command `/cc {self.edit_data['name']}` has been updated successfully!" ) except BotException as e: embed = EmbedTemplate.error( - title="❌ Update Failed", + title="Update Failed", description=f"Failed to update command: {str(e)}" ) except Exception as e: embed = EmbedTemplate.error( - title="❌ Unexpected Error", + title="Unexpected Error", description="An unexpected error occurred while updating the command." ) @@ -571,7 +571,7 @@ class SingleCommandManagementView(BaseView): async def delete_command(self, interaction: discord.Interaction, button: discord.ui.Button): """Delete the command with confirmation.""" embed = EmbedTemplate.warning( - title="⚠️ Delete Command", + title="Delete Command", description=f"Are you sure you want to delete `/cc {self.command.name}`?" ) @@ -594,7 +594,7 @@ class SingleCommandManagementView(BaseView): if confirmation_view.result: # User confirmed deletion embed = EmbedTemplate.success( - title="✅ Command Deleted", + title="Command Deleted", description=f"The command `/cc {self.command.name}` has been deleted." ) await interaction.edit_original_response(embed=embed, view=None) @@ -632,9 +632,10 @@ class CustomCommandListView(PaginationView): def _create_embeds_from_search_result(self, search_result: CustomCommandSearchResult) -> List[discord.Embed]: """Create embeds from search result.""" if not search_result.commands: - embed = EmbedTemplate.info( + embed = EmbedTemplate.create_base_embed( title="🔍 Custom Commands", - description="No custom commands found matching your criteria." + description="No custom commands found matching your criteria.", + color=EmbedColors.INFO ) return [embed] @@ -725,9 +726,10 @@ class CustomCommandSearchModal(BaseModal): self.is_submitted = True # Show confirmation - embed = EmbedTemplate.info( + embed = EmbedTemplate.create_base_embed( title="🔍 Search Submitted", - description="Searching for custom commands..." + description="Searching for custom commands...", + color=EmbedColors.INFO ) criteria = [] diff --git a/views/help_commands.py b/views/help_commands.py index db7fef9..b4c6493 100644 --- a/views/help_commands.py +++ b/views/help_commands.py @@ -211,7 +211,7 @@ class HelpCommandDeleteConfirmView(BaseView): self.result = True embed = EmbedTemplate.success( - title="✅ Help Topic Deleted", + title="Help Topic Deleted", description=f"The help topic `/help {self.help_command.name}` has been deleted (soft delete)." )