Skip to content

Commit 43b422a

Browse files
authored
docs: 📝 Fixes (#3030)
* 📝 Fix formatting for gateway links in docstrings * 📝 Fix documentation for default value type in mentionable select * 🐛 Fix import path for Interaction in label.py * 📝 Exclude 'cog' member from SlashCommand documentation * 📝 Fix documentation of `check_any` * 📝 Fix section heading underline lenght in docstring sections
1 parent b56b4d9 commit 43b422a

6 files changed

Lines changed: 41 additions & 40 deletions

File tree

discord/automod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class AutoModTriggerMetadata:
207207
+-----------------------------+--------------------------------------------------------------------------------+
208208
209209
Each attribute has limits that may change based on the trigger type.
210-
See `here <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata-field-limits>`_
210+
See `here <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata-field-limits>`__
211211
for information on attribute limits.
212212
213213
.. versionadded:: 2.0

discord/ext/commands/core.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ async def extended_check(ctx):
17991799
The ``predicate`` attribute was added.
18001800
18011801
Examples
1802-
---------
1802+
--------
18031803
18041804
Creating a basic check to see if the command invoker is you.
18051805
@@ -1828,7 +1828,7 @@ async def only_me(ctx):
18281828
await ctx.send('Only you!')
18291829
18301830
Parameters
1831-
-----------
1831+
----------
18321832
predicate: Callable[[:class:`Context`], :class:`bool`]
18331833
The predicate to check if the command should be invoked.
18341834
"""
@@ -1870,20 +1870,8 @@ def check_any(*checks: Check) -> Callable[[T], T]:
18701870
18711871
.. versionadded:: 1.3
18721872
1873-
Parameters
1874-
------------
1875-
\*checks: Callable[[:class:`Context`], :class:`bool`]
1876-
An argument list of checks that have been decorated with
1877-
the :func:`check` decorator.
1878-
1879-
Raises
1880-
------
1881-
TypeError
1882-
A check passed has not been decorated with the :func:`check`
1883-
decorator.
1884-
18851873
Examples
1886-
---------
1874+
--------
18871875
18881876
Creating a basic check to see if it's the bot owner or
18891877
the server owner:
@@ -1900,6 +1888,18 @@ def predicate(ctx):
19001888
async def only_for_owners(ctx):
19011889
await ctx.send('Hello mister owner!')
19021890
1891+
Parameters
1892+
----------
1893+
\*checks: Callable[[:class:`Context`], :class:`bool`]
1894+
An argument list of checks that have been decorated with
1895+
the :func:`check` decorator.
1896+
1897+
Raises
1898+
------
1899+
TypeError
1900+
A check passed has not been decorated with the :func:`check`
1901+
decorator.
1902+
19031903
"""
19041904

19051905
unwrapped = []
@@ -1989,12 +1989,12 @@ def has_any_role(*items: int | str) -> Callable[[T], T]:
19891989
instead of generic :exc:`.CheckFailure`
19901990
19911991
Parameters
1992-
-----------
1992+
----------
19931993
items: List[Union[:class:`str`, :class:`int`]]
19941994
An argument list of names or IDs to check that the member has roles wise.
19951995
19961996
Example
1997-
--------
1997+
-------
19981998
19991999
.. code-block:: python3
20002000
@@ -2104,12 +2104,12 @@ def has_permissions(**perms: bool) -> Callable[[T], T]:
21042104
If the command is executed within a DM, it returns ``True``.
21052105
21062106
Parameters
2107-
------------
2107+
----------
21082108
\*\*perms: Dict[:class:`str`, :class:`bool`]
21092109
An argument list of permissions to check for.
21102110
21112111
Example
2112-
---------
2112+
-------
21132113
21142114
.. code-block:: python3
21152115

discord/raw_models.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class RawMessageDeleteEvent(_RawReprMixin):
113113
cached_message: Optional[:class:`Message`]
114114
The cached message, if found in the internal message cache.
115115
data: :class:`dict`
116-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-delete>`_.
116+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-delete>`__.
117117
118118
.. versionadded:: 2.5
119119
"""
@@ -145,7 +145,7 @@ class RawBulkMessageDeleteEvent(_RawReprMixin):
145145
cached_messages: List[:class:`Message`]
146146
The cached messages, if found in the internal message cache.
147147
data: :class:`dict`
148-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-delete-bulk>`_.
148+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-delete-bulk>`__.
149149
150150
.. versionadded:: 2.5
151151
"""
@@ -181,7 +181,7 @@ class RawMessageUpdateEvent(_RawReprMixin):
181181
.. versionadded:: 1.7
182182
183183
data: :class:`dict`
184-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway#message-update>`_
184+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway#message-update>`__
185185
cached_message: Optional[:class:`Message`]
186186
The cached message, if found in the internal message cache. Represents the message before
187187
it is modified by the data in :attr:`RawMessageUpdateEvent.data`.
@@ -244,7 +244,7 @@ class RawReactionActionEvent(_RawReprMixin):
244244
type: :class:`ReactionType`
245245
The type of reaction added.
246246
data: :class:`dict`
247-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-reaction-add>`_.
247+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-reaction-add>`__.
248248
249249
.. versionadded:: 2.5
250250
"""
@@ -297,7 +297,7 @@ class RawReactionClearEvent(_RawReprMixin):
297297
guild_id: Optional[:class:`int`]
298298
The guild ID where the reactions got cleared.
299299
data: :class:`dict`
300-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-all>`_.
300+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-all>`__.
301301
302302
.. versionadded:: 2.5
303303
"""
@@ -339,7 +339,7 @@ class RawReactionClearEmojiEvent(_RawReprMixin):
339339
type: :class:`ReactionType`
340340
The type of reaction removed.
341341
data: :class:`dict`
342-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-emoji>`_.
342+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#message-reaction-remove-emoji>`__.
343343
344344
.. versionadded:: 2.5
345345
"""
@@ -386,7 +386,7 @@ class RawIntegrationDeleteEvent(_RawReprMixin):
386386
guild_id: :class:`int`
387387
The guild ID where the integration got deleted.
388388
data: :class:`dict`
389-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#integration-delete>`_.
389+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#integration-delete>`__.
390390
391391
.. versionadded:: 2.5
392392
"""
@@ -420,7 +420,7 @@ class RawThreadUpdateEvent(_RawReprMixin):
420420
parent_id: :class:`int`
421421
The ID of the channel the thread belongs to.
422422
data: :class:`dict`
423-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#thread-update>`_.
423+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#thread-update>`__.
424424
thread: :class:`discord.Thread` | None
425425
The thread, if it could be found in the internal cache.
426426
"""
@@ -455,7 +455,7 @@ class RawThreadDeleteEvent(_RawReprMixin):
455455
thread: Optional[:class:`discord.Thread`]
456456
The thread that was deleted. This may be ``None`` if deleted thread is not found in internal cache.
457457
data: :class:`dict`
458-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#thread-delete>`_.
458+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#thread-delete>`__.
459459
460460
.. versionadded:: 2.5
461461
"""
@@ -485,7 +485,7 @@ class RawVoiceChannelStatusUpdateEvent(_RawReprMixin):
485485
status: Optional[:class:`str`]
486486
The new new voice channel status.
487487
data: :class:`dict`
488-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#voice-channel-status-update>`_.
488+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#voice-channel-status-update>`__.
489489
"""
490490

491491
__slots__ = ("id", "guild_id", "status", "data")
@@ -519,7 +519,7 @@ class RawTypingEvent(_RawReprMixin):
519519
member: Optional[:class:`Member`]
520520
The member who started typing. Only available if the member started typing in a guild.
521521
data: :class:`dict`
522-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#typing-start>`_.
522+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#typing-start>`__.
523523
524524
.. versionadded:: 2.5
525525
"""
@@ -553,7 +553,7 @@ class RawMemberRemoveEvent(_RawReprMixin):
553553
guild_id: :class:`int`
554554
The ID of the guild the user left.
555555
data: :class:`dict`
556-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#guild-member-remove>`_.
556+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#guild-member-remove>`__.
557557
558558
.. versionadded:: 2.5
559559
"""
@@ -584,7 +584,7 @@ class RawScheduledEventSubscription(_RawReprMixin):
584584
Can be either ``USER_ADD`` or ``USER_REMOVE`` depending on
585585
the event called.
586586
data: :class:`dict`
587-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-add>`_.
587+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#guild-scheduled-event-user-add>`__.
588588
589589
.. versionadded:: 2.5
590590
"""
@@ -644,7 +644,7 @@ class AutoModActionExecutionEvent:
644644
matched_content: :class:`str`
645645
The substring in the content that was matched.
646646
data: :class:`dict`
647-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution>`_.
647+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#auto-moderation-action-execution>`__.
648648
649649
.. versionadded:: 2.5
650650
"""
@@ -739,7 +739,7 @@ class RawThreadMembersUpdateEvent(_RawReprMixin):
739739
member_count: :class:`int`
740740
The approximate number of members in the thread. Maximum of 50.
741741
data: :class:`dict`
742-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#thread-members-update>`_.
742+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#thread-members-update>`__.
743743
744744
.. versionadded:: 2.5
745745
"""
@@ -780,7 +780,7 @@ class RawAuditLogEntryEvent(_RawReprMixin):
780780
contains extra information. See :class:`AuditLogAction` for
781781
which actions have this field filled out.
782782
data: :class:`dict`
783-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create>`_.
783+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway-events#guild-audit-log-entry-create>`__.
784784
"""
785785

786786
__slots__ = (
@@ -831,7 +831,7 @@ class RawMessagePollVoteEvent(_RawReprMixin):
831831
added: :class:`bool`
832832
Whether this vote was added or removed.
833833
data: :class:`dict`
834-
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway#message-poll-vote-add>`
834+
The raw data sent by the `gateway <https://discord.com/developers/docs/topics/gateway#message-poll-vote-add>`__
835835
"""
836836

837837
__slots__ = (

discord/ui/label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from typing_extensions import Self
4444

4545
from ..emoji import AppEmoji, GuildEmoji
46-
from ..interaction import Interaction
46+
from ..interactions import Interaction
4747
from ..partial_emoji import PartialEmoji, _EmojiTag
4848
from ..types.components import LabelComponent as LabelComponentPayload
4949
from .modal import DesignerModal

discord/ui/select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ def add_default_value(
464464
id: :class:`int`
465465
The ID of the entity to add as a default.
466466
type: :class:`discord.SelectDefaultValueType`
467-
The default value type of the ID. This is only required if :attr:`.type` is of
468-
type :attr:`discord.ComponentType.mentionable_select`.
467+
The default value type of the ID. This is only required if the select ``type`` is
468+
:attr:`discord.ComponentType.mentionable_select`.
469469
470470
Raises
471471
------

docs/api/application_commands.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Objects
4848
.. attributetable:: SlashCommand
4949
.. autoclass:: SlashCommand
5050
:members:
51+
:exclude-members: cog
5152

5253
.. attributetable:: SlashCommandGroup
5354
.. autoclass:: SlashCommandGroup

0 commit comments

Comments
 (0)