From 5f1ab561746fd2385ec851f2cc81a7ec821847d2 Mon Sep 17 00:00:00 2001 From: dolfies Date: Sun, 10 Apr 2022 20:54:03 -0400 Subject: [PATCH] =?UTF-8?q?Docs=20are=20fun=20=F0=9F=98=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- discord/appinfo.py | 2 +- discord/client.py | 44 +++++++++---------- discord/commands.py | 2 +- discord/components.py | 4 +- discord/message.py | 2 +- discord/profile.py | 83 ++++++++++++++++++++++------------- docs/api.rst | 100 +++++++++++++++++++++--------------------- 7 files changed, 129 insertions(+), 108 deletions(-) diff --git a/discord/appinfo.py b/discord/appinfo.py index e409a80b4..9a8432dfb 100644 --- a/discord/appinfo.py +++ b/discord/appinfo.py @@ -560,7 +560,7 @@ class InteractionApplication(Hashable): Only available from :attr:`~Modal.application`. command_count: Optional[:class:`int`] The number of commands the application has. - Only available from :attr:`~discord.abc.ApplicationCommand.application`. + Only available from :attr:`~abc.BaseCommand.application`. """ __slots__ = ( diff --git a/discord/client.py b/discord/client.py index a83737e6c..f7c134bd7 100644 --- a/discord/client.py +++ b/discord/client.py @@ -724,7 +724,7 @@ class Client: @property def voice_client(self) -> Optional[VoiceProtocol]: - """Optional[:class:`VoiceProtocol`]: Returns the :class:`VoiceProtocol` associated with private calls, if any.""" + """Optional[:class:`.VoiceProtocol`]: Returns the :class:`VoiceProtocol` associated with private calls, if any.""" return self._connection._get_voice_client(self._connection.self_id) @property @@ -783,7 +783,7 @@ class Client: @property def status(self) -> Status: - """:class:`Status`: The user's overall status. + """:class:`.Status`: The user's overall status. .. versionadded:: 2.0 """ @@ -807,7 +807,7 @@ class Client: @property def mobile_status(self) -> Status: - """:class:`Status`: The user's status on a mobile device, if applicable. + """:class:`.Status`: The user's status on a mobile device, if applicable. .. versionadded:: 2.0 """ @@ -815,7 +815,7 @@ class Client: @property def desktop_status(self) -> Status: - """:class:`Status`: The user's status on the desktop client, if applicable. + """:class:`.Status`: The user's status on the desktop client, if applicable. .. versionadded:: 2.0 """ @@ -823,7 +823,7 @@ class Client: @property def web_status(self) -> Status: - """:class:`Status`: The user's status on the web client, if applicable. + """:class:`.Status`: The user's status on the web client, if applicable. .. versionadded:: 2.0 """ @@ -831,7 +831,7 @@ class Client: @property def client_status(self) -> Status: - """:class:`Status`: The library's status. + """:class:`.Status`: The library's status. .. versionadded:: 2.0 """ @@ -849,7 +849,7 @@ class Client: @property def activities(self) -> Tuple[ActivityTypes]: - """Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the activities + """Tuple[Union[:class:`.BaseActivity`, :class:`.Spotify`]]: Returns the activities the client is currently doing. .. versionadded:: 2.0 @@ -889,7 +889,7 @@ class Client: @property def mobile_activities(self) -> Tuple[ActivityTypes]: - """Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the activities + """Tuple[Union[:class:`.BaseActivity`, :class:`.Spotify`]]: Returns the activities the client is currently doing on a mobile device, if applicable. .. versionadded:: 2.0 @@ -899,7 +899,7 @@ class Client: @property def desktop_activities(self) -> Tuple[ActivityTypes]: - """Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the activities + """Tuple[Union[:class:`.BaseActivity`, :class:`.Spotify`]]: Returns the activities the client is currently doing on the desktop client, if applicable. .. versionadded:: 2.0 @@ -909,7 +909,7 @@ class Client: @property def web_activities(self) -> Tuple[ActivityTypes]: - """Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the activities + """Tuple[Union[:class:`.BaseActivity`, :class:`.Spotify`]]: Returns the activities the client is currently doing on the web client, if applicable. .. versionadded:: 2.0 @@ -919,7 +919,7 @@ class Client: @property def client_activities(self) -> Tuple[ActivityTypes]: - """Tuple[Union[:class:`BaseActivity`, :class:`Spotify`]]: Returns the activities + """Tuple[Union[:class:`.BaseActivity`, :class:`.Spotify`]]: Returns the activities the client is currently doing through this library, if applicable. .. versionadded:: 2.0 @@ -1401,7 +1401,7 @@ class Client: Parameters ----------- - channel: Optional[:class:`abc.Snowflake`] + channel: Optional[:class:`~discord.abc.Snowflake`] Channel the client wants to join (must be a private channel). Use ``None`` to disconnect. self_mute: :class:`bool` Indicates if the client should be self-muted. @@ -1650,13 +1650,13 @@ class Client: async def leave_guild(self, guild: Snowflake, /, lurking: bool = MISSING) -> None: """|coro| - Leaves a guild. Equivalent to :meth:`Guild.leave`. + Leaves a guild. Equivalent to :meth:`.Guild.leave`. .. versionadded:: 2.0 Parameters ----------- - guild: :class:`abc.Snowflake` + guild: :class:`~discord.abc.Snowflake` The guild to leave. lurking: :class:`bool` Whether you are lurking the guild. @@ -1901,7 +1901,7 @@ class Client: async def fetch_user(self, user_id: int, /) -> User: """|coro| - Retrieves a :class:`~discord.User` based on their ID. + Retrieves a :class:`discord.User` based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do. @@ -1932,7 +1932,7 @@ class Client: Returns -------- - :class:`.User` + :class:`discord.User` The user you requested. """ data = await self.http.get_user(user_id) @@ -2145,7 +2145,7 @@ class Client: Returns -------- - List[:class:`Note`] + List[:class:`.Note`] All your notes. """ state = self._connection @@ -2155,7 +2155,7 @@ class Client: async def fetch_note(self, user_id: int, /) -> Note: """|coro| - Retrieves a :class:`Note` for the specified user ID. + Retrieves a :class:`.Note` for the specified user ID. .. versionadded:: 1.9 @@ -2175,7 +2175,7 @@ class Client: Returns -------- - :class:`Note` + :class:`.Note` The note you requested. """ note = Note(self._connection, int(user_id)) @@ -2196,7 +2196,7 @@ class Client: Returns ------- - List[:class:`Connection`] + List[:class:`.Connection`] All your connections. """ state = self._connection @@ -2264,7 +2264,7 @@ class Client: Parameters ----------- \*recipients: :class:`~discord.abc.Snowflake` - An argument :class:`list` of :class:`User` to have in + An argument :class:`list` of :class:`.User` to have in your group. Raises @@ -2319,7 +2319,7 @@ class Client: Parameters ----------- - user: Union[:class:`User`, :class:`str`] + user: Union[:class:`discord.User`, :class:`str`] The user to send the friend request to. username: :class:`str` The username of the user to send the friend request to. diff --git a/discord/commands.py b/discord/commands.py index 9c1e6c2d5..41c23446b 100644 --- a/discord/commands.py +++ b/discord/commands.py @@ -67,7 +67,7 @@ class ApplicationCommand(Protocol): The command's name. description: :class:`str` The command's description, if any. - type: :class:`.enums.AppCommandType` + type: :class:`AppCommandType` The type of application command. """ diff --git a/discord/components.py b/discord/components.py index 7c5c87620..1e32dc02e 100644 --- a/discord/components.py +++ b/discord/components.py @@ -433,8 +433,6 @@ class TextInput(Component): The style of the text input. placeholder: Optional[:class:`str`] The placeholder text to display when the text input is empty. - value: Optional[:class:`str`] - The default value of the text input. required: :class:`bool` Whether the text input is required. min_length: Optional[:class:`int`] @@ -477,7 +475,7 @@ class TextInput(Component): @property def value(self) -> Optional[str]: - """Optional[:class:`str]`: The current value of the text input. Defaults to :attr:`default`. + """Optional[:class:`str`]: The current value of the text input. Defaults to :attr:`default`. This can be set to change the answer to the text input. """ diff --git a/discord/message.py b/discord/message.py index 211fe4ddf..397738354 100644 --- a/discord/message.py +++ b/discord/message.py @@ -2019,7 +2019,7 @@ class Message(PartialMessage, Hashable): List of command IDs to search for. If the command doesn't exist it won't be returned. applications: :class:`bool` Whether to include applications in the response. This defaults to ``False``. - application: Optional[:class:`~abc.Snowflake`] + application: Optional[:class:`~discord.abc.Snowflake`] Query commands only for this application. Raises diff --git a/discord/profile.py b/discord/profile.py index 8f74f5073..1df3fa64d 100644 --- a/discord/profile.py +++ b/discord/profile.py @@ -47,34 +47,7 @@ __all__ = ( class Profile: - """Represents a Discord profile. - - .. versionadded:: 2.0 - - Attributes - ---------- - application_id: Optional[:class:`int`] - The ID of the application that this user is attached to, if applicable. - install_url: Optional[:class:`str`] - The URL to invite the application to your guild with. - bio: Optional[:class:`str`] - The user's "about me" field. Could be ``None``. - premium_since: Optional[:class:`datetime.datetime`] - An aware datetime object that specifies how long a user has been premium (had Nitro). - ``None`` if the user is not a premium user. - boosting_since: Optional[:class:`datetime.datetime`] - An aware datetime object that specifies when a user first boosted a guild. - connections: Optional[List[:class:`PartialConnection`]] - The connected accounts that show up on the profile. - note: :class:`Note` - Represents the note on the profile. - mutual_guilds: Optional[List[:class:`Guild`]] - A list of guilds that you share with the user. - ``None`` if you didn't fetch mutuals. - mutual_friends: Optional[List[:class:`User`]] - A list of friends that you share with the user. - ``None`` if you didn't fetch mutuals. - """ + """Represents a Discord profile.""" if TYPE_CHECKING: id: int @@ -150,14 +123,64 @@ class Profile: class UserProfile(Profile, User): - """Represents a Discord user's profile. This is a :class:`User` with extended attributes.""" + """Represents a Discord user's profile. This is a :class:`User` with extended attributes. + + Attributes + ----------- + application_id: Optional[:class:`int`] + The ID of the application that this user is attached to, if applicable. + install_url: Optional[:class:`str`] + The URL to invite the application to your guild with. + bio: Optional[:class:`str`] + The user's "about me" field. Could be ``None``. + premium_since: Optional[:class:`datetime.datetime`] + An aware datetime object that specifies how long a user has been premium (had Nitro). + ``None`` if the user is not a premium user. + boosting_since: Optional[:class:`datetime.datetime`] + An aware datetime object that specifies when a user first boosted a guild. + connections: Optional[List[:class:`PartialConnection`]] + The connected accounts that show up on the profile. + note: :class:`Note` + Represents the note on the profile. + mutual_guilds: Optional[List[:class:`Guild`]] + A list of guilds that you share with the user. + ``None`` if you didn't fetch mutuals. + mutual_friends: Optional[List[:class:`User`]] + A list of friends that you share with the user. + ``None`` if you didn't fetch mutuals. + """ def __repr__(self) -> str: return f'' class MemberProfile(Profile, Member): - """Represents a Discord member's profile. This is a :class:`Member` with extended attributes.""" + """Represents a Discord member's profile. This is a :class:`Member` with extended attributes. + + Attributes + ----------- + application_id: Optional[:class:`int`] + The ID of the application that this user is attached to, if applicable. + install_url: Optional[:class:`str`] + The URL to invite the application to your guild with. + bio: Optional[:class:`str`] + The user's "about me" field. Could be ``None``. + premium_since: Optional[:class:`datetime.datetime`] + An aware datetime object that specifies how long a user has been premium (had Nitro). + ``None`` if the user is not a premium user. + boosting_since: Optional[:class:`datetime.datetime`] + An aware datetime object that specifies when a user first boosted a guild. + connections: Optional[List[:class:`PartialConnection`]] + The connected accounts that show up on the profile. + note: :class:`Note` + Represents the note on the profile. + mutual_guilds: Optional[List[:class:`Guild`]] + A list of guilds that you share with the user. + ``None`` if you didn't fetch mutuals. + mutual_friends: Optional[List[:class:`User`]] + A list of friends that you share with the user. + ``None`` if you didn't fetch mutuals. + """ def __repr__(self) -> str: return ( diff --git a/docs/api.rst b/docs/api.rst index 43b92b3b5..441323c9f 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -383,7 +383,7 @@ Client :param before: The settings prior to being updated. :type before: :class:`UserSettings` :param after: The settings after being updated. - :type after: :class:`SettiUserSettingsngs` + :type after: :class:`UserSettings` .. function:: on_guild_settings_update(before, after) @@ -2412,26 +2412,26 @@ of :class:`enum.Enum`. .. container:: operations - .. versionadded:: 2.0 + .. versionadded:: 2.0 -      .. describe:: x == y + .. describe:: x == y -          Checks if two application states are equal. -      .. describe:: x != y + Checks if two application states are equal. + .. describe:: x != y -          Checks if two application states are not equal. -      .. describe:: x > y + Checks if two application states are not equal. + .. describe:: x > y -          Checks if a application state is higher than another. -      .. describe:: x < y + Checks if a application state is higher than another. + .. describe:: x < y -          Checks if a application state is lower than another. -      .. describe:: x >= y + Checks if a application state is lower than another. + .. describe:: x >= y -          Checks if a application state is higher or equal to another. -      .. describe:: x <= y + Checks if a application state is higher or equal to another. + .. describe:: x <= y -          Checks if a application state is lower or equal to another. + Checks if a application state is lower or equal to another. .. attribute:: invited @@ -2471,24 +2471,24 @@ of :class:`enum.Enum`. .. container:: operations -      .. describe:: x == y + .. describe:: x == y -          Checks if two application states are equal. -      .. describe:: x != y + Checks if two application states are equal. + .. describe:: x != y -          Checks if two application states are not equal. -      .. describe:: x > y + Checks if two application states are not equal. + .. describe:: x > y -          Checks if a application state is higher than another. -      .. describe:: x < y + Checks if a application state is higher than another. + .. describe:: x < y -          Checks if a application state is lower than another. -      .. describe:: x >= y + Checks if a application state is lower than another. + .. describe:: x >= y -          Checks if a application state is higher or equal to another. -      .. describe:: x <= y + Checks if a application state is higher or equal to another. + .. describe:: x <= y -          Checks if a application state is lower or equal to another. + Checks if a application state is lower or equal to another. .. attribute:: ineligible @@ -2514,24 +2514,24 @@ of :class:`enum.Enum`. .. container:: operations -      .. describe:: x == y + .. describe:: x == y -          Checks if two application states are equal. -      .. describe:: x != y + Checks if two application states are equal. + .. describe:: x != y -          Checks if two application states are not equal. -      .. describe:: x > y + Checks if two application states are not equal. + .. describe:: x > y -          Checks if a application state is higher than another. -      .. describe:: x < y + Checks if a application state is higher than another. + .. describe:: x < y -          Checks if a application state is lower than another. -      .. describe:: x >= y + Checks if a application state is lower than another. + .. describe:: x >= y -          Checks if a application state is higher or equal to another. -      .. describe:: x <= y + Checks if a application state is higher or equal to another. + .. describe:: x <= y -          Checks if a application state is lower or equal to another. + Checks if a application state is lower or equal to another. .. attribute:: none @@ -2565,24 +2565,24 @@ of :class:`enum.Enum`. .. container:: operations -      .. describe:: x == y + .. describe:: x == y -          Checks if two application states are equal. -      .. describe:: x != y + Checks if two application states are equal. + .. describe:: x != y -          Checks if two application states are not equal. -      .. describe:: x > y + Checks if two application states are not equal. + .. describe:: x > y -          Checks if a application state is higher than another. -      .. describe:: x < y + Checks if a application state is higher than another. + .. describe:: x < y -          Checks if a application state is lower than another. -      .. describe:: x >= y + Checks if a application state is lower than another. + .. describe:: x >= y -          Checks if a application state is higher or equal to another. -      .. describe:: x <= y + Checks if a application state is higher or equal to another. + .. describe:: x <= y -          Checks if a application state is lower or equal to another. + Checks if a application state is lower or equal to another. .. attribute:: disabled