Browse Source

Add a few things to docs

pull/10109/head
dolfies 4 years ago
parent
commit
b96d31aedc
  1. 3
      discord/__init__.py
  2. 4
      discord/client.py
  3. 2
      discord/errors.py
  4. 1
      discord/settings.py
  5. 77
      docs/api.rst

3
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):

4
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.

2
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]]]):

1
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)

77
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
~~~~~~~~~~~~

Loading…
Cancel
Save