Improve documentation
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user