Skip to content

Commit

Permalink
fix: properly parse converters for hybrid commands (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS authored Jul 10, 2023
1 parent 074f867 commit bbf779b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions interactions/ext/hybrid_commands/hybrid_slash.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
BaseChannelConverter,
ChannelType,
BaseChannel,
BaseCommand,
MemberConverter,
UserConverter,
RoleConverter,
Expand Down Expand Up @@ -177,7 +176,7 @@ class ChainConverter(Converter):
def __init__(
self,
first_converter: Converter,
second_converter: type[Converter] | Converter,
second_converter: Callable,
name_of_cmd: str,
) -> None:
self.first_converter = first_converter
Expand All @@ -186,16 +185,14 @@ def __init__(

async def convert(self, ctx: BaseContext, arg: str) -> Any:
first = await self.first_converter.convert(ctx, arg)
return await maybe_coroutine(
BaseCommand._get_converter_function(self.second_converter, self.name_of_cmd)(ctx, first)
)
return await maybe_coroutine(self.second_converter, ctx, first)


class ChainNoArgConverter(NoArgumentConverter):
def __init__(
self,
first_converter: NoArgumentConverter,
second_converter: type[Converter] | Converter,
second_converter: Callable,
name_of_cmd: str,
) -> None:
self.first_converter = first_converter
Expand All @@ -204,9 +201,7 @@ def __init__(

async def convert(self, ctx: "HybridContext", _: Any) -> Any:
first = await self.first_converter.convert(ctx, _)
return await maybe_coroutine(
BaseCommand._get_converter_function(self.second_converter, self.name_of_cmd)(ctx, first)
)
return await maybe_coroutine(self.second_converter, ctx, first)


def type_from_option(option_type: OptionType | int) -> Converter:
Expand Down

0 comments on commit bbf779b

Please sign in to comment.