mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[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:
parent
c7fd64e0c8
commit
77235f7750
1
changelog.d/3241.misc.rst
Normal file
1
changelog.d/3241.misc.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
implements ``__call__`` for commands
|
||||||
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user