Browse Source

[commands] Revert conversion code back to how it was originally

pull/6658/head
Rapptz 4 years ago
parent
commit
ee5bb07c02
  1. 15
      discord/ext/commands/core.py

15
discord/ext/commands/core.py

@ -444,14 +444,13 @@ class Command(_BaseCommand):
try: try:
if inspect.isclass(converter): if inspect.isclass(converter):
if inspect.ismethod(getattr(converter, 'convert', None)): if issubclass(converter, converters.Converter):
if converter.convert.__self__ is converter: instance = converter()
# class method return await instance.convert(ctx, argument)
func = converter.convert else:
else: method = getattr(converter, 'convert', None)
# instance method if method is not None and inspect.ismethod(method):
func = converter().convert return await method(ctx, argument)
return await func.convert(ctx, argument)
elif isinstance(converter, converters.Converter): elif isinstance(converter, converters.Converter):
return await converter.convert(ctx, argument) return await converter.convert(ctx, argument)
except CommandError: except CommandError:

Loading…
Cancel
Save