diff options
Diffstat (limited to 'examples/background_task.py')
| -rw-r--r-- | examples/background_task.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/background_task.py b/examples/background_task.py index 7da6b7b9..d08415e3 100644 --- a/examples/background_task.py +++ b/examples/background_task.py @@ -3,18 +3,17 @@ import asyncio client = discord.Client() -def my_background_task(): - yield from client.wait_until_ready() +async def my_background_task(): + await client.wait_until_ready() counter = 0 channel = discord.Object(id='channel_id_here') while not client.is_closed: counter += 1 - yield from client.send_message(channel, counter) - yield from asyncio.sleep(60) # task runs every 60 seconds + await client.send_message(channel, counter) + await asyncio.sleep(60) # task runs every 60 seconds [email protected]_event -def on_ready(): +async def on_ready(): print('Logged in as') print(client.user.name) print(client.user.id) |