From 7419ec5f59a5c2a8a75fad032dfa8cef54f51f2e Mon Sep 17 00:00:00 2001 From: neoarz Date: Tue, 7 Oct 2025 21:29:42 -0400 Subject: [PATCH] fix(tweety): remove theme args since buttons work Simplifies the tweety command by removing the 'verified' and 'theme' arguments from command signatures and related logic. Defaults for these options are now set internally, and toggling is handled via UI elements instead of command parameters. --- cogs/media/__init__.py | 26 ++++++-------------------- cogs/media/tweety.py | 20 +++++--------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/cogs/media/__init__.py b/cogs/media/__init__.py index 43f2475..beb217c 100644 --- a/cogs/media/__init__.py +++ b/cogs/media/__init__.py @@ -35,22 +35,8 @@ class Media(commands.GroupCog, name="media"): content_without_mention = content.replace(f'<@{self.bot.user.id}>', '').replace(f'<@!{self.bot.user.id}>', '').strip() if 'tweety' in content_without_mention: - parts = content_without_mention.split() - verified = "false" - theme = "light" - - for i, part in enumerate(parts): - if part == 'tweety': - if i + 1 < len(parts): - if parts[i + 1] in ['verified', 'true', 'yes']: - verified = "true" - if 'dark' in parts or 'night' in parts: - theme = "dark" - break - ctx = await self.bot.get_context(message) - - await self.tweety(ctx, verified=verified, theme=theme) + await self.tweety(ctx) @commands.group(name="media", invoke_without_command=True) async def media_group(self, context: Context): @@ -74,7 +60,7 @@ class Media(commands.GroupCog, name="media"): await self.img2gif(context, attachment=kwargs.get('attachment')) return if name == "tweety": - await self.tweety(context, verified=kwargs.get('verified', "false"), theme=kwargs.get('theme', "light")) + await self.tweety(context) return await context.send(f"Unknown media command: {name}") @@ -91,8 +77,8 @@ class Media(commands.GroupCog, name="media"): await self._invoke_hybrid(context, "img2gif", attachment=attachment) @media_group.command(name="tweety") - async def media_group_tweety(self, context: Context, verified: str = "false", theme: str = "light"): - await self._invoke_hybrid(context, "tweety", verified=verified, theme=theme) + async def media_group_tweety(self, context: Context): + await self._invoke_hybrid(context, "tweety") @commands.check(_require_group_prefix) @commands.hybrid_command( @@ -123,8 +109,8 @@ class Media(commands.GroupCog, name="media"): name="tweety", description="Convert a replied message to a tweet image.", ) - async def tweety(self, context, verified: str = "false", theme: str = "light"): - return await tweety_command()(self, context, verified=verified, theme=theme) + async def tweety(self, context): + return await tweety_command()(self, context) async def setup(bot) -> None: cog = Media(bot) diff --git a/cogs/media/tweety.py b/cogs/media/tweety.py index 65ec96e..859d870 100644 --- a/cogs/media/tweety.py +++ b/cogs/media/tweety.py @@ -151,20 +151,8 @@ def tweety_command(): name="tweety", description="Convert a replied message to a tweet image." ) - @app_commands.describe( - verified="Add a verified badge to the tweet", - theme="Choose the theme for the tweet" - ) - @app_commands.choices(verified=[ - app_commands.Choice(name="No", value="false"), - app_commands.Choice(name="Yes", value="true") - ]) - @app_commands.choices(theme=[ - app_commands.Choice(name="Light", value="light"), - app_commands.Choice(name="Dark", value="dark") - ]) @commands.cooldown(1, 10, commands.BucketType.user) - async def tweety(self, context, verified: Optional[str] = "false", theme: Optional[str] = "light"): + async def tweety(self, context): interaction = getattr(context, "interaction", None) if interaction is not None: try: @@ -184,8 +172,10 @@ def tweety_command(): except Exception: pass return - verified_bool = verified == "true" - theme_bool = theme == "dark" + + # Default to light mode, non-verified (buttons will allow toggling) + verified_bool = False + theme_bool = False if not context.message.reference or not context.message.reference.message_id: embed = discord.Embed(