Skip to content

Commit 2f0c251

Browse files
authored
Merge pull request #648 from Dorukyum/fix-converters
Fix converters
2 parents 51dd856 + 0c1f30c commit 2f0c251

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

discord/commands/commands.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
529529
if arg is None:
530530
arg = ctx.guild.get_role(arg_id) or arg_id
531531

532-
elif op.input_type == SlashCommandOptionType.string and op._converter is not None:
533-
arg = await op._converter.convert(ctx, arg)
532+
elif op.input_type == SlashCommandOptionType.string and (converter := op.converter) is not None:
533+
arg = await converter.convert(converter, ctx, arg)
534534

535535
kwargs[op._parameter_name] = arg
536536

@@ -626,11 +626,11 @@ def __init__(
626626
) -> None:
627627
self.name: Optional[str] = kwargs.pop("name", None)
628628
self.description = description or "No description provided"
629-
self._converter = None
629+
self.converter = None
630630
self.channel_types: List[SlashCommandOptionType] = kwargs.pop("channel_types", [])
631631
if not isinstance(input_type, SlashCommandOptionType):
632632
if hasattr(input_type, "convert"):
633-
self._converter = input_type
633+
self.converter = input_type
634634
input_type = SlashCommandOptionType.string
635635
else:
636636
_type = SlashCommandOptionType.from_datatype(input_type)

0 commit comments

Comments
 (0)