From b96d31aedcb2834e18b179a0607b9f9b0d63196d Mon Sep 17 00:00:00 2001 From: dolfies Date: Fri, 12 Nov 2021 20:52:22 -0500 Subject: [PATCH] Add a few things to docs --- discord/__init__.py | 3 ++ discord/client.py | 4 +-- discord/errors.py | 2 +- discord/settings.py | 1 - docs/api.rst | 77 ++++++++++++++++++++++++++++++++++++++++----- 5 files changed, 75 insertions(+), 12 deletions(-) diff --git a/discord/__init__.py b/discord/__init__.py index f4149fb14..f31dc8592 100644 --- a/discord/__init__.py +++ b/discord/__init__.py @@ -57,6 +57,9 @@ from .sticker import * from .stage_instance import * from .components import * from .threads import * +from .relationship import * +from .guild_folder import * +from .settings import * class _VersionInfo(NamedTuple): diff --git a/discord/client.py b/discord/client.py index 9e0a4e914..ee5db7595 100644 --- a/discord/client.py +++ b/discord/client.py @@ -147,7 +147,7 @@ class Client: If not given, defaults to off. .. versionadded:: 1.9 - request_guilds :class:`bool` + request_guilds: :class:`bool` Whether to request guilds at startup (behaves similarly to the old guild_subscriptions option). Defaults to True. @@ -1686,7 +1686,7 @@ class Client: return note async def fetch_private_channels(self) -> List[PrivateChannel]: - """|coro + """|coro| Retrieves all your private channels. diff --git a/discord/errors.py b/discord/errors.py index 3d236e793..80c964f53 100644 --- a/discord/errors.py +++ b/discord/errors.py @@ -113,7 +113,7 @@ class HTTPException(DiscordException): The status code of the HTTP request. code: :class:`int` The Discord specific error code for the failure. - json: Dict[any, any] + json: :class:`dict` The raw error JSON. """ def __init__(self, response: _ResponseType, message: Optional[Union[str, Dict[str, Any]]]): diff --git a/discord/settings.py b/discord/settings.py index 0514e4531..26f53769d 100644 --- a/discord/settings.py +++ b/discord/settings.py @@ -258,7 +258,6 @@ class ChannelSettings: self._update(data) def _update(self, data: Dict[str, Any]) -> None: - breakpoint() self._channel_id = int(data['channel_id']) self.collapsed = data.get('collapsed', False) diff --git a/docs/api.rst b/docs/api.rst index 6bc1db630..4da3ade20 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3,7 +3,7 @@ API Reference =============== -The following section outlines the API of discord.py. +The following section outlines the API of discord.py-self. .. note:: @@ -11,7 +11,7 @@ The following section outlines the API of discord.py. in an output independent way. If the logging module is not configured, these logs will not be output anywhere. See :ref:`logging_setup` for more information on how to set up and use the logging module with - discord.py. + discord.py-self. Version Related Info --------------------- @@ -186,8 +186,7 @@ to handle it, which defaults to print a traceback and ignoring the exception. .. warning:: All the events must be a |coroutine_link|_. If they aren't, then you might get unexpected - errors. In order to turn a function into a coroutine they must be ``async def`` - functions. + errors. In order to turn a function into a coroutine they must be defined with ``async def``. .. function:: on_connect() @@ -308,10 +307,10 @@ to handle it, which defaults to print a traceback and ignoring the exception. Called when someone begins typing a message. The ``channel`` parameter can be a :class:`abc.Messageable` instance. - Which could either be :class:`TextChannel`, :class:`GroupChannel`, or + Which could either be :class:`TextChannel`, :class:`GroupChannel`, :class:`Thread`, or :class:`DMChannel`. - If the ``channel`` is a :class:`TextChannel` then the ``user`` parameter + If the ``channel`` is a :class:`TextChannel` or :class:`Thread` then the ``user`` parameter is a :class:`Member`, otherwise it is a :class:`User`. @@ -462,7 +461,9 @@ to handle it, which defaults to print a traceback and ignoring the exception. - .. note:: + .. + + todo: check this out This doesn't require :attr:`Intents.members` within a guild context, but due to Discord not providing updated user information in a direct message @@ -2013,7 +2014,8 @@ of :class:`enum.Enum`. - :attr:`~AuditLogDiff.channel` - :attr:`~AuditLogDiff.name` - - :attr:`~AuditLogDiff.type` (always set to ``1`` if so) + - :attr:`~AuditLogDif + .. attribute:: verified_bot_developerf.type` (always set to ``1`` if so) .. attribute:: emoji_create @@ -2375,6 +2377,11 @@ of :class:`enum.Enum`. Represents the default avatar with the color red. See also :attr:`Colour.red` + .. attribute:: pink + + Represents the default avatar with the color pink. + This is not currently used in the client. + .. class:: StickerType Represents the type of sticker. @@ -3308,6 +3315,33 @@ User .. automethod:: typing :async-with: +Profile +~~~~~~~~ + +.. attributetable:: Profile + +.. autoclass:: Profile() + :members: + :inherited-members: + +Relationship +~~~~~~~~~~~~~ + +.. attributetable:: Relationship + +.. autoclass:: Relationship() + :members: + :inherited-members: + +UserSettings +~~~~~~~~~~~~~ + +.. attributetable:: UserSettings + +.. autoclass:: UserSettings() + :members: + :inherited-members: + Attachment ~~~~~~~~~~~ @@ -3416,6 +3450,33 @@ Guild :type: :class:`User` +GuildFolder +~~~~~~~~~~~~ + +.. attributetable:: GuildFolder + +.. autoclass:: GuildFolder() + :members: + :inherited-members: + +GuildSettings +~~~~~~~~~~~~~~ + +.. attributetable:: GuildSettings + +.. autoclass:: GuildSettings() + :members: + :inherited-members: + +ChannelSettings +~~~~~~~~~~~~~~~~ + +.. attributetable:: ChannelSettings + +.. autoclass:: ChannelSettings() + :members: + :inherited-members: + Integration ~~~~~~~~~~~~