Improve documentation

This commit is contained in:
NCPlayz
2019-05-18 06:04:54 -04:00
committed by Rapptz
parent 2f05436653
commit 3c9bcc2851
48 changed files with 652 additions and 569 deletions

View File

@ -164,7 +164,7 @@ class AsyncWebhookAdapter(WebhookAdapter):
Parameters
-----------
session: aiohttp.ClientSession
session: :class:`aiohttp.ClientSession`
The session to use to send requests.
"""
@ -235,7 +235,7 @@ class AsyncWebhookAdapter(WebhookAdapter):
class RequestsWebhookAdapter(WebhookAdapter):
"""A webhook adapter suited for use with ``requests``.
Only versions of requests higher than 2.13.0 are supported.
Only versions of :doc:`req:index` higher than 2.13.0 are supported.
Parameters
-----------
@ -369,9 +369,9 @@ class Webhook:
it bound to a websocket connection using the :meth:`~.Webhook.from_url` or
:meth:`~.Webhook.partial` classmethods. This form allows finer grained control
over how requests are done, allowing you to mix async and sync code using either
``aiohttp`` or ``requests``.
:doc:`aiohttp <aio:index>` or :doc:`req:index`.
For example, creating a webhook from a URL and using ``aiohttp``:
For example, creating a webhook from a URL and using :doc:`aiohttp <aio:index>`:
.. code-block:: python3
@ -383,7 +383,7 @@ class Webhook:
webhook = Webhook.from_url('url-here', adapter=AsyncWebhookAdapter(session))
await webhook.send('Hello World', username='Foo')
Or creating a webhook from an ID and token and using ``requests``:
Or creating a webhook from an ID and token and using :doc:`req:index`:
.. code-block:: python3
@ -456,8 +456,8 @@ class Webhook:
The authentication token of the webhook.
adapter: :class:`WebhookAdapter`
The webhook adapter to use when sending requests. This is
typically :class:`AsyncWebhookAdapter` for ``aiohttp`` or
:class:`RequestsWebhookAdapter` for ``requests``.
typically :class:`AsyncWebhookAdapter` for :doc:`aiohttp <aio:index>` or
:class:`RequestsWebhookAdapter` for :doc:`req:index`.
"""
if not isinstance(adapter, WebhookAdapter):
@ -480,8 +480,8 @@ class Webhook:
The URL of the webhook.
adapter: :class:`WebhookAdapter`
The webhook adapter to use when sending requests. This is
typically :class:`AsyncWebhookAdapter` for ``aiohttp`` or
:class:`RequestsWebhookAdapter` for ``requests``.
typically :class:`AsyncWebhookAdapter` for :doc:`aiohttp <aio:index>` or
:class:`RequestsWebhookAdapter` for :doc:`req:index`.
Raises
-------
@ -518,12 +518,12 @@ class Webhook:
@property
def created_at(self):
"""Returns the webhook's creation time in UTC."""
""":class:`datetime.datetime`: Returns the webhook's creation time in UTC."""
return utils.snowflake_time(self.id)
@property
def avatar_url(self):
"""Returns a :class:`Asset` for the avatar the webhook has.
"""Returns an :class:`Asset` for the avatar the webhook has.
If the webhook does not have a traditional avatar, an asset for
the default avatar is returned instead.
@ -534,7 +534,7 @@ class Webhook:
return self.avatar_url_as()
def avatar_url_as(self, *, format=None, size=1024):
"""Returns a :class:`Asset` for the avatar the webhook has.
"""Returns an :class:`Asset` for the avatar the webhook has.
If the webhook does not have a traditional avatar, an asset for
the default avatar is returned instead.