From 5858c44f6333c5def4488c7d233b3d793614e129 Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Sun, 12 Jun 2022 21:06:44 +0100 Subject: [PATCH] [docs] Add async with documentation for Client Co-authored-by: Rapptz <1695103+Rapptz@users.noreply.github.com> --- discord/client.py | 8 ++++++++ discord/ext/commands/bot.py | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/discord/client.py b/discord/client.py index 38f125576..1b6e01e8e 100644 --- a/discord/client.py +++ b/discord/client.py @@ -136,6 +136,14 @@ class Client: r"""Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API. + .. container:: operations + + .. describe:: async with x + + Asynchronously initialises the client and automatically cleans up. + + .. versionadded:: 2.0 + A number of options can be passed to the :class:`Client`. Parameters diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 57d8af9a5..542496435 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -1220,6 +1220,14 @@ class Bot(BotBase, discord.Client): This class also subclasses :class:`.GroupMixin` to provide the functionality to manage commands. + .. container:: operations + + .. describe:: async with x + + Asynchronously initialises the bot and automatically cleans up. + + .. versionadded:: 2.0 + Attributes ----------- command_prefix @@ -1277,3 +1285,5 @@ class Bot(BotBase, discord.Client): .. versionadded:: 1.7 """ + + pass