diff options
| author | James <[email protected]> | 2020-01-27 17:07:39 +0000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-04-04 03:02:10 -0400 |
| commit | 6a30f2749fef5b64563a81a4c45cb41dae15dfb3 (patch) | |
| tree | 00aaf7e93b780bf266c80efda64f2022e89bd178 | |
| parent | Added VoiceClient.latency and VoiceClient.average_latency (diff) | |
| download | discord.py-6a30f2749fef5b64563a81a4c45cb41dae15dfb3.tar.xz discord.py-6a30f2749fef5b64563a81a4c45cb41dae15dfb3.zip | |
[tasks] Add is_running property to Loop
| -rw-r--r-- | discord/ext/tasks/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py index b33a1b0c..266ee8c8 100644 --- a/discord/ext/tasks/__init__.py +++ b/discord/ext/tasks/__init__.py @@ -276,6 +276,13 @@ class Loop: """ return self._has_failed + def is_running(self): + """:class:`bool`: Check if the task is currently running. + + .. versionadded:: 1.4 + """ + return not bool(self._task.done()) if self._task else False + def before_loop(self, coro): """A decorator that registers a coroutine to be called before the loop starts running. |