diff --git a/discord/ext/commands/hybrid.py b/discord/ext/commands/hybrid.py index 0857003fa..f5814b502 100644 --- a/discord/ext/commands/hybrid.py +++ b/discord/ext/commands/hybrid.py @@ -277,7 +277,11 @@ def replace_parameters( ) -> List[inspect.Parameter]: # Need to convert commands.Parameter back to inspect.Parameter so this will be a bit ugly params = signature.parameters.copy() + + pending_rename: Dict[str, str] = {} + pending_description: Dict[str, str] = {} for name, parameter in parameters.items(): + converter = parameter.converter # Parameter.converter properly infers from the default and has a str default # This allows the actual signature to inherit this property @@ -288,6 +292,12 @@ def replace_parameters( default = _CallableDefault(parameter.default) if callable(parameter.default) else parameter.default param = param.replace(default=default) + if parameter.description: + pending_description[name] = parameter.description + + if parameter.displayed_name: + pending_rename[name] = parameter.displayed_name + if isinstance(param.default, Parameter): # If we're here, then it hasn't been handled yet so it should be removed completely param = param.replace(default=parameter.empty) @@ -299,6 +309,12 @@ def replace_parameters( params[name] = param + if pending_description: + app_commands.describe(**pending_description)(callback) + + if pending_rename: + app_commands.rename(**pending_rename)(callback) + return list(params.values())