diff options
| author | Michael H <[email protected]> | 2021-04-05 20:25:23 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-05 20:25:23 -0400 |
| commit | fbe6e2f520ddd27dcbb740d8732165f9adec8293 (patch) | |
| tree | d5da9f2424237d06dc012295bff6ed5b56514ab4 | |
| parent | Fix versionadded not showing in docs for Attachment.content_type (diff) | |
| download | discord.py-fbe6e2f520ddd27dcbb740d8732165f9adec8293.tar.xz discord.py-fbe6e2f520ddd27dcbb740d8732165f9adec8293.zip | |
[commands] Fix @classmethod converters
| -rw-r--r-- | discord/ext/commands/core.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index ec2e7deb..57c97daa 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -444,13 +444,16 @@ class Command(_BaseCommand): try: if inspect.isclass(converter): - if issubclass(converter, converters.Converter): - instance = converter() - ret = await instance.convert(ctx, argument) - return ret + if inspect.ismethod(converter.convert): + if converter.convert.__self__ is converter: + # class method + func = converter.convert + else: + # instance method + func = converter().convert + return await func.convert(ctx, argument) elif isinstance(converter, converters.Converter): - ret = await converter.convert(ctx, argument) - return ret + return await converter.convert(ctx, argument) except CommandError: raise except Exception as exc: |