Browse Source

Docs are fun 😡

pull/10109/head
dolfies 3 years ago
parent
commit
5f1ab56174
  1. 2
      discord/appinfo.py
  2. 44
      discord/client.py
  3. 2
      discord/commands.py
  4. 4
      discord/components.py
  5. 2
      discord/message.py
  6. 83
      discord/profile.py
  7. 98
      docs/api.rst

2
discord/appinfo.py

@ -560,7 +560,7 @@ class InteractionApplication(Hashable):
Only available from :attr:`~Modal.application`. Only available from :attr:`~Modal.application`.
command_count: Optional[:class:`int`] command_count: Optional[:class:`int`]
The number of commands the application has. The number of commands the application has.
Only available from :attr:`~discord.abc.ApplicationCommand.application`. Only available from :attr:`~abc.BaseCommand.application`.
""" """
__slots__ = ( __slots__ = (

44
discord/client.py

@ -724,7 +724,7 @@ class Client:
@property @property
def voice_client(self) -> Optional[VoiceProtocol]: 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) return self._connection._get_voice_client(self._connection.self_id)
@property @property
@ -783,7 +783,7 @@ class Client:
@property @property
def status(self) -> Status: def status(self) -> Status:
""":class:`Status`: The user's overall status. """:class:`.Status`: The user's overall status.
.. versionadded:: 2.0 .. versionadded:: 2.0
""" """
@ -807,7 +807,7 @@ class Client:
@property @property
def mobile_status(self) -> Status: 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 .. versionadded:: 2.0
""" """
@ -815,7 +815,7 @@ class Client:
@property @property
def desktop_status(self) -> Status: 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 .. versionadded:: 2.0
""" """
@ -823,7 +823,7 @@ class Client:
@property @property
def web_status(self) -> Status: 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 .. versionadded:: 2.0
""" """
@ -831,7 +831,7 @@ class Client:
@property @property
def client_status(self) -> Status: def client_status(self) -> Status:
""":class:`Status`: The library's status. """:class:`.Status`: The library's status.
.. versionadded:: 2.0 .. versionadded:: 2.0
""" """
@ -849,7 +849,7 @@ class Client:
@property @property
def activities(self) -> Tuple[ActivityTypes]: 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. the client is currently doing.
.. versionadded:: 2.0 .. versionadded:: 2.0
@ -889,7 +889,7 @@ class Client:
@property @property
def mobile_activities(self) -> Tuple[ActivityTypes]: 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. the client is currently doing on a mobile device, if applicable.
.. versionadded:: 2.0 .. versionadded:: 2.0
@ -899,7 +899,7 @@ class Client:
@property @property
def desktop_activities(self) -> Tuple[ActivityTypes]: 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. the client is currently doing on the desktop client, if applicable.
.. versionadded:: 2.0 .. versionadded:: 2.0
@ -909,7 +909,7 @@ class Client:
@property @property
def web_activities(self) -> Tuple[ActivityTypes]: 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. the client is currently doing on the web client, if applicable.
.. versionadded:: 2.0 .. versionadded:: 2.0
@ -919,7 +919,7 @@ class Client:
@property @property
def client_activities(self) -> Tuple[ActivityTypes]: 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. the client is currently doing through this library, if applicable.
.. versionadded:: 2.0 .. versionadded:: 2.0
@ -1401,7 +1401,7 @@ class Client:
Parameters 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. Channel the client wants to join (must be a private channel). Use ``None`` to disconnect.
self_mute: :class:`bool` self_mute: :class:`bool`
Indicates if the client should be self-muted. 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: async def leave_guild(self, guild: Snowflake, /, lurking: bool = MISSING) -> None:
"""|coro| """|coro|
Leaves a guild. Equivalent to :meth:`Guild.leave`. Leaves a guild. Equivalent to :meth:`.Guild.leave`.
.. versionadded:: 2.0 .. versionadded:: 2.0
Parameters Parameters
----------- -----------
guild: :class:`abc.Snowflake` guild: :class:`~discord.abc.Snowflake`
The guild to leave. The guild to leave.
lurking: :class:`bool` lurking: :class:`bool`
Whether you are lurking the guild. Whether you are lurking the guild.
@ -1901,7 +1901,7 @@ class Client:
async def fetch_user(self, user_id: int, /) -> User: async def fetch_user(self, user_id: int, /) -> User:
"""|coro| """|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 You do not have to share any guilds with the user to get
this information, however many operations do require that you do. this information, however many operations do require that you do.
@ -1932,7 +1932,7 @@ class Client:
Returns Returns
-------- --------
:class:`.User` :class:`discord.User`
The user you requested. The user you requested.
""" """
data = await self.http.get_user(user_id) data = await self.http.get_user(user_id)
@ -2145,7 +2145,7 @@ class Client:
Returns Returns
-------- --------
List[:class:`Note`] List[:class:`.Note`]
All your notes. All your notes.
""" """
state = self._connection state = self._connection
@ -2155,7 +2155,7 @@ class Client:
async def fetch_note(self, user_id: int, /) -> Note: async def fetch_note(self, user_id: int, /) -> Note:
"""|coro| """|coro|
Retrieves a :class:`Note` for the specified user ID. Retrieves a :class:`.Note` for the specified user ID.
.. versionadded:: 1.9 .. versionadded:: 1.9
@ -2175,7 +2175,7 @@ class Client:
Returns Returns
-------- --------
:class:`Note` :class:`.Note`
The note you requested. The note you requested.
""" """
note = Note(self._connection, int(user_id)) note = Note(self._connection, int(user_id))
@ -2196,7 +2196,7 @@ class Client:
Returns Returns
------- -------
List[:class:`Connection`] List[:class:`.Connection`]
All your connections. All your connections.
""" """
state = self._connection state = self._connection
@ -2264,7 +2264,7 @@ class Client:
Parameters Parameters
----------- -----------
\*recipients: :class:`~discord.abc.Snowflake` \*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. your group.
Raises Raises
@ -2319,7 +2319,7 @@ class Client:
Parameters Parameters
----------- -----------
user: Union[:class:`User`, :class:`str`] user: Union[:class:`discord.User`, :class:`str`]
The user to send the friend request to. The user to send the friend request to.
username: :class:`str` username: :class:`str`
The username of the user to send the friend request to. The username of the user to send the friend request to.

2
discord/commands.py

@ -67,7 +67,7 @@ class ApplicationCommand(Protocol):
The command's name. The command's name.
description: :class:`str` description: :class:`str`
The command's description, if any. The command's description, if any.
type: :class:`.enums.AppCommandType` type: :class:`AppCommandType`
The type of application command. The type of application command.
""" """

4
discord/components.py

@ -433,8 +433,6 @@ class TextInput(Component):
The style of the text input. The style of the text input.
placeholder: Optional[:class:`str`] placeholder: Optional[:class:`str`]
The placeholder text to display when the text input is empty. 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` required: :class:`bool`
Whether the text input is required. Whether the text input is required.
min_length: Optional[:class:`int`] min_length: Optional[:class:`int`]
@ -477,7 +475,7 @@ class TextInput(Component):
@property @property
def value(self) -> Optional[str]: 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. This can be set to change the answer to the text input.
""" """

2
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. List of command IDs to search for. If the command doesn't exist it won't be returned.
applications: :class:`bool` applications: :class:`bool`
Whether to include applications in the response. This defaults to ``False``. 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. Query commands only for this application.
Raises Raises

83
discord/profile.py

@ -47,34 +47,7 @@ __all__ = (
class Profile: class Profile:
"""Represents a Discord 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.
"""
if TYPE_CHECKING: if TYPE_CHECKING:
id: int id: int
@ -150,14 +123,64 @@ class Profile:
class UserProfile(Profile, User): 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: def __repr__(self) -> str:
return f'<UserProfile id={self.id} name={self.name!r} discriminator={self.discriminator!r} bot={self.bot} system={self.system} premium={self.premium}>' return f'<UserProfile id={self.id} name={self.name!r} discriminator={self.discriminator!r} bot={self.bot} system={self.system} premium={self.premium}>'
class MemberProfile(Profile, Member): 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: def __repr__(self) -> str:
return ( return (

98
docs/api.rst

@ -383,7 +383,7 @@ Client
:param before: The settings prior to being updated. :param before: The settings prior to being updated.
:type before: :class:`UserSettings` :type before: :class:`UserSettings`
:param after: The settings after being updated. :param after: The settings after being updated.
:type after: :class:`SettiUserSettingsngs` :type after: :class:`UserSettings`
.. function:: on_guild_settings_update(before, after) .. function:: on_guild_settings_update(before, after)
@ -2414,24 +2414,24 @@ of :class:`enum.Enum`.
.. versionadded:: 2.0 .. versionadded:: 2.0
      .. describe:: x == y .. describe:: x == y
          Checks if two application states are equal. Checks if two application states are equal.
      .. describe:: x != y .. describe:: x != y
          Checks if two application states are not equal. Checks if two application states are not equal.
      .. describe:: x > y .. describe:: x > y
          Checks if a application state is higher than another. Checks if a application state is higher than another.
      .. describe:: x < y .. describe:: x < y
          Checks if a application state is lower than another. Checks if a application state is lower than another.
      .. describe:: x >= y .. describe:: x >= y
          Checks if a application state is higher or equal to another. Checks if a application state is higher or equal to another.
      .. describe:: x <= y .. 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 .. attribute:: invited
@ -2471,24 +2471,24 @@ of :class:`enum.Enum`.
.. container:: operations .. container:: operations
      .. describe:: x == y .. describe:: x == y
          Checks if two application states are equal. Checks if two application states are equal.
      .. describe:: x != y .. describe:: x != y
          Checks if two application states are not equal. Checks if two application states are not equal.
      .. describe:: x > y .. describe:: x > y
          Checks if a application state is higher than another. Checks if a application state is higher than another.
      .. describe:: x < y .. describe:: x < y
          Checks if a application state is lower than another. Checks if a application state is lower than another.
      .. describe:: x >= y .. describe:: x >= y
          Checks if a application state is higher or equal to another. Checks if a application state is higher or equal to another.
      .. describe:: x <= y .. 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 .. attribute:: ineligible
@ -2514,24 +2514,24 @@ of :class:`enum.Enum`.
.. container:: operations .. container:: operations
      .. describe:: x == y .. describe:: x == y
          Checks if two application states are equal. Checks if two application states are equal.
      .. describe:: x != y .. describe:: x != y
          Checks if two application states are not equal. Checks if two application states are not equal.
      .. describe:: x > y .. describe:: x > y
          Checks if a application state is higher than another. Checks if a application state is higher than another.
      .. describe:: x < y .. describe:: x < y
          Checks if a application state is lower than another. Checks if a application state is lower than another.
      .. describe:: x >= y .. describe:: x >= y
          Checks if a application state is higher or equal to another. Checks if a application state is higher or equal to another.
      .. describe:: x <= y .. 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 .. attribute:: none
@ -2565,24 +2565,24 @@ of :class:`enum.Enum`.
.. container:: operations .. container:: operations
      .. describe:: x == y .. describe:: x == y
          Checks if two application states are equal. Checks if two application states are equal.
      .. describe:: x != y .. describe:: x != y
          Checks if two application states are not equal. Checks if two application states are not equal.
      .. describe:: x > y .. describe:: x > y
          Checks if a application state is higher than another. Checks if a application state is higher than another.
      .. describe:: x < y .. describe:: x < y
          Checks if a application state is lower than another. Checks if a application state is lower than another.
      .. describe:: x >= y .. describe:: x >= y
          Checks if a application state is higher or equal to another. Checks if a application state is higher or equal to another.
      .. describe:: x <= y .. 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 .. attribute:: disabled

Loading…
Cancel
Save