Repository: Pycord-Development/pycord

Issue:
Cannot create an option in the slash command with a name that is different from the function parameter
### Summary

title

### Reproduction Steps

title

### Minimal Reproducible Code

```python
@bot.slash_command()
async def skin(
    ctx,
    champion: Option(str, name="campeão",),
) -> None:
    ...
```


### Expected Results

A mapping to save the parameter name and to revert the option name when the function gets called

### Actual Results

```
Ignoring exception in command <discord.app.commands.SlashCommand name=skin>:
Traceback (most recent call last):
  File "D:\Programming\Python\Elostar\.venv\lib\site-packages\discord\app\commands.py", line 77, in wrapped
    ret = await coro(arg)
  File "D:\Programming\Python\Elostar\.venv\lib\site-packages\discord\app\commands.py", line 415, in _invoke
    await self.callback(ctx, **kwargs)
TypeError: skin() got an unexpected keyword argument 'campeão'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Programming\Python\Elostar\.venv\lib\site-packages\discord\bot.py", line 218, in handle_interaction
    await ctx.command.invoke(ctx)
  File "D:\Programming\Python\Elostar\.venv\lib\site-packages\discord\app\commands.py", line 112, in invoke
    await injected(ctx)
  File "D:\Programming\Python\Elostar\.venv\lib\site-packages\discord\app\commands.py", line 83, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.app.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: skin() got an unexpected keyword 
argument 'campeão'
```

### Intents

all

### System Information

- Python v3.9.6-final
- pycord v2.0.0-alpha
    - pycord pkg_resources: v2.0.0a3832+g8c4b498e
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19043

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.

### Additional Context

_No response_


Discussion:
I don't seem to be able to reproduce on master. Are you certain the example is correct?
> I don't seem to be able to reproduce on master. Are you certain the example is correct?

The code can only be reproduced in the `slash` branch.
Can confirm this is currently on the master branch too.
Can repro

todo

Resolving patch:
diff --git a/discord/commands/commands.py b/discord/commands/commands.py
--- a/discord/commands/commands.py
+++ b/discord/commands/commands.py
@@ -421,6 +421,7 @@ def _parse_options(self, params) -> List[Option]:
 
             if option.name is None:
                 option.name = p_name
+            option._parameter_name = p_name
 
             final_options.append(option)
 
@@ -479,11 +480,11 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
             elif op.input_type == SlashCommandOptionType.string and op._converter is not None:
                 arg = await op._converter.convert(ctx, arg)
 
-            kwargs[op.name] = arg
+            kwargs[op._parameter_name] = arg
 
         for o in self.options:
-            if o.name not in kwargs:
-                kwargs[o.name] = o.default
+            if o._parameter_name not in kwargs:
+                kwargs[o._parameter_name] = o.default
         
         if self.cog is not None:
             await self.callback(self.cog, ctx, **kwargs)


Test patch: