Skip to content

chore: cleanup documentation issues #1599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,7 @@ async def send(

.. versionadded:: 1.4

reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`,
:class:`~discord.PartialMessage`]
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
A reference to the :class:`~discord.Message` to which you are replying, this can be created using
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
whether this mentions the author of the referenced message using the
Expand Down
4 changes: 2 additions & 2 deletions discord/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ def exempt_roles(self) -> List[Union[Role, Object]]:

@cached_property
def exempt_channels(self) -> List[Union[Union[TextChannel, ForumChannel, VoiceChannel], Object]]:
"""List[Union[Union[:class:`TextChannel`, :class:`ForumChannel`, :class:`VoiceChannel`], :class:`Object`]]:
The channels that are exempt from this rule.
"""List[Union[Union[:class:`TextChannel`, :class:`ForumChannel`, :class:`VoiceChannel`], :class:`Object`]]: The
channels that are exempt from this rule.

If a channel is not found in the guild's cache,
then it will be returned as an :class:`Object`.
Expand Down
8 changes: 4 additions & 4 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ async def edit(self, *, reason=None, **options):
is only available to guilds that contain ``NEWS`` in :attr:`Guild.features`.
reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to channel permissions. Useful for creating secret channels.
default_auto_archive_duration: :class:`int`
The new default auto archive duration in minutes for threads created in this channel.
Expand Down Expand Up @@ -1549,7 +1549,7 @@ async def edit(self, *, reason=None, **options):
category.
reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to channel permissions. Useful for creating secret channels.
rtc_region: Optional[:class:`VoiceRegion`]
The new region for the voice channel's voice communication.
Expand Down Expand Up @@ -1889,7 +1889,7 @@ async def edit(self, *, reason=None, **options):
category.
reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to channel permissions. Useful for creating secret channels.
rtc_region: Optional[:class:`VoiceRegion`]
The new region for the stage channel's voice communication.
Expand Down Expand Up @@ -2057,7 +2057,7 @@ async def edit(self, *, reason=None, **options):
To mark the category as NSFW or not.
reason: Optional[:class:`str`]
The reason for editing this category. Shows up on the audit log.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to channel permissions. Useful for creating secret channels.

Raises
Expand Down
16 changes: 8 additions & 8 deletions discord/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ class CogMeta(type):

import abc

class CogABCMeta(commands.CogMeta, abc.ABCMeta):
class CogABCMeta(discord.CogMeta, abc.ABCMeta):
pass

class SomeMixin(metaclass=abc.ABCMeta):
pass

class SomeCogMixin(SomeMixin, commands.Cog, metaclass=CogABCMeta):
class SomeCogMixin(SomeMixin, discord.Cog, metaclass=CogABCMeta):
pass

.. note::
Expand All @@ -102,7 +102,7 @@ class SomeCogMixin(SomeMixin, commands.Cog, metaclass=CogABCMeta):

.. code-block:: python3

class MyCog(commands.Cog, name='My Cog'):
class MyCog(discord.Cog, name='My Cog'):
pass

Attributes
Expand All @@ -122,12 +122,12 @@ class MyCog(commands.Cog, name='My Cog'):

.. code-block:: python3

class MyCog(commands.Cog, command_attrs=dict(hidden=True)):
@commands.command()
class MyCog(discord.Cog, command_attrs=dict(hidden=True)):
@discord.slash_command()
async def foo(self, ctx):
pass # hidden -> True

@commands.command(hidden=False)
@discord.slash_command(hidden=False)
async def bar(self, ctx):
pass # hidden -> False

Expand Down Expand Up @@ -468,7 +468,7 @@ async def cog_command_error(self, ctx: ApplicationContext, error: Exception) ->
async def cog_before_invoke(self, ctx: ApplicationContext) -> None:
"""A special method that acts as a cog local pre-invoke hook.

This is similar to :meth:`.Command.before_invoke`.
This is similar to :meth:`.ApplicationCommand.before_invoke`.

This **must** be a coroutine.

Expand All @@ -483,7 +483,7 @@ async def cog_before_invoke(self, ctx: ApplicationContext) -> None:
async def cog_after_invoke(self, ctx: ApplicationContext) -> None:
"""A special method that acts as a cog local post-invoke hook.

This is similar to :meth:`.Command.after_invoke`.
This is similar to :meth:`.ApplicationCommand.after_invoke`.

This **must** be a coroutine.

Expand Down
2 changes: 1 addition & 1 deletion discord/commands/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def __repr__(self):

class OptionChoice:
"""
Represents a name:value pairing for a selected :class:`Option`.
Represents a name:value pairing for a selected :class:`.Option`.

.. versionadded:: 2.0

Expand Down
12 changes: 4 additions & 8 deletions discord/ext/pages/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ class PageGroup:

Parameters
----------
pages: Union[List[:class:`str`], List[:class:`Page`],
List[Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
pages: Union[List[:class:`str`], List[:class:`Page`], List[Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
The list of :class:`Page` objects, strings, embeds, or list of embeds to include in the page group.
label: :class:`str`
The label shown on the corresponding PaginatorMenu dropdown option.
Expand Down Expand Up @@ -307,8 +306,7 @@ class Paginator(discord.ui.View):

Parameters
----------
pages: Union[List[:class:`PageGroup`], List[:class:`Page`], List[:class:`str`],
List[Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
pages: Union[List[:class:`PageGroup`], List[:class:`Page`], List[:class:`str`], List[Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]
The list of :class:`PageGroup` objects, :class:`Page` objects, strings, embeds, or list of embeds to paginate.
If a list of :class:`PageGroup` objects is provided and `show_menu` is ``False``,
only the first page group will be displayed.
Expand Down Expand Up @@ -453,8 +451,7 @@ async def update(

Parameters
----------
pages: Optional[Union[List[:class:`PageGroup`], List[:class:`Page`], List[:class:`str`],
List[Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]]
pages: Optional[Union[List[:class:`PageGroup`], List[:class:`Page`], List[:class:`str`], List[Union[List[:class:`discord.Embed`], :class:`discord.Embed`]]]]
The list of :class:`PageGroup` objects, :class:`Page` objects, strings,
embeds, or list of embeds to paginate.
show_disabled: :class:`bool`
Expand Down Expand Up @@ -863,8 +860,7 @@ async def send(
A target where the paginated message should be sent, if different from the original :class:`Context`
target_message: Optional[:class:`str`]
An optional message shown when the paginator message is sent elsewhere.
reference: Optional[Union[:class:`discord.Message`,
:class:`discord.MessageReference`, :class:`discord.PartialMessage`]]
reference: Optional[Union[:class:`discord.Message`, :class:`discord.MessageReference`, :class:`discord.PartialMessage`]]
A reference to the :class:`~discord.Message` to which you are replying with the paginator.
This can be created using :meth:`~discord.Message.to_reference` or passed directly as a
:class:`~discord.Message`. You can control whether this mentions the author of the referenced message
Expand Down
22 changes: 9 additions & 13 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ class Guild(Hashable):
- ``COMMUNITY``: Guild is a community server.
- ``DISCOVERABLE``: Guild shows up in Server Discovery.
- ``HAS_DIRECTORY_ENTRY``: Unknown.
- ``HUB``: Hubs contain a directory channel that let you find school-related,
student-run servers for your school or university.
- ``HUB``: Hubs contain a directory channel that let you find school-related, student-run servers for your school or university.
- ``INTERNAL_EMPLOYEE_ONLY``: Indicates that only users with the staff badge can join the guild.
- ``INVITE_SPLASH``: Guild's invite page can have a special splash.
- ``INVITES_DISABLED``: Guild Invites are disabled.
Expand All @@ -229,17 +228,14 @@ class Guild(Hashable):
- ``NEWS``: Guild can create news channels.
- ``NEW_THREAD_PERMISSIONS``: Guild has new thread permissions.
- ``PARTNERED``: Guild is a partnered server.
- ``PREMIUM_TIER_3_OVERRIDE``: Forces the server to server boosting level 3 (specifically created by Discord
Staff Member "Jethro" for their personal server).
- ``PREMIUM_TIER_3_OVERRIDE``: Forces the server to server boosting level 3 (specifically created by Discord Staff Member "Jethro" for their personal server).
- ``PREVIEW_ENABLED``: Guild can be viewed before being accepted via Membership Screening.
- ``PRIVATE_THREADS``: Guild has access to create private threads.
- ``ROLE_ICONS``: Guild can set an image or emoji as a role icon.
- ``ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE``: Role subscriptions are available for purchasing.
- ``ROLE_SUBSCRIPTIONS_ENABLED``: Guild is able to view and manage role subscriptions.
- ``TEXT_IN_VOICE_ENABLED``: Guild has a chat button inside voice channels that opens a dedicated text channel
in a sidebar similar to thread view.
- ``THREADS_ENABLED_TESTING``: Used by bot developers to test their bots with threads in guilds with 5 or fewer
members and a bot. Also gives the premium thread features.
- ``TEXT_IN_VOICE_ENABLED``: Guild has a chat button inside voice channels that opens a dedicated text channel in a sidebar similar to thread view.
- ``THREADS_ENABLED_TESTING``: Used by bot developers to test their bots with threads in guilds with 5 or fewer members and a bot. Also gives the premium thread features.
- ``TICKETED_EVENTS_ENABLED``: Guild has enabled ticketed events.
- ``VANITY_URL``: Guild can have a vanity invite URL (e.g. discord.gg/discord-api).
- ``VERIFIED``: Guild is a verified server.
Expand Down Expand Up @@ -1164,7 +1160,7 @@ async def create_text_channel(
-----------
name: :class:`str`
The channel's name.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to the channel. Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
The category to place the newly created channel under.
Expand Down Expand Up @@ -1246,7 +1242,7 @@ async def create_voice_channel(
-----------
name: :class:`str`
The channel's name.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to the channel. Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
The category to place the newly created channel under.
Expand Down Expand Up @@ -1337,7 +1333,7 @@ async def create_stage_channel(
The channel's name.
topic: :class:`str`
The new channel's topic.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to the channel. Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
The category to place the newly created channel under.
Expand Down Expand Up @@ -1438,7 +1434,7 @@ async def create_forum_channel(
-----------
name: :class:`str`
The channel's name.
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`Snowflake`], :class:`PermissionOverwrite`]
overwrites: Dict[Union[:class:`Role`, :class:`Member`, :class:`~discord.abc.Snowflake`], :class:`PermissionOverwrite`]
The overwrites to apply to the channel. Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
The category to place the newly created channel under.
Expand Down Expand Up @@ -2055,7 +2051,7 @@ async def fetch_channel(self, channel_id: int, /) -> Union[GuildChannel, Thread]
Retrieving the channel failed.
NotFound
Invalid Channel ID.
:exc:`.Forbidden`
Forbidden
You do not have permission to fetch this channel.

Returns
Expand Down
4 changes: 2 additions & 2 deletions discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def is_component(self) -> bool:

@utils.cached_slot_property("_cs_channel")
def channel(self) -> Optional[InteractionChannel]:
"""Optional[Union[:class:`abc.GuildChannel`, :class:`PartialMessageable`, :class:`Thread`]]:
The channel the interaction was sent from.
"""Optional[Union[:class:`abc.GuildChannel`, :class:`PartialMessageable`, :class:`Thread`]]: The channel the
interaction was sent from.

Note that due to a Discord limitation, DM channels are not resolved since there is
no data to complete them. These are :class:`PartialMessageable` instead.
Expand Down
7 changes: 3 additions & 4 deletions discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,7 @@ class Message(Hashable):
This is not stored long term within Discord's servers and is only used ephemerally.
embeds: List[:class:`Embed`]
A list of embeds the message has.
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`,
:class:`GroupChannel`, :class:`PartialMessageable`]
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`GroupChannel`, :class:`PartialMessageable`]
The :class:`TextChannel` or :class:`Thread` that the message was sent from.
Could be a :class:`DMChannel` or :class:`GroupChannel` if it's a private message.
reference: Optional[:class:`~discord.MessageReference`]
Expand Down Expand Up @@ -1034,8 +1033,8 @@ def created_at(self) -> datetime.datetime:

@property
def edited_at(self) -> Optional[datetime.datetime]:
"""Optional[:class:`datetime.datetime`]:
An aware UTC datetime object containing the edited time of the message.
"""Optional[:class:`datetime.datetime`]: An aware UTC datetime object containing the
edited time of the message.
"""
return self._edited_timestamp

Expand Down
6 changes: 3 additions & 3 deletions discord/shard.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ def latency(self) -> float:

@property
def latencies(self) -> List[Tuple[int, float]]:
"""List[Tuple[:class:`int`, :class:`float`]]:
A list of latencies between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
"""List[Tuple[:class:`int`, :class:`float`]]: A list of latencies between a
HEARTBEAT and a HEARTBEAT_ACK in seconds.

This returns a list of tuples with elements ``(shard_id, latency)``.
"""
Expand All @@ -413,7 +413,7 @@ def get_shard(self, shard_id: int) -> Optional[ShardInfo]:

@property
def shards(self) -> Dict[int, ShardInfo]:
"""Mapping[int, :class:`ShardInfo`]: Returns a mapping of shard IDs to their respective info object."""
"""Mapping[:class:`int`, :class:`ShardInfo`]: Returns a mapping of shard IDs to their respective info object."""
return {shard_id: ShardInfo(parent, self.shard_count) for shard_id, parent in self.__shards.items()}

async def launch_shard(self, gateway: str, shard_id: int, *, initial: bool = False) -> None:
Expand Down
9 changes: 2 additions & 7 deletions discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,18 +1133,13 @@ async def autocomplete(ctx):

Parameters
-----------
values: Union[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`],
Iterable[:class:`float`]], Callable[[:class:`.AutocompleteContext`], Union[Union[Iterable[:class:`str`],
Iterable[:class:`int`], Iterable[:class:`float`]], Awaitable[Union[Iterable[:class:`str`],
Iterable[:class:`int`], Iterable[:class:`float`]]]]], Awaitable[Union[Iterable[:class:`str`],
Iterable[:class:`int`], Iterable[:class:`float`]]]]
values: Union[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]], Callable[[:class:`.AutocompleteContext`], Union[Union[Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]], Awaitable[Union[Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]]], Awaitable[Union[Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]]
Possible values for the option. Accepts an iterable of :class:`str`, a callable (sync or async) that takes a
single argument of :class:`.AutocompleteContext`, or a coroutine. Must resolve to an iterable of :class:`str`.

Returns
--------
Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`],
Iterable[:class:`int`], Iterable[:class:`float`]]]]
Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]]
A wrapped callback for the autocomplete.
"""

Expand Down
2 changes: 1 addition & 1 deletion discord/welcome_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class WelcomeScreenChannel:
The channel that is being referenced.
description: :class:`str`
The description of the channel that is shown on the welcome screen.
emoji: :class:`Union[:class:`Emoji`, :class:`PartialEmoji`, :class:`str`]`
emoji: Union[:class:`Emoji`, :class:`PartialEmoji`, :class:`str`]
The emoji of the channel that is shown on welcome screen.
"""

Expand Down
9 changes: 0 additions & 9 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4486,15 +4486,6 @@ CategoryChannel
:members:
:inherited-members:

ForumChannel
~~~~~~~~~~~~~~~~~

.. attributetable:: ForumChannel

.. autoclass:: ForumChannel()
:members:
:inherited-members:

DMChannel
~~~~~~~~~

Expand Down