[commands] Implement __call__ to commands.Command (#3241)

* This is technically awesome, but let's not document it for public use rn

* changelog
This commit is contained in:
Michael H 2020-01-20 17:23:15 -05:00 committed by jack1142
parent c7fd64e0c8
commit 77235f7750
2 changed files with 10 additions and 2 deletions

View File

@ -0,0 +1 @@
implements ``__call__`` for commands

View File

@ -201,6 +201,13 @@ class Command(CogCommandMixin, commands.Command):
""" """
def __call__(self, *args, **kwargs):
if self.cog:
# We need to inject cog as self here
return self.callback(self.cog, *args, **kwargs)
else:
return self.callback(*args, **kwargs)
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self._help_override = kwargs.pop("help_override", None) self._help_override = kwargs.pop("help_override", None)