From 41208f73917c4dd319b2f12c8d79eea68833528f Mon Sep 17 00:00:00 2001 From: Rapptz Date: Fri, 27 May 2022 04:05:01 -0400 Subject: [PATCH] Add a new extlink for discord documentation --- discord/embeds.py | 8 ++------ discord/raw_models.py | 2 +- discord/voice_client.py | 12 ++---------- docs/api.rst | 2 +- docs/conf.py | 1 + 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/discord/embeds.py b/discord/embeds.py index 630f3d8c2..c0bd12f64 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -122,7 +122,7 @@ class Embed: The type of embed. Usually "rich". This can be set during initialisation. Possible strings for embed types can be found on discord's - `api docs `_ + :ddocs:`api docs ` description: Optional[:class:`str`] The description of the embed. This can be set during initialisation. @@ -190,11 +190,7 @@ class Embed: """Converts a :class:`dict` to a :class:`Embed` provided it is in the format that Discord expects it to be in. - You can find out about this format in the `official Discord documentation`__. - - .. _DiscordDocs: https://discord.com/developers/docs/resources/channel#embed-object - - __ DiscordDocs_ + You can find out about this format in the :ddocs:`official Discord documentation `. Parameters ----------- diff --git a/discord/raw_models.py b/discord/raw_models.py index a25a047ba..5a5efc577 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -140,7 +140,7 @@ class RawMessageUpdateEvent(_RawReprMixin): .. versionadded:: 1.7 data: :class:`dict` - The raw data given by the `gateway `_ + The raw data given by the :ddocs:`gateway ` cached_message: Optional[:class:`Message`] The cached message, if found in the internal message cache. Represents the message before it is modified by the data in :attr:`RawMessageUpdateEvent.data`. diff --git a/discord/voice_client.py b/discord/voice_client.py index b3c22b073..312ddd23c 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -124,11 +124,7 @@ class VoiceProtocol: Parameters ------------ data: :class:`dict` - The raw `voice state payload`__. - - .. _voice_state_update_payload: https://discord.com/developers/docs/resources/voice#voice-state-object - - __ voice_state_update_payload_ + The raw :ddocs:`voice state payload `. """ raise NotImplementedError @@ -141,11 +137,7 @@ class VoiceProtocol: Parameters ------------ data: :class:`dict` - The raw `voice server update payload`__. - - .. _voice_server_update_payload: https://discord.com/developers/docs/topics/gateway#voice-server-update-voice-server-update-event-fields - - __ voice_server_update_payload_ + The raw :ddocs:`voice server update payload `. """ raise NotImplementedError diff --git a/docs/api.rst b/docs/api.rst index 3e7837b00..3ba172cf5 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1006,7 +1006,7 @@ Messages will return a :class:`Message` object that represents the message before the content was modified. Due to the inherently raw nature of this event, the data parameter coincides with - the raw data given by the `gateway `_. + the raw data given by the :ddocs:`gateway `. Since the data payload can be partial, care must be taken when accessing stuff in the dictionary. One example of a common case of partial data is when the ``'content'`` key is inaccessible. This diff --git a/docs/conf.py b/docs/conf.py index 23aa80fb2..8140e974e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,6 +51,7 @@ autodoc_typehints = 'none' extlinks = { 'issue': ('https://github.com/dolfies/discord.py-self/issues/%s', 'GH-'), + 'ddocs': ('https://discord.com/developers/docs/%s', None), } # Links used for cross-referencing stuff in other documentation