[commands] Support callables in Greedy converter

This commit is contained in:
Rapptz 2019-04-13 07:28:26 -04:00
parent ac1b9f5628
commit 6574c97a8b

View File

@ -492,7 +492,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) and not hasattr(converter, '__origin__'): if not (callable(converter) or isinstance(converter, Converter) or 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: