aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-02-23 22:19:07 -0500
committerRapptz <[email protected]>2017-02-23 22:19:07 -0500
commit9d4f3ebb431df19892a18b9e5cf6be75e6d92bbd (patch)
treef5bb31276326558b6edd6ef2e5ae89c1f82c3cf3
parentRemove Client.email attribute. (diff)
downloaddiscord.py-9d4f3ebb431df19892a18b9e5cf6be75e6d92bbd.tar.xz
discord.py-9d4f3ebb431df19892a18b9e5cf6be75e6d92bbd.zip
Miscellaneous documentation fixes in Client.wait_for
-rw-r--r--discord/client.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/discord/client.py b/discord/client.py
index e3519a27..855d72ba 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -79,7 +79,7 @@ class Client:
The maximum number of messages to store in :attr:`messages`.
This defaults to 5000. Passing in `None` or a value less than 100
will use the default instead of the passed in value.
- loop : Optional[event loop].
+ loop : Optional[event loop]
The `event loop`_ to use for asynchronous operations. Defaults to ``None``,
in which case the default event loop is used via ``asyncio.get_event_loop()``.
connector : aiohttp.BaseConnector
@@ -582,6 +582,8 @@ class Client:
This function returns the **first event that meets the requirements**.
+ .. _asyncio.wait_for: https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for
+
Examples
---------
@@ -590,13 +592,14 @@ class Client:
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
- await message.channel.send('Say hello!')
+ channel = message.channel
+ await channel.send('Say hello!')
def check(m):
- return m.content == 'hello' and m.channel == message.channel
+ return m.content == 'hello' and m.channel == channel
msg = await client.wait_for('message', check=check)
- await message.channel.send('Hello {.author}!'.format(msg))
+ await channel.send('Hello {.author}!'.format(msg))
Parameters
------------