Skip to content

Commit

Permalink
Add Annotated support
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmTomahawkx committed Sep 4, 2023
1 parent 80ca634 commit 8eb5a40
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions twitchio/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def _resolve_converter(self, converter: Union[Callable, Awaitable, type]) -> Cal
elif isinstance(converter, types.UnionType) or getattr(converter, "__origin__", None) is Union:
return self.resolve_union_callback(converter) # type: ignore

elif hasattr(converter, "__metadata__"): # Annotated
annotated = converter.__metadata__ # type: ignore
return self._resolve_converter(annotated[0])

if converter is bool:
converter = _boolconverter

Expand Down

0 comments on commit 8eb5a40

Please sign in to comment.