aboutsummaryrefslogtreecommitdiff
path: root/discord/ext/tasks
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-12-14 22:11:37 -0500
committerRapptz <[email protected]>2020-12-14 22:11:37 -0500
commit0216db0c0ade068a635155fab093e5fba506927d (patch)
tree024cfc3a88cb954c1d59910453cedf8283bc276e /discord/ext/tasks
parentUpdate Windows opus binaries from 1.2.1 to 1.3.1 (diff)
downloaddiscord.py-0216db0c0ade068a635155fab093e5fba506927d.tar.xz
discord.py-0216db0c0ade068a635155fab093e5fba506927d.zip
[tasks] Add support for manually calling the wrapped coroutine
Diffstat (limited to 'discord/ext/tasks')
-rw-r--r--discord/ext/tasks/__init__.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py
index 24128eaf..9c52a71a 100644
--- a/discord/ext/tasks/__init__.py
+++ b/discord/ext/tasks/__init__.py
@@ -160,6 +160,26 @@ class Loop:
return None
return self._next_iteration
+ async def __call__(self, *args, **kwargs):
+ """|coro|
+
+ Calls the internal callback that the command holds.
+
+ .. versionadded:: 1.6
+
+ Parameters
+ ------------
+ \*args
+ The arguments to use.
+ \*\*kwargs
+ The keyword arguments to use.
+ """
+
+ if self._injected is not None:
+ args = (self._injected, *args)
+
+ return await self.coro(*args, **kwargs)
+
def start(self, *args, **kwargs):
r"""Starts the internal task in the event loop.