[commands] Allow passing of typing.Union into Greedy. Fix #1951

This commit is contained in:
Rapptz 2019-03-03 06:24:35 -05:00
parent 97de4542f7
commit 45af9fa40b

View File

@ -500,7 +500,7 @@ class _Greedy:
raise TypeError('Greedy[...] only takes a single argument') raise TypeError('Greedy[...] only takes a single argument')
converter = params[0] converter = params[0]
if not inspect.isclass(converter) and not isinstance(converter, Converter): if not inspect.isclass(converter) and not isinstance(converter, Converter) and not hasattr(converter, '__origin__'):
raise TypeError('Greedy[...] expects a type or a Converter instance.') raise TypeError('Greedy[...] expects a type or a Converter instance.')
if converter is str or converter is type(None) or converter is _Greedy: if converter is str or converter is type(None) or converter is _Greedy: