From b7321f9bed8b65a9267da0bd6bb3bcafce6910bf Mon Sep 17 00:00:00 2001 From: Slipstream Date: Mon, 26 May 2025 16:26:58 -0600 Subject: [PATCH] fix: Await asynchronous command creation in GuildCommandSyncer --- command_customization.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/command_customization.py b/command_customization.py index a5bfc6d..9578dd8 100644 --- a/command_customization.py +++ b/command_customization.py @@ -81,7 +81,7 @@ class GuildCommandSyncer: custom_name = custom_data.get('name', cmd.name) # Create a copy of the command with the custom name and description - custom_cmd = self._create_custom_command(cmd, custom_name) + custom_cmd = await self._create_custom_command(cmd, custom_name) guild_commands.append(custom_cmd) else: # Use the original command @@ -95,7 +95,7 @@ class GuildCommandSyncer: return guild_commands - def _create_custom_command(self, original_cmd: app_commands.Command, custom_name: str) -> app_commands.Command: + async def _create_custom_command(self, original_cmd: app_commands.Command, custom_name: str) -> app_commands.Command: """ Create a copy of a command with a custom name and description. This is a simplified version - in practice, you'd need to handle all command attributes. @@ -104,10 +104,7 @@ class GuildCommandSyncer: custom_description = None if hasattr(original_cmd, 'guild_id') and original_cmd.guild_id: # This is a guild-specific command, get the custom description - custom_description = asyncio.run_coroutine_threadsafe( - settings_manager.get_custom_command_description(original_cmd.guild_id, original_cmd.name), - asyncio.get_event_loop() - ).result() + custom_description = await settings_manager.get_custom_command_description(original_cmd.guild_id, original_cmd.name) # For simplicity, we're just creating a basic copy with the custom name and description # In a real implementation, you'd need to handle all command attributes and options