Skip to content

Commit d31309a

Browse files
authored
Merge pull request #374 from Dorukyum/option-different-param-name
Options having different names than parameter name
2 parents ffe0cba + ff9d174 commit d31309a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

discord/commands/commands.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ def _parse_options(self, params) -> List[Option]:
421421

422422
if option.name is None:
423423
option.name = p_name
424+
option._parameter_name = p_name
424425

425426
final_options.append(option)
426427

@@ -479,11 +480,11 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
479480
elif op.input_type == SlashCommandOptionType.string and op._converter is not None:
480481
arg = await op._converter.convert(ctx, arg)
481482

482-
kwargs[op.name] = arg
483+
kwargs[op._parameter_name] = arg
483484

484485
for o in self.options:
485-
if o.name not in kwargs:
486-
kwargs[o.name] = o.default
486+
if o._parameter_name not in kwargs:
487+
kwargs[o._parameter_name] = o.default
487488

488489
if self.cog is not None:
489490
await self.callback(self.cog, ctx, **kwargs)

0 commit comments

Comments
 (0)