mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Fix background task examples
This commit is contained in:
parent
9b77331603
commit
c95c163266
@ -9,6 +9,7 @@ class MyClient(discord.Client):
|
|||||||
# an attribute we can access from our task
|
# an attribute we can access from our task
|
||||||
self.counter = 0
|
self.counter = 0
|
||||||
|
|
||||||
|
async def setup_hook(self) -> None:
|
||||||
# start the task to run in the background
|
# start the task to run in the background
|
||||||
self.my_background_task.start()
|
self.my_background_task.start()
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ class MyClient(discord.Client):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
async def setup_hook(self) -> None:
|
||||||
# create the background task and run it in the background
|
# create the background task and run it in the background
|
||||||
self.bg_task = self.loop.create_task(self.my_background_task())
|
self.bg_task = self.loop.create_task(self.my_background_task())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user