Skip to content
This repository was archived by the owner on Aug 28, 2019. It is now read-only.

Commit 5d1b63b

Browse files
Gobot1234Rapptz
andauthored
[docs] Add async with documentation for Client
Co-authored-by: Rapptz <1695103+Rapptz@users.noreply.github.com>
1 parent 1f053e0 commit 5d1b63b

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

discord/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ class Client:
117117
r"""Represents a client connection that connects to Discord.
118118
This class is used to interact with the Discord WebSocket and API.
119119
120+
.. container:: operations
121+
122+
.. describe:: async with x
123+
124+
Asynchronously initialises the client and automatically cleans up.
125+
126+
.. versionadded:: 2.0
127+
120128
A number of options can be passed to the :class:`Client`.
121129
122130
Parameters

discord/ext/commands/bot.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,14 @@ class Bot(BotBase, discord.Client):
13871387
a :class:`~discord.app_commands.CommandTree` and is automatically set upon
13881388
instantiating the class.
13891389
1390+
.. container:: operations
1391+
1392+
.. describe:: async with x
1393+
1394+
Asynchronously initialises the bot and automatically cleans up.
1395+
1396+
.. versionadded:: 2.0
1397+
13901398
Attributes
13911399
-----------
13921400
command_prefix
@@ -1457,6 +1465,14 @@ class Bot(BotBase, discord.Client):
14571465
class AutoShardedBot(BotBase, discord.AutoShardedClient):
14581466
"""This is similar to :class:`.Bot` except that it is inherited from
14591467
:class:`discord.AutoShardedClient` instead.
1468+
1469+
.. container:: operations
1470+
1471+
.. describe:: async with x
1472+
1473+
Asynchronously initialises the bot and automatically cleans.
1474+
1475+
.. versionadded:: 2.0
14601476
"""
14611477

14621478
pass

discord/shard.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,14 @@ class AutoShardedClient(Client):
308308
if this is used. By default, when omitted, the client will launch shards from
309309
0 to ``shard_count - 1``.
310310
311+
.. container:: operations
312+
313+
.. describe:: async with x
314+
315+
Asynchronously initialises the client and automatically.
316+
317+
.. versionadded:: 2.0
318+
311319
Attributes
312320
------------
313321
shard_ids: Optional[List[:class:`int`]]

0 commit comments

Comments
 (0)