|
@ -43,6 +43,7 @@ from typing import ( |
|
|
Union, |
|
|
Union, |
|
|
runtime_checkable, |
|
|
runtime_checkable, |
|
|
) |
|
|
) |
|
|
|
|
|
import types |
|
|
|
|
|
|
|
|
import discord |
|
|
import discord |
|
|
|
|
|
|
|
@ -1015,8 +1016,11 @@ class Greedy(List[T]): |
|
|
raise TypeError('Greedy[...] only takes a single argument') |
|
|
raise TypeError('Greedy[...] only takes a single argument') |
|
|
converter = params[0] |
|
|
converter = params[0] |
|
|
|
|
|
|
|
|
origin = getattr(converter, '__origin__', None) |
|
|
|
|
|
args = getattr(converter, '__args__', ()) |
|
|
args = getattr(converter, '__args__', ()) |
|
|
|
|
|
if discord.utils.PY_310 and converter.__class__ is types.UnionType: # type: ignore |
|
|
|
|
|
converter = Union[args] # type: ignore |
|
|
|
|
|
|
|
|
|
|
|
origin = getattr(converter, '__origin__', None) |
|
|
|
|
|
|
|
|
if not (callable(converter) or isinstance(converter, Converter) or origin is not None): |
|
|
if not (callable(converter) or isinstance(converter, Converter) or origin is not None): |
|
|
raise TypeError('Greedy[...] expects a type or a Converter instance.') |
|
|
raise TypeError('Greedy[...] expects a type or a Converter instance.') |
|
|