diff --git a/discord/channel.py b/discord/channel.py index e6850930ab..e5e55f360c 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2884,8 +2884,6 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable): The position in the category list. This is a number that starts at 0. e.g. the top category is position 0. Can be ``None`` if the channel was received in an interaction. - .. note:: - flags: :class:`ChannelFlags` Extra features of the channel. diff --git a/discord/client.py b/discord/client.py index c663395ef7..ed6cdb8991 100644 --- a/discord/client.py +++ b/discord/client.py @@ -69,7 +69,7 @@ if TYPE_CHECKING: from .abc import GuildChannel, PrivateChannel, Snowflake, SnowflakeTime from .channel import DMChannel - from .interaction import Interaction + from .interactions import Interaction from .member import Member from .message import Message from .poll import Poll @@ -553,6 +553,15 @@ async def on_view_error( The default view error handler provided by the client. This only fires for a view if you did not define its :func:`~discord.ui.View.on_error`. + + Parameters + ---------- + error: :class:`Exception` + The exception that was raised. + item: :class:`Item` + The item that the user interacted with. + interaction: :class:`Interaction` + The interaction that was received. """ print( @@ -570,6 +579,13 @@ async def on_modal_error(self, error: Exception, interaction: Interaction) -> No The default implementation prints the traceback to stderr. This only fires for a modal if you did not define its :func:`~discord.ui.Modal.on_error`. + + Parameters + ---------- + error: :class:`Exception` + The exception that was raised. + interaction: :class:`Interaction` + The interaction that was received. """ print(f"Ignoring exception in modal {interaction.modal}:", file=sys.stderr) @@ -1297,7 +1313,7 @@ def add_listener(self, func: Coro, name: str = MISSING) -> None: TypeError The ``func`` parameter is not a coroutine function. ValueError - The ``name`` (event name) does not start with 'on_' + The ``name`` (event name) does not start with ``on_``. Example ------- @@ -1361,7 +1377,7 @@ def listen(self, name: str = MISSING, once: bool = False) -> Callable[[Coro], Co TypeError The function being listened to is not a coroutine. ValueError - The ``name`` (event name) does not start with 'on_' + The ``name`` (event name) does not start with ``on_``. Example ------- diff --git a/discord/components.py b/discord/components.py index 3de19a7fc0..a798edb74d 100644 --- a/discord/components.py +++ b/discord/components.py @@ -743,7 +743,6 @@ def __str__(self) -> str: @property def url(self) -> str: - """Returns this media item's url.""" return self._url @url.setter @@ -850,7 +849,6 @@ def __init__(self, url, *, description=None, spoiler=False): @property def url(self) -> str: - """Returns the URL of this gallery's underlying media item.""" return self.media.url def is_dispatchable(self) -> bool: diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index dbf7e28a3c..ef31e01d79 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -185,8 +185,10 @@ def __init__(self, callback, **kwargs): @property def name_localizations(self) -> dict[str, str] | None: """Returns name_localizations from :attr:`slash_variant` - You can edit/set name_localizations directly with + You can edit/set name_localizations directly with + .. code-block:: python3 + bridge_command.name_localizations["en-UK"] = ... # or any other locale # or bridge_command.name_localizations = {"en-UK": ..., "fr-FR": ...} @@ -200,8 +202,10 @@ def name_localizations(self, value): @property def description_localizations(self) -> dict[str, str] | None: """Returns description_localizations from :attr:`slash_variant` - You can edit/set description_localizations directly with + You can edit/set description_localizations directly with + .. code-block:: python3 + bridge_command.description_localizations["en-UK"] = ... # or any other locale # or bridge_command.description_localizations = {"en-UK": ..., "fr-FR": ...} diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 6f6ef1dffa..1a0d8a09a2 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -1877,7 +1877,7 @@ def check_any(*checks: Check) -> Callable[[T], T]: the :func:`check` decorator. Raises - ------- + ------ TypeError A check passed has not been decorated with the :func:`check` decorator. @@ -1899,6 +1899,7 @@ def predicate(ctx): @commands.check_any(commands.is_owner(), is_guild_owner()) async def only_for_owners(ctx): await ctx.send('Hello mister owner!') + """ unwrapped = [] diff --git a/discord/guild.py b/discord/guild.py index cf25ab8a36..ff4c9e04b2 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -56,8 +56,10 @@ EntitlementOwnerType, NotificationLevel, NSFWLevel, + OnboardingMode, ScheduledEventLocationType, ScheduledEventPrivacyLevel, + SortOrder, VerificationLevel, VideoQualityMode, VoiceRegion, @@ -104,6 +106,7 @@ TextChannel, VoiceChannel, ) + from .onboarding import OnboardingPrompt from .permissions import Permissions from .state import ConnectionState from .template import Template @@ -175,8 +178,6 @@ class Guild(Hashable): The channel that denotes the AFK channel. ``None`` if it doesn't exist. id: :class:`int` The guild's ID. - invites_disabled: :class:`bool` - Indicates if the guild invites are disabled. owner_id: :class:`int` The guild owner's ID. Use :attr:`Guild.owner` instead. unavailable: :class:`bool` @@ -1190,7 +1191,7 @@ def created_at(self) -> datetime.datetime: @property def invites_disabled(self) -> bool: - """Returns a boolean indicating if the guild invites are disabled.""" + """A boolean indicating whether the guild invites are disabled.""" return "INVITES_DISABLED" in self.features def get_member_named(self, name: str, /) -> Member | None: @@ -4509,7 +4510,7 @@ def entitlements( exclude_ended=exclude_ended, ) - def get_sound(self, sound_id: int) -> Soundboard | None: + def get_sound(self, sound_id: int) -> SoundboardSound | None: """Returns a sound with the given ID. .. versionadded :: 2.7 diff --git a/discord/raw_models.py b/discord/raw_models.py index d58b8e4278..56d8387b1a 100644 --- a/discord/raw_models.py +++ b/discord/raw_models.py @@ -46,6 +46,7 @@ from .soundboard import PartialSoundboardSound, SoundboardSound from .state import ConnectionState from .threads import Thread + from .types.channel import VoiceChannelEffectSendEvent as VoiceChannelEffectSend from .types.raw_models import ( AuditLogEntryEvent, ) @@ -65,9 +66,6 @@ ThreadMembersUpdateEvent, ThreadUpdateEvent, TypingEvent, - ) - from .types.raw_models import VoiceChannelEffectSendEvent as VoiceChannelEffectSend - from .types.raw_models import ( VoiceChannelStatusUpdateEvent, ) from .user import User diff --git a/docs/api/data_classes.rst b/docs/api/data_classes.rst index 2e2e814289..ad71d7deee 100644 --- a/docs/api/data_classes.rst +++ b/docs/api/data_classes.rst @@ -28,7 +28,7 @@ dynamic attributes in mind. .. attributetable:: MediaGalleryItem -.. autoclass:: SelectOption +.. autoclass:: MediaGalleryItem :members: .. attributetable:: UnfurledMediaItem diff --git a/docs/api/enums.rst b/docs/api/enums.rst index 61bedcc8dd..7ceb0db38a 100644 --- a/docs/api/enums.rst +++ b/docs/api/enums.rst @@ -2362,7 +2362,7 @@ of :class:`enum.Enum`. .. attribute:: advanced - Both default channels and questions (``OnboardingPrompt``s) will count towards the Onboarding requirements. + Both default channels and questions (``OnboardingPrompt``\s) will count towards the Onboarding requirements. .. class:: ReactionType @@ -2572,3 +2572,15 @@ of :class:`enum.Enum`. .. attribute:: large The separator uses large padding. + +.. class:: SortOrder + + Used to represent the default sort order for posts in :class:`ForumChannel` and :class:`MediaChannel`. + + .. attribute:: latest_activity + + Sort by latest activity. + + .. attribute:: creation_date + + Sort by post creation date. diff --git a/docs/api/events.rst b/docs/api/events.rst index b1f08b89e7..45d8c1e279 100644 --- a/docs/api/events.rst +++ b/docs/api/events.rst @@ -1456,9 +1456,9 @@ Soundboard Sound .. versionadded:: 2.7 :param before: The soundboard sound prior to being updated. - :type before: :class:`Soundboard + :type before: :class:`Soundboard` :param after: The soundboard sound after being updated. - :type after: :class:`Soundboard + :type after: :class:`Soundboard` .. function:: on_raw_soundboard_sound_update(after) diff --git a/docs/api/models.rst b/docs/api/models.rst index 7ee6d0f7ef..ef5aaabdbe 100644 --- a/docs/api/models.rst +++ b/docs/api/models.rst @@ -374,7 +374,7 @@ Interactions :members: Message Components ------------- +------------------ .. attributetable:: Component diff --git a/docs/conf.py b/docs/conf.py index d206bb78b8..7cd2e28dfd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -499,7 +499,7 @@ def write_new(): linkcheck_anchors_ignore_for_url = [r"https://github.com/Delitefully/DiscordLists"] modindex_common_prefix = ["discord."] -# suppress_warnings = ['autosectionlabel.*'] +suppress_warnings = ["autosectionlabel.*"] myst_enable_extensions = [ "amsmath", "attrs_inline", diff --git a/docs/ext/bridge/api.rst b/docs/ext/bridge/api.rst index 370b2f3c5d..63fe6d18c0 100644 --- a/docs/ext/bridge/api.rst +++ b/docs/ext/bridge/api.rst @@ -159,7 +159,7 @@ BridgeContext Subclasses Alias of :data:`typing.Union` [ :class:`.BridgeExtContext`, :class:`.BridgeApplicationContext` ] for typing convenience. Options ------- +------- Shortcut Decorators ~~~~~~~~~~~~~~~~~~~