From fc8def1b77fcd5e187ebf5f200dc96e30d6b88b7 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Tue, 21 Apr 2026 09:44:52 +0000 Subject: [PATCH 1/3] Convert party cog commands to hybrid commands for slash support Agent-Logs-Url: https://github.com/psykzz/cogs/sessions/445019c6-7cca-4eb2-9510-967e488aec29 Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com> --- party/party.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/party/party.py b/party/party.py index 0506132..494ca18 100644 --- a/party/party.py +++ b/party/party.py @@ -1262,7 +1262,7 @@ async def create_party_embed(self, party: dict, guild: discord.Guild = None) -> async def party(self, ctx): """Party management commands.""" - @party.command(name="create") + @party.hybrid_command(name="create") async def party_create( self, ctx, @@ -1424,7 +1424,7 @@ async def modal_button_callback(interaction: discord.Interaction): # Bot doesn't have permission to delete messages pass - @party.command(name="delete") + @party.hybrid_command(name="delete") async def party_delete(self, ctx, *, party_identifier: str): """Delete a party by ID or title. @@ -1500,7 +1500,7 @@ async def party_delete(self, ctx, *, party_identifier: str): await ctx.send(f"✅ Party `{party_id}` ({party['name']}) deleted.") - @party.command(name="list") + @party.hybrid_command(name="list") async def party_list(self, ctx): """List all active parties in this server. @@ -1554,7 +1554,7 @@ async def party_list(self, ctx): await ctx.send(embed=embed) - @party.command(name="config") + @party.hybrid_command(name="config") @checks.admin_or_permissions(manage_guild=True) async def party_config(self, ctx, setting: str, value: str): """Configure party settings for this server. @@ -1578,7 +1578,7 @@ async def party_config(self, ctx, setting: str, value: str): else: await ctx.send(f"❌ Unknown setting: `{setting}`") - @party.command(name="description") + @party.hybrid_command(name="description") async def party_description(self, ctx, party_id: str, *, description: str): """Set the description for a party. @@ -1624,7 +1624,7 @@ async def party_description(self, ctx, party_id: str, *, description: str): await ctx.send(f"✅ Description updated for party `{party_id}`.") - @party.command(name="settime") + @party.hybrid_command(name="settime") async def party_settime(self, ctx, party_id: str, *, scheduled_time: str): """Set or clear the scheduled date and time for a party (UTC). @@ -1702,7 +1702,7 @@ def _fmt_ts(ts): f"✅ Scheduled time set for party `{party_id}`: ()" ) - @party.command(name="rename-option") + @party.hybrid_command(name="rename-option") async def party_rename_option(self, ctx, party_id: str, old_option: str, *, new_option: str): """Rename an option/role in a party. @@ -1779,7 +1779,7 @@ async def party_rename_option(self, ctx, party_id: str, old_option: str, *, new_ await ctx.send(f"✅ Renamed role `{old_option}` to `{new_option}` in party `{party_id}`.") - @party.group(name="template") + @party.hybrid_group(name="template") @commands.guild_only() async def party_template(self, ctx): """Manage party templates. @@ -1788,7 +1788,7 @@ async def party_template(self, ctx): Bot owner can create global templates available across all guilds. """ - @party_template.command(name="create") + @party_template.hybrid_command(name="create") @checks.admin_or_permissions(manage_guild=True) async def party_template_create(self, ctx, name: str, *, roles: str): """Create a guild-specific party template with predefined roles. @@ -1820,7 +1820,7 @@ async def party_template_create(self, ctx, name: str, *, roles: str): f"✅ Guild template `{name}` created with {len(roles_list)} role(s): {', '.join(roles_list)}" ) - @party_template.command(name="global-create") + @party_template.hybrid_command(name="global-create") @checks.is_owner() async def party_template_global_create(self, ctx, name: str, *, roles: str): """Create a global party template accessible across all guilds (bot owner only). @@ -1852,7 +1852,7 @@ async def party_template_global_create(self, ctx, name: str, *, roles: str): f"✅ Global template `{name}` created with {len(roles_list)} role(s): {', '.join(roles_list)}" ) - @party_template.command(name="delete") + @party_template.hybrid_command(name="delete") @checks.admin_or_permissions(manage_guild=True) async def party_template_delete(self, ctx, *, name: str): """Delete a guild-specific party template. @@ -1870,7 +1870,7 @@ async def party_template_delete(self, ctx, *, name: str): await ctx.send(f"✅ Guild template `{name}` deleted.") - @party_template.command(name="global-delete") + @party_template.hybrid_command(name="global-delete") @checks.is_owner() async def party_template_global_delete(self, ctx, *, name: str): """Delete a global party template (bot owner only). @@ -1886,7 +1886,7 @@ async def party_template_global_delete(self, ctx, *, name: str): await ctx.send(f"✅ Global template `{name}` deleted.") - @party_template.command(name="list") + @party_template.hybrid_command(name="list") async def party_template_list(self, ctx): """List all available party templates (global and guild-specific). @@ -1919,7 +1919,7 @@ async def party_template_list(self, ctx): await ctx.send(embed=embed) - @party_template.command(name="use") + @party_template.hybrid_command(name="use") async def party_template_use(self, ctx, template_name: str, *, title: str): """Create a party from a template with a custom title. From 47dd1bb39d050d8046fec641f412f96c51030905 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:04:26 +0000 Subject: [PATCH 2/3] Fix: use .command() and .group() on HybridGroup objects instead of non-existent .hybrid_command()/.hybrid_group() Agent-Logs-Url: https://github.com/psykzz/cogs/sessions/0adbf7cb-0d3b-4316-81f8-9bbc801d31c9 Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com> --- party/party.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/party/party.py b/party/party.py index 494ca18..0506132 100644 --- a/party/party.py +++ b/party/party.py @@ -1262,7 +1262,7 @@ async def create_party_embed(self, party: dict, guild: discord.Guild = None) -> async def party(self, ctx): """Party management commands.""" - @party.hybrid_command(name="create") + @party.command(name="create") async def party_create( self, ctx, @@ -1424,7 +1424,7 @@ async def modal_button_callback(interaction: discord.Interaction): # Bot doesn't have permission to delete messages pass - @party.hybrid_command(name="delete") + @party.command(name="delete") async def party_delete(self, ctx, *, party_identifier: str): """Delete a party by ID or title. @@ -1500,7 +1500,7 @@ async def party_delete(self, ctx, *, party_identifier: str): await ctx.send(f"✅ Party `{party_id}` ({party['name']}) deleted.") - @party.hybrid_command(name="list") + @party.command(name="list") async def party_list(self, ctx): """List all active parties in this server. @@ -1554,7 +1554,7 @@ async def party_list(self, ctx): await ctx.send(embed=embed) - @party.hybrid_command(name="config") + @party.command(name="config") @checks.admin_or_permissions(manage_guild=True) async def party_config(self, ctx, setting: str, value: str): """Configure party settings for this server. @@ -1578,7 +1578,7 @@ async def party_config(self, ctx, setting: str, value: str): else: await ctx.send(f"❌ Unknown setting: `{setting}`") - @party.hybrid_command(name="description") + @party.command(name="description") async def party_description(self, ctx, party_id: str, *, description: str): """Set the description for a party. @@ -1624,7 +1624,7 @@ async def party_description(self, ctx, party_id: str, *, description: str): await ctx.send(f"✅ Description updated for party `{party_id}`.") - @party.hybrid_command(name="settime") + @party.command(name="settime") async def party_settime(self, ctx, party_id: str, *, scheduled_time: str): """Set or clear the scheduled date and time for a party (UTC). @@ -1702,7 +1702,7 @@ def _fmt_ts(ts): f"✅ Scheduled time set for party `{party_id}`: ()" ) - @party.hybrid_command(name="rename-option") + @party.command(name="rename-option") async def party_rename_option(self, ctx, party_id: str, old_option: str, *, new_option: str): """Rename an option/role in a party. @@ -1779,7 +1779,7 @@ async def party_rename_option(self, ctx, party_id: str, old_option: str, *, new_ await ctx.send(f"✅ Renamed role `{old_option}` to `{new_option}` in party `{party_id}`.") - @party.hybrid_group(name="template") + @party.group(name="template") @commands.guild_only() async def party_template(self, ctx): """Manage party templates. @@ -1788,7 +1788,7 @@ async def party_template(self, ctx): Bot owner can create global templates available across all guilds. """ - @party_template.hybrid_command(name="create") + @party_template.command(name="create") @checks.admin_or_permissions(manage_guild=True) async def party_template_create(self, ctx, name: str, *, roles: str): """Create a guild-specific party template with predefined roles. @@ -1820,7 +1820,7 @@ async def party_template_create(self, ctx, name: str, *, roles: str): f"✅ Guild template `{name}` created with {len(roles_list)} role(s): {', '.join(roles_list)}" ) - @party_template.hybrid_command(name="global-create") + @party_template.command(name="global-create") @checks.is_owner() async def party_template_global_create(self, ctx, name: str, *, roles: str): """Create a global party template accessible across all guilds (bot owner only). @@ -1852,7 +1852,7 @@ async def party_template_global_create(self, ctx, name: str, *, roles: str): f"✅ Global template `{name}` created with {len(roles_list)} role(s): {', '.join(roles_list)}" ) - @party_template.hybrid_command(name="delete") + @party_template.command(name="delete") @checks.admin_or_permissions(manage_guild=True) async def party_template_delete(self, ctx, *, name: str): """Delete a guild-specific party template. @@ -1870,7 +1870,7 @@ async def party_template_delete(self, ctx, *, name: str): await ctx.send(f"✅ Guild template `{name}` deleted.") - @party_template.hybrid_command(name="global-delete") + @party_template.command(name="global-delete") @checks.is_owner() async def party_template_global_delete(self, ctx, *, name: str): """Delete a global party template (bot owner only). @@ -1886,7 +1886,7 @@ async def party_template_global_delete(self, ctx, *, name: str): await ctx.send(f"✅ Global template `{name}` deleted.") - @party_template.hybrid_command(name="list") + @party_template.command(name="list") async def party_template_list(self, ctx): """List all available party templates (global and guild-specific). @@ -1919,7 +1919,7 @@ async def party_template_list(self, ctx): await ctx.send(embed=embed) - @party_template.hybrid_command(name="use") + @party_template.command(name="use") async def party_template_use(self, ctx, template_name: str, *, title: str): """Create a party from a template with a custom title. From 2e01b30658b54fcdb891bfe1c54876fbee9b7879 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 21:27:21 +0000 Subject: [PATCH 3/3] Fix ctx.message.delete() AttributeError when party commands used as slash commands Agent-Logs-Url: https://github.com/psykzz/cogs/sessions/17f33502-c033-4f4f-940f-5c39bdbdd2f6 Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com> --- party/party.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/party/party.py b/party/party.py index 0506132..2c694c5 100644 --- a/party/party.py +++ b/party/party.py @@ -1414,15 +1414,12 @@ async def modal_button_callback(interaction: discord.Interaction): await ctx.send(f"✅ Party created! ID: `{party_id}`", delete_after=10) - # Delete the original command message - try: - await ctx.message.delete() - except discord.NotFound: - # Message already deleted - pass - except discord.Forbidden: - # Bot doesn't have permission to delete messages - pass + # Delete the original command message (not applicable for slash commands) + if not ctx.interaction: + try: + await ctx.message.delete() + except (discord.NotFound, discord.Forbidden): + pass @party.command(name="delete") async def party_delete(self, ctx, *, party_identifier: str): @@ -2011,8 +2008,9 @@ async def party_template_use(self, ctx, template_name: str, *, title: str): delete_after=10 ) - # Delete the original command message - try: - await ctx.message.delete() - except (discord.NotFound, discord.Forbidden): - pass + # Delete the original command message (not applicable for slash commands) + if not ctx.interaction: + try: + await ctx.message.delete() + except (discord.NotFound, discord.Forbidden): + pass