mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-04 11:02:37 +00:00
Fix README example code.
This commit is contained in:
parent
ba3e00c3bf
commit
ca450fb0e4
@ -46,6 +46,7 @@ Note that this requires `git` to be installed.
|
||||
|
||||
```py
|
||||
import discord
|
||||
import asyncio
|
||||
|
||||
client = discord.Client()
|
||||
|
||||
@ -76,8 +77,12 @@ def main_task():
|
||||
yield from client.connect()
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(main_task())
|
||||
loop.close()
|
||||
try:
|
||||
loop.run_until_complete(main_task())
|
||||
except Exception:
|
||||
loop.run_until_complete(client.close())
|
||||
finally:
|
||||
loop.close()
|
||||
```
|
||||
|
||||
You can find examples in the examples directory.
|
||||
|
Loading…
x
Reference in New Issue
Block a user