[tasks] Remove support for awaitables due to gotchas.

Fixes #2079
This commit is contained in:
Rapptz
2019-04-29 03:18:25 -04:00
parent cef8677c68
commit 55e3e242ff
2 changed files with 17 additions and 37 deletions

View File

@ -74,26 +74,6 @@ Looping a certain amount of times before exiting:
Waiting until the bot is ready before the loop starts:
.. code-block:: python3
from discord.ext import tasks, commands
class MyCog(commands.Cog):
def __init__(self, bot):
self.index = 0
self.printer.before_loop(bot.wait_until_ready())
self.printer.start()
def cog_unload(self):
self.printer.cancel()
@tasks.loop(seconds=5.0)
async def printer(self):
print(self.index)
self.index += 1
:meth:`~.tasks.Loop.before_loop` can be used as a decorator as well:
.. code-block:: python3
from discord.ext import tasks, commands