Browse Source

Miscellaneous documentation fixes in Client.wait_for

pull/1278/head
Rapptz 8 years ago
parent
commit
9d4f3ebb43
  1. 11
      discord/client.py

11
discord/client.py

@ -79,7 +79,7 @@ class Client:
The maximum number of messages to store in :attr:`messages`. The maximum number of messages to store in :attr:`messages`.
This defaults to 5000. Passing in `None` or a value less than 100 This defaults to 5000. Passing in `None` or a value less than 100
will use the default instead of the passed in value. 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``, 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()``. in which case the default event loop is used via ``asyncio.get_event_loop()``.
connector : aiohttp.BaseConnector connector : aiohttp.BaseConnector
@ -582,6 +582,8 @@ class Client:
This function returns the **first event that meets the requirements**. 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 Examples
--------- ---------
@ -590,13 +592,14 @@ class Client:
@client.event @client.event
async def on_message(message): async def on_message(message):
if message.content.startswith('$greet'): if message.content.startswith('$greet'):
await message.channel.send('Say hello!') channel = message.channel
await channel.send('Say hello!')
def check(m): 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) msg = await client.wait_for('message', check=check)
await message.channel.send('Hello {.author}!'.format(msg)) await channel.send('Hello {.author}!'.format(msg))
Parameters Parameters
------------ ------------

Loading…
Cancel
Save