fix: Await asynchronous command creation in GuildCommandSyncer

This commit is contained in:
Slipstream 2025-05-26 16:26:58 -06:00
parent d89645ca28
commit b7321f9bed
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -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