From eec7277a600d7113a17493039ccfd718d062b1c3 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Sat, 16 Nov 2024 21:01:46 +0100 Subject: [PATCH 01/10] refactor(docs): move enum documentation to docstrings --- disnake/enums.py | 889 ++++++++++++++++++++++++++-- docs/api/activities.rst | 61 +- docs/api/app_commands.rst | 77 +-- docs/api/app_info.rst | 76 +-- docs/api/audit_logs.rst | 19 +- docs/api/automod.rst | 67 +-- docs/api/channels.rst | 138 +---- docs/api/components.rst | 130 +--- docs/api/entitlements.rst | 39 +- docs/api/guild_scheduled_events.rst | 59 +- docs/api/guilds.rst | 180 +----- docs/api/integrations.rst | 19 +- docs/api/interactions.rst | 78 +-- docs/api/invites.rst | 38 +- docs/api/localization.rst | 139 +---- docs/api/messages.rst | 198 +------ docs/api/skus.rst | 23 +- docs/api/stage_instances.rst | 23 +- docs/api/stickers.rst | 40 +- docs/api/users.rst | 107 +--- docs/api/voice.rst | 72 +-- docs/api/webhooks.rst | 21 +- docs/api/widgets.rst | 29 +- 23 files changed, 951 insertions(+), 1571 deletions(-) diff --git a/disnake/enums.py b/disnake/enums.py index 8c587ca902..247af085e6 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -208,79 +208,270 @@ def try_value(cls, value): class ChannelType(Enum): + """Specifies the type of channel.""" + text = 0 + """A text channel.""" private = 1 + """A private text channel. Also called a direct message.""" voice = 2 + """A voice channel.""" group = 3 + """A private group text channel.""" category = 4 + """A category channel.""" news = 5 + """A guild news channel.""" news_thread = 10 + """A news thread. + + .. versionadded:: 2.0 + """ public_thread = 11 + """A public thread. + + .. versionadded:: 2.0 + """ private_thread = 12 + """A private thread. + + .. versionadded:: 2.0 + """ stage_voice = 13 + """A guild stage voice channel. + + .. versionadded:: 1.7 + """ guild_directory = 14 + """A student hub channel. + + .. versionadded:: 2.1 + """ forum = 15 + """A channel of only threads. + + .. versionadded:: 2.5 + """ media = 16 + """A channel of only threads but with a focus on media, similar to forum channels. + + .. versionadded:: 2.10 + """ def __str__(self) -> str: return self.name class MessageType(Enum): + """Specifies the type of :class:`Message`. This is used to denote if a message + is to be interpreted as a system message or a regular message. + """ + default = 0 + """The default message type. This is the same as regular messages.""" recipient_add = 1 + """The system message when a user is added to a group private message or a thread.""" recipient_remove = 2 + """The system message when a user is removed from a group private message or a thread.""" call = 3 + """The system message denoting call state, e.g. missed call, started call, etc.""" channel_name_change = 4 + """The system message denoting that a channel's name has been changed.""" channel_icon_change = 5 + """The system message denoting that a channel's icon has been changed.""" pins_add = 6 + """The system message denoting that a pinned message has been added to a channel.""" new_member = 7 + """The system message denoting that a new member has joined a Guild.""" premium_guild_subscription = 8 + """The system message denoting that a member has "nitro boosted" a guild.""" premium_guild_tier_1 = 9 + """The system message denoting that a member has "nitro boosted" a guild and it achieved level 1.""" premium_guild_tier_2 = 10 + """The system message denoting that a member has "nitro boosted" a guild and it achieved level 2.""" premium_guild_tier_3 = 11 + """The system message denoting that a member has "nitro boosted" a guild and it achieved level 3.""" channel_follow_add = 12 + """The system message denoting that an announcement channel has been followed. + + .. versionadded:: 1.3 + """ guild_stream = 13 + """The system message denoting that a member is streaming in the guild. + + .. versionadded:: 1.7 + """ guild_discovery_disqualified = 14 + """The system message denoting that the guild is no longer eligible for Server Discovery. + + .. versionadded:: 1.7 + """ guild_discovery_requalified = 15 + """The system message denoting that the guild has become eligible again for Server Discovery. + + .. versionadded:: 1.7 + """ guild_discovery_grace_period_initial_warning = 16 + """The system message denoting that the guild has failed to meet the Server + Discovery requirements for one week. + + .. versionadded:: 1.7 + """ guild_discovery_grace_period_final_warning = 17 + """The system message denoting that the guild has failed to meet the Server + Discovery requirements for 3 weeks in a row. + + .. versionadded:: 1.7 + """ thread_created = 18 + """The system message denoting that a thread has been created. This is only + sent if the thread has been created from an older message. The period of time + required for a message to be considered old cannot be relied upon and is up to + Discord. + + .. versionadded:: 2.0 + """ reply = 19 + """The system message denoting that the author is replying to a message. + + .. versionadded:: 2.0 + """ application_command = 20 + """The system message denoting that an application (or "slash") command was executed. + + .. versionadded:: 2.0 + """ thread_starter_message = 21 + """The system message denoting the message in the thread that is the one that started the + thread's conversation topic. + + .. versionadded:: 2.0 + """ guild_invite_reminder = 22 + """The system message sent as a reminder to invite people to the guild. + + .. versionadded:: 2.0 + """ context_menu_command = 23 + """The system message denoting that a context menu command was executed. + + .. versionadded:: 2.3 + """ auto_moderation_action = 24 + """The system message denoting that an auto moderation action was executed. + + .. versionadded:: 2.5 + """ role_subscription_purchase = 25 + """The system message denoting that a role subscription was purchased. + + .. versionadded:: 2.9 + """ interaction_premium_upsell = 26 + """The system message for an application premium subscription upsell. + + .. versionadded:: 2.8 + """ stage_start = 27 + """The system message denoting the stage has been started. + + .. versionadded:: 2.9 + """ stage_end = 28 + """The system message denoting the stage has ended. + + .. versionadded:: 2.9 + """ stage_speaker = 29 + """The system message denoting a user has become a speaker. + + .. versionadded:: 2.9 + """ stage_topic = 31 + """The system message denoting the stage topic has been changed. + + .. versionadded:: 2.9 + """ guild_application_premium_subscription = 32 + """The system message denoting that a guild member has subscribed to an application. + + .. versionadded:: 2.8 + """ guild_incident_alert_mode_enabled = 36 + """The system message denoting that an admin enabled security actions. + + .. versionadded:: 2.10 + """ guild_incident_alert_mode_disabled = 37 + """The system message denoting that an admin disabled security actions. + + .. versionadded:: 2.10 + """ guild_incident_report_raid = 38 + """The system message denoting that an admin reported a raid. + + .. versionadded:: 2.10 + """ guild_incident_report_false_alarm = 39 + """The system message denoting that a raid report was a false alarm. + + .. versionadded:: 2.10 + """ class PartyType(Enum): + """Represents the type of a voice channel activity/application. + + .. deprecated:: 2.9 + """ + poker = 755827207812677713 + """The "Poker Night" activity.""" betrayal = 773336526917861400 + """The "Betrayal.io" activity.""" fishing = 814288819477020702 + """The "Fishington.io" activity.""" chess = 832012774040141894 + """The "Chess In The Park" activity.""" letter_tile = 879863686565621790 + """The "Letter Tile" activity.""" word_snack = 879863976006127627 + """The "Word Snacks" activity.""" doodle_crew = 878067389634314250 + """The "Doodle Crew" activity.""" checkers = 832013003968348200 + """The "Checkers In The Park" activity. + + .. versionadded:: 2.3 + """ spellcast = 852509694341283871 + """The "SpellCast" activity. + + .. versionadded:: 2.3 + """ watch_together = 880218394199220334 + """The "Watch Together" activity, a Youtube application. + + .. versionadded:: 2.3 + """ sketch_heads = 902271654783242291 + """The "Sketch Heads" activity. + + .. versionadded:: 2.4 + """ ocho = 832025144389533716 + """The "Ocho" activity. + + .. versionadded:: 2.4 + """ gartic_phone = 1007373802981822582 + """The "Gartic Phone" activity. + + .. versionadded:: 2.9 + """ +# undocumented/internal class SpeakingState(Enum): none = 0 voice = 1 << 0 @@ -295,63 +486,192 @@ def __int__(self) -> int: class VerificationLevel(Enum, comparable=True): + """Specifies a :class:`Guild`\\'s verification level, which is the criteria in + which a member must meet before being able to send messages to the guild. + + .. collapse:: operations + + .. versionadded:: 2.0 + + .. describe:: x == y + + Checks if two verification levels are equal. + .. describe:: x != y + + Checks if two verification levels are not equal. + .. describe:: x > y + + Checks if a verification level is higher than another. + .. describe:: x < y + + Checks if a verification level is lower than another. + .. describe:: x >= y + + Checks if a verification level is higher or equal to another. + .. describe:: x <= y + + Checks if a verification level is lower or equal to another. + """ + none = 0 + """No criteria set.""" low = 1 + """Member must have a verified email on their Discord account.""" medium = 2 + """Member must have a verified email and be registered on Discord for more than five minutes.""" high = 3 + """Member must have a verified email, be registered on Discord for more + than five minutes, and be a member of the guild itself for more than ten minutes. + """ highest = 4 + """Member must have a verified phone on their Discord account.""" def __str__(self) -> str: return self.name class ContentFilter(Enum, comparable=True): + """Specifies a :class:`Guild`\\'s explicit content filter, which is the machine + learning algorithms that Discord uses to detect if an image contains NSFW content. + + .. collapse:: operations + + .. describe:: x == y + + Checks if two content filter levels are equal. + .. describe:: x != y + + Checks if two content filter levels are not equal. + .. describe:: x > y + + Checks if a content filter level is higher than another. + .. describe:: x < y + + Checks if a content filter level is lower than another. + .. describe:: x >= y + + Checks if a content filter level is higher or equal to another. + .. describe:: x <= y + + Checks if a content filter level is lower or equal to another. + """ + disabled = 0 + """The guild does not have the content filter enabled.""" no_role = 1 + """The guild has the content filter enabled for members without a role.""" all_members = 2 + """The guild has the content filter enabled for every member.""" def __str__(self) -> str: return self.name class Status(Enum): + """Specifies a :class:`Member`\\'s status.""" + online = "online" + """The member is online.""" offline = "offline" + """The member is offline.""" idle = "idle" + """The member is idle.""" dnd = "dnd" + """The member is "Do Not Disturb".""" do_not_disturb = "dnd" + """An alias for :attr:`dnd`.""" invisible = "invisible" + """The member is "invisible". In reality, this is only used in sending + a presence a la :meth:`Client.change_presence`. When you receive a + user's presence this will be :attr:`offline` instead. + """ streaming = "streaming" + """The member is live streaming to Twitch or YouTube. + + .. versionadded:: 2.3 + """ def __str__(self) -> str: return self.value class DefaultAvatar(Enum): + """Represents the default avatar of a Discord :class:`User`.""" + blurple = 0 + """Represents the default avatar with the color blurple. See also :attr:`Colour.blurple`.""" grey = 1 + """Represents the default avatar with the color grey. See also :attr:`Colour.greyple`.""" gray = 1 + """An alias for :attr:`grey`.""" green = 2 + """Represents the default avatar with the color green. See also :attr:`Colour.green`.""" orange = 3 + """Represents the default avatar with the color orange. See also :attr:`Colour.orange`.""" red = 4 + """Represents the default avatar with the color red. See also :attr:`Colour.red`.""" fuchsia = 5 + """Represents the default avatar with the color fuchsia. See also :attr:`Colour.fuchsia`. + + .. versionadded:: 2.9 + """ def __str__(self) -> str: return self.name class NotificationLevel(Enum, comparable=True): + """Specifies whether a :class:`Guild` has notifications on for all messages or mentions only by default. + + .. collapse:: operations + + .. describe:: x == y + + Checks if two notification levels are equal. + .. describe:: x != y + + Checks if two notification levels are not equal. + .. describe:: x > y + + Checks if a notification level is higher than another. + .. describe:: x < y + + Checks if a notification level is lower than another. + .. describe:: x >= y + + Checks if a notification level is higher or equal to another. + .. describe:: x <= y + + Checks if a notification level is lower or equal to another. + """ + all_messages = 0 + """Members receive notifications for every message regardless of them being mentioned.""" only_mentions = 1 + """Members receive notifications for messages they are mentioned in.""" class AuditLogActionCategory(Enum): + """Represents the category that the :class:`AuditLogAction` belongs to. + + This can be retrieved via :attr:`AuditLogEntry.category`. + """ + create = 1 + """The action is the creation of something.""" delete = 2 + """The action is the deletion of something.""" update = 3 + """The action is the update of something.""" +# NOTE: these fields are only fully documented in audit_logs.rst, +# as the docstrings alone would be ~1000-1500 additional lines class AuditLogAction(Enum): + """Represents the type of action being done for a :class:`AuditLogEntry`\\, + which is retrievable via :meth:`Guild.audit_logs` or via the :func:`on_audit_log_entry_create` event. + """ + # fmt: off guild_update = 1 channel_create = 10 @@ -523,79 +843,186 @@ def target_type(self) -> Optional[str]: class UserFlags(Enum): + """Represents Discord user flags.""" + staff = 1 << 0 + """The user is a Discord Employee.""" partner = 1 << 1 + """The user is a Discord Partner.""" hypesquad = 1 << 2 + """The user is a HypeSquad Events member.""" bug_hunter = 1 << 3 + """The user is a Bug Hunter.""" mfa_sms = 1 << 4 + """The user has SMS recovery for Multi Factor Authentication enabled.""" premium_promo_dismissed = 1 << 5 + """The user has dismissed the Discord Nitro promotion.""" hypesquad_bravery = 1 << 6 + """The user is a HypeSquad Bravery member.""" hypesquad_brilliance = 1 << 7 + """The user is a HypeSquad Brilliance member.""" hypesquad_balance = 1 << 8 + """The user is a HypeSquad Balance member.""" early_supporter = 1 << 9 + """The user is an Early Supporter.""" team_user = 1 << 10 + """The user is a Team User.""" system = 1 << 12 + """The user is a system user (i.e. represents Discord officially).""" has_unread_urgent_messages = 1 << 13 + """The user has an unread system message.""" bug_hunter_level_2 = 1 << 14 + """The user is a Bug Hunter Level 2.""" verified_bot = 1 << 16 + """The user is a Verified Bot.""" verified_bot_developer = 1 << 17 + """The user is an Early Verified Bot Developer.""" discord_certified_moderator = 1 << 18 + """The user is a Discord Certified Moderator.""" http_interactions_bot = 1 << 19 + """The user is a bot that only uses HTTP interactions. + + .. versionadded:: 2.3 + """ spammer = 1 << 20 + """The user is marked as a spammer. + + .. versionadded:: 2.3 + """ active_developer = 1 << 22 + """The user is an Active Developer. + + .. versionadded:: 2.8 + """ class ActivityType(Enum): + """Specifies the type of :class:`Activity`. This is used to check how to + interpret the activity itself. + """ + unknown = -1 + """An unknown activity type. This should generally not happen.""" playing = 0 + """A "Playing" activity type.""" streaming = 1 + """A "Streaming" activity type.""" listening = 2 + """A "Listening" activity type.""" watching = 3 + """A "Watching" activity type.""" custom = 4 + """A custom activity type.""" competing = 5 + """A competing activity type. + + .. versionadded:: 1.5 + """ def __int__(self) -> int: return self.value class TeamMembershipState(Enum): + """Represents the membership state of a team member retrieved through :func:`Client.application_info`. + + .. versionadded:: 1.3 + """ + invited = 1 + """Represents an invited member.""" accepted = 2 + """Represents a member currently in the team.""" class TeamMemberRole(Enum): + """Represents the role of a team member retrieved through :func:`Client.application_info`. + + .. versionadded:: 2.10 + """ + admin = "admin" + """Admins have the most permissions. An admin can only take destructive actions + on the team or team-owned apps if they are the team owner. + """ developer = "developer" + """Developers can access information about a team and team-owned applications, + and take limited actions on them, like configuring interaction + endpoints or resetting the bot token. + """ read_only = "read_only" + """Read-only members can access information about a team and team-owned applications.""" def __str__(self) -> str: return self.name class WebhookType(Enum): + """Represents the type of webhook that can be received. + + .. versionadded:: 1.3 + """ + incoming = 1 + """Represents a webhook that can post messages to channels with a token.""" channel_follower = 2 + """Represents a webhook that is internally managed by Discord, used for following channels.""" application = 3 + """Represents a webhook that is used for interactions or applications. + + .. versionadded:: 2.0 + """ class ExpireBehaviour(Enum): + """Represents the behaviour the :class:`Integration` should perform + when a user's subscription has finished. + + There is an alias for this called ``ExpireBehavior``. + + .. versionadded:: 1.4 + """ + remove_role = 0 + """This will remove the :attr:`StreamIntegration.role` from the user + when their subscription is finished. + """ kick = 1 + """This will kick the user when their subscription is finished.""" ExpireBehavior = ExpireBehaviour class StickerType(Enum): + """Represents the type of sticker. + + .. versionadded:: 2.0 + """ + standard = 1 + """Represents a standard sticker that all users can use.""" guild = 2 + """Represents a custom sticker created in a guild.""" class StickerFormatType(Enum): + """Represents the type of sticker images. + + .. versionadded:: 1.6 + """ + png = 1 + """Represents a sticker with a png image.""" apng = 2 + """Represents a sticker with an apng image.""" lottie = 3 + """Represents a sticker with a lottie image.""" gif = 4 + """Represents a sticker with a gif image. + + .. versionadded:: 2.8 + """ @property def file_extension(self) -> str: @@ -611,175 +1038,442 @@ def file_extension(self) -> str: class InviteType(Enum): + """Represents the type of an invite. + + .. versionadded:: 2.10 + """ + guild = 0 + """Represents an invite to a guild.""" group_dm = 1 + """Represents an invite to a group channel.""" friend = 2 + """Represents a friend invite.""" class InviteTarget(Enum): + """Represents the invite type for voice channel invites. + + .. versionadded:: 2.0 + """ + unknown = 0 + """The invite doesn't target anyone or anything.""" stream = 1 + """A stream invite that targets a user.""" embedded_application = 2 + """A stream invite that targets an embedded application.""" class InteractionType(Enum): + """Specifies the type of :class:`Interaction`. + + .. versionadded:: 2.0 + """ + ping = 1 + """Represents Discord pinging to see if the interaction response server is alive.""" application_command = 2 + """Represents an application command interaction.""" component = 3 + """Represents a component based interaction, i.e. using the Discord Bot UI Kit.""" application_command_autocomplete = 4 + """Represents an application command autocomplete interaction.""" modal_submit = 5 + """Represents a modal submit interaction.""" class InteractionResponseType(Enum): + """Specifies the response type for the interaction. + + .. versionadded:: 2.0 + """ + pong = 1 + """Pongs the interaction when given a ping. + + See also :meth:`InteractionResponse.pong`. + """ channel_message = 4 + """Responds to the interaction with a message. + + See also :meth:`InteractionResponse.send_message`. + """ deferred_channel_message = 5 + """Responds to the interaction with a message at a later time. + + See also :meth:`InteractionResponse.defer`. + """ deferred_message_update = 6 + """Acknowledges the component interaction with a promise that + the message will update later (though there is no need to actually update the message). + + See also :meth:`InteractionResponse.defer`. + """ message_update = 7 + """Responds to the interaction by editing the message. + + See also :meth:`InteractionResponse.edit_message`. + """ application_command_autocomplete_result = 8 + """Responds to the autocomplete interaction with suggested choices. + + See also :meth:`InteractionResponse.autocomplete`. + """ modal = 9 + """Responds to the interaction by displaying a modal. + + See also :meth:`InteractionResponse.send_modal`. + + .. versionadded:: 2.4 + """ premium_required = 10 + """Responds to the interaction with a message containing an upgrade button. + Only available for applications with monetization enabled. + + See also :meth:`InteractionResponse.require_premium`. + + .. versionadded:: 2.10 + """ class VideoQualityMode(Enum): + """Represents the camera video quality mode for voice channel participants. + + .. versionadded:: 2.0 + """ + auto = 1 + """Represents auto camera video quality.""" full = 2 + """Represents full camera video quality.""" def __int__(self) -> int: return self.value class ComponentType(Enum): + """Represents the type of component. + + .. versionadded:: 2.0 + """ + action_row = 1 + """Represents the group component which holds different components in a row.""" button = 2 + """Represents a button component.""" string_select = 3 + """Represents a string select component. + + .. versionadded:: 2.7 + """ select = 3 # backwards compatibility + """An alias of :attr:`string_select`.""" text_input = 4 + """Represents a text input component.""" user_select = 5 + """Represents a user select component. + + .. versionadded:: 2.7 + """ role_select = 6 + """Represents a role select component. + + .. versionadded:: 2.7 + """ mentionable_select = 7 + """Represents a mentionable (user/member/role) select component. + + .. versionadded:: 2.7 + """ channel_select = 8 + """Represents a channel select component. + + .. versionadded:: 2.7 + """ def __int__(self) -> int: return self.value class ButtonStyle(Enum): + """Represents the style of the button component. + + .. versionadded:: 2.0 + """ + primary = 1 + """Represents a blurple button for the primary action.""" secondary = 2 + """Represents a grey button for the secondary action.""" success = 3 + """Represents a green button for a successful action.""" danger = 4 + """Represents a red button for a dangerous action.""" link = 5 + """Represents a link button.""" # Aliases blurple = 1 + """An alias for :attr:`primary`.""" grey = 2 + """An alias for :attr:`secondary`.""" gray = 2 + """An alias for :attr:`secondary`.""" green = 3 + """An alias for :attr:`success`.""" red = 4 + """An alias for :attr:`danger`.""" url = 5 + """An alias for :attr:`link`.""" def __int__(self) -> int: return self.value class TextInputStyle(Enum): + """Represents a style of the text input component. + + .. versionadded:: 2.4 + """ + short = 1 + """Represents a single-line text input component.""" paragraph = 2 + """Represents a multi-line text input component.""" + # Aliases single_line = 1 + """An alias for :attr:`short`.""" multi_line = 2 + """An alias for :attr:`paragraph`.""" long = 2 + """An alias for :attr:`paragraph`.""" def __int__(self) -> int: return self.value class SelectDefaultValueType(Enum): + """Represents the type of a :class:`SelectDefaultValue`. + + .. versionadded:: 2.10 + """ + user = "user" + """Represents a user/member.""" role = "role" + """Represents a role.""" channel = "channel" + """Represents a channel.""" def __str__(self) -> str: return self.value class ApplicationCommandType(Enum): + """Represents the type of an application command. + + .. versionadded:: 2.1 + """ + chat_input = 1 + """Represents a slash command.""" user = 2 + """Represents a user command from the context menu.""" message = 3 + """Represents a message command from the context menu.""" class ApplicationCommandPermissionType(Enum): + """Represents the type of a permission of an application command. + + .. versionadded:: 2.5 + """ + role = 1 + """Represents a permission that affects roles.""" user = 2 + """Represents a permission that affects users.""" channel = 3 + """Represents a permission that affects channels.""" def __int__(self) -> int: return self.value class OptionType(Enum): + """Represents the type of an option. + + .. versionadded:: 2.1 + """ + sub_command = 1 + """Represents a sub command of the main command or group.""" sub_command_group = 2 + """Represents a sub command group of the main command.""" string = 3 + """Represents a string option.""" integer = 4 + """Represents an integer option.""" boolean = 5 + """Represents a boolean option.""" user = 6 + """Represents a user option.""" channel = 7 + """Represents a channel option.""" role = 8 + """Represents a role option.""" mentionable = 9 + """Represents a role + user option.""" number = 10 + """Represents a float option.""" attachment = 11 + """Represents an attachment option. + + .. versionadded:: 2.4 + """ class StagePrivacyLevel(Enum): + """Represents a stage instance's privacy level. + + .. versionadded:: 2.0 + """ + public = 1 + """The stage instance can be joined by external users. + + .. deprecated:: 2.5 + Public stages are no longer supported by discord. + """ closed = 2 + """The stage instance can only be joined by members of the guild.""" guild_only = 2 + """Alias for :attr:`.closed`""" class NSFWLevel(Enum, comparable=True): + """Represents the NSFW level of a guild. + + .. versionadded:: 2.0 + + .. collapse:: operations + + .. describe:: x == y + + Checks if two NSFW levels are equal. + .. describe:: x != y + + Checks if two NSFW levels are not equal. + .. describe:: x > y + + Checks if a NSFW level is higher than another. + .. describe:: x < y + + Checks if a NSFW level is lower than another. + .. describe:: x >= y + + Checks if a NSFW level is higher or equal to another. + .. describe:: x <= y + + Checks if a NSFW level is lower or equal to another. + """ + default = 0 + """The guild has not been categorised yet.""" explicit = 1 + """The guild contains NSFW content.""" safe = 2 + """The guild does not contain any NSFW content.""" age_restricted = 3 + """The guild may contain NSFW content.""" class GuildScheduledEventEntityType(Enum): + """Represents the type of a guild scheduled event entity. + + .. versionadded:: 2.3 + """ + stage_instance = 1 + """The guild scheduled event will take place in a stage channel.""" voice = 2 + """The guild scheduled event will take place in a voice channel.""" external = 3 + """The guild scheduled event will take place in a custom location.""" class GuildScheduledEventStatus(Enum): + """Represents the status of a guild scheduled event. + + .. versionadded:: 2.3 + """ + scheduled = 1 + """Represents a scheduled event.""" active = 2 + """Represents an active event.""" completed = 3 + """Represents a completed event.""" canceled = 4 + """Represents a canceled event.""" cancelled = 4 + """An alias for :attr:`canceled`. + + .. versionadded:: 2.6 + """ class GuildScheduledEventPrivacyLevel(Enum): + """Represents the privacy level of a guild scheduled event. + + .. versionadded:: 2.3 + """ + guild_only = 2 + """The guild scheduled event is only for a specific guild.""" class ThreadArchiveDuration(Enum): + """Represents the automatic archive duration of a thread in minutes. + + .. versionadded:: 2.3 + """ + hour = 60 + """The thread will archive after an hour of inactivity.""" day = 1440 + """The thread will archive after a day of inactivity.""" three_days = 4320 + """The thread will archive after three days of inactivity.""" week = 10080 + """The thread will archive after a week of inactivity.""" def __int__(self) -> int: return self.value class WidgetStyle(Enum): + """Represents the supported widget image styles. + + .. versionadded:: 2.5 + """ + shield = "shield" + """A shield style image with a Discord icon and the online member count.""" banner1 = "banner1" + """A large image with guild icon, name and online member count and a footer.""" banner2 = "banner2" + """A small image with guild icon, name and online member count.""" banner3 = "banner3" + """A large image with guild icon, name and online member count and a footer, + with a "Chat Now" label on the right. + """ banner4 = "banner4" + """A large image with a large Discord logo, guild icon, name and online member count, + with a "Join My Server" label at the bottom. + """ def __str__(self) -> str: return self.value @@ -787,112 +1481,181 @@ def __str__(self) -> str: # reference: https://discord.com/developers/docs/reference#locales class Locale(Enum): + """Represents supported locales by Discord. + + .. versionadded:: 2.5 + """ + bg = "bg" - "Bulgarian | български" + """The ``bg`` (Bulgarian) locale.""" cs = "cs" - "Czech | Čeština" + """The ``cs`` (Czech) locale.""" da = "da" - "Danish | Dansk" + """The ``da`` (Danish) locale.""" de = "de" - "German | Deutsch" + """The ``de`` (German) locale.""" el = "el" - "Greek | Ελληνικά" + """The ``el`` (Greek) locale.""" en_GB = "en-GB" - "English, UK | English, UK" + """The ``en-GB`` (English, UK) locale.""" en_US = "en-US" - "English, US | English, US" + """The ``en-US`` (English, US) locale.""" es_ES = "es-ES" - "Spanish | Español" + """The ``es-ES`` (Spanish) locale.""" es_LATAM = "es-419" - "Spanish, LATAM | Español, LATAM" + """The ``es-419`` (Spanish, LATAM) locale. + + .. versionadded:: 2.10 + """ fi = "fi" - "Finnish | Suomi" + """The ``fi`` (Finnish) locale.""" fr = "fr" - "French | Français" + """The ``fr`` (French) locale.""" hi = "hi" - "Hindi | हिन्दी" + """The ``hi`` (Hindi) locale.""" hr = "hr" - "Croatian | Hrvatski" + """The ``hr`` (Croatian) locale.""" hu = "hu" - "Hungarian | Magyar" + """The ``hu`` (Hungarian) locale.""" id = "id" - "Indonesian | Bahasa Indonesia" + """The ``id`` (Indonesian) locale. + + .. versionadded:: 2.8 + """ it = "it" - "Italian | Italiano" + """The ``it`` (Italian) locale.""" ja = "ja" - "Japanese | 日本語" + """The ``ja`` (Japanese) locale.""" ko = "ko" - "Korean | 한국어" + """The ``ko`` (Korean) locale.""" lt = "lt" - "Lithuanian | Lietuviškai" + """The ``lt`` (Lithuanian) locale.""" nl = "nl" - "Dutch | Nederlands" + """The ``nl`` (Dutch) locale.""" no = "no" - "Norwegian | Norsk" + """The ``no`` (Norwegian) locale.""" pl = "pl" - "Polish | Polski" + """The ``pl`` (Polish) locale.""" pt_BR = "pt-BR" - "Portuguese, Brazilian | Português do Brasil" + """The ``pt-BR`` (Portuguese) locale.""" ro = "ro" - "Romanian, Romania | Română" + """The ``ro`` (Romanian) locale.""" ru = "ru" - "Russian | Pусский" # noqa: RUF001 + """The ``ru`` (Russian) locale.""" sv_SE = "sv-SE" - "Swedish | Svenska" + """The ``sv-SE`` (Swedish) locale.""" th = "th" - "Thai | ไทย" + """The ``th`` (Thai) locale.""" tr = "tr" - "Turkish | Türkçe" + """The ``tr`` (Turkish) locale.""" uk = "uk" - "Ukrainian | Українська" + """The ``uk`` (Ukrainian) locale.""" vi = "vi" - "Vietnamese | Tiếng Việt" + """The ``vi`` (Vietnamese) locale.""" zh_CN = "zh-CN" - "Chinese, China | 中文" + """The ``zh-CN`` (Chinese, China) locale.""" zh_TW = "zh-TW" - "Chinese, Taiwan | 繁體中文" + """The ``zh-TW`` (Chinese, Taiwan) locale.""" def __str__(self) -> str: return self.value class AutoModActionType(Enum): + """Represents the type of action an auto moderation rule will take upon execution. + + .. versionadded:: 2.6 + """ + block_message = 1 + """The rule will prevent matching messages from being posted.""" send_alert_message = 2 + """The rule will send an alert to a specified channel.""" timeout = 3 + """The rule will timeout the user that sent the message. + + .. note:: + This action type is only available for rules with trigger type + :attr:`~AutoModTriggerType.keyword` or :attr:`~AutoModTriggerType.mention_spam`, + and :attr:`~Permissions.moderate_members` permissions are required to use it. + """ class AutoModEventType(Enum): + """Represents the type of event/context an auto moderation rule will be checked in. + + .. versionadded:: 2.6 + """ + message_send = 1 + """The rule will apply when a member sends or edits a message in the guild.""" class AutoModTriggerType(Enum): + """Represents the type of content that can trigger an auto moderation rule. + + .. versionadded:: 2.6 + + .. versionchanged:: 2.9 + Removed obsolete ``harmful_link`` type. + """ + keyword = 1 + """The rule will filter messages based on a custom keyword list. + + This trigger type requires additional :class:`metadata `. + """ + if not TYPE_CHECKING: harmful_link = 2 # obsolete/deprecated + spam = 3 + """The rule will filter messages suspected of being spam.""" keyword_preset = 4 + """The rule will filter messages based on predefined lists containing commonly flagged words. + + This trigger type requires additional :class:`metadata `. + """ mention_spam = 5 + """The rule will filter messages based on the number of member/role mentions they contain. + + This trigger type requires additional :class:`metadata `. + """ class ThreadSortOrder(Enum): + """Represents the sort order of threads in a :class:`ForumChannel` or :class:`MediaChannel`. + + .. versionadded:: 2.6 + """ + latest_activity = 0 + """Sort forum threads by activity.""" creation_date = 1 + """Sort forum threads by creation date/time (from newest to oldest).""" class ThreadLayout(Enum): + """Represents the layout of threads in :class:`ForumChannel`\\s. + + .. versionadded:: 2.8 + """ + not_set = 0 + """No preferred layout has been set.""" list_view = 1 + """Display forum threads in a text-focused list.""" gallery_view = 2 + """Display forum threads in a media-focused collection of tiles.""" class Event(Enum): - """Represents all the events of the library. + """ + Represents all the events of the library. These offer to register listeners/events in a more pythonic way; additionally autocompletion and documentation are both supported. .. versionadded:: 2.8 - """ connect = "connect" @@ -1372,46 +2135,104 @@ class Event(Enum): class ApplicationRoleConnectionMetadataType(Enum): + """Represents the type of a role connection metadata value. + + These offer comparison operations, which allow guilds to configure role requirements + based on the metadata value for each user and a guild-specified configured value. + + .. versionadded:: 2.8 + """ + integer_less_than_or_equal = 1 + """The metadata value (``integer``) is less than or equal to the guild's configured value.""" integer_greater_than_or_equal = 2 + """The metadata value (``integer``) is greater than or equal to the guild's configured value.""" integer_equal = 3 + """The metadata value (``integer``) is equal to the guild's configured value.""" integer_not_equal = 4 + """The metadata value (``integer``) is not equal to the guild's configured value.""" datetime_less_than_or_equal = 5 + """The metadata value (``ISO8601 string``) is less than or equal to the guild's configured value (``integer``; days before current date).""" datetime_greater_than_or_equal = 6 + """The metadata value (``ISO8601 string``) is greater than or equal to the guild's configured value (``integer``; days before current date).""" boolean_equal = 7 + """The metadata value (``integer``) is equal to the guild's configured value.""" boolean_not_equal = 8 + """The metadata value (``integer``) is not equal to the guild's configured value.""" class OnboardingPromptType(Enum): + """Represents the type of onboarding prompt. + + .. versionadded:: 2.9 + """ + multiple_choice = 0 + """The prompt is a multiple choice prompt.""" dropdown = 1 + """The prompt is a dropdown prompt.""" class SKUType(Enum): + """Represents the type of an SKU. + + .. versionadded:: 2.10 + """ + durable = 2 + """Represents a durable one-time purchase.""" consumable = 3 + """Represents a consumable one-time purchase.""" subscription = 5 + """Represents a recurring subscription.""" subscription_group = 6 + """Represents a system-generated group for each :attr:`subscription` SKU.""" class EntitlementType(Enum): + """Represents the type of an entitlement. + + .. versionadded:: 2.10 + """ + purchase = 1 + """Represents an entitlement purchased by a user.""" premium_subscription = 2 + """Represents an entitlement for a Discord Nitro subscription.""" developer_gift = 3 + """Represents an entitlement gifted by the application developer.""" test_mode_purchase = 4 + """Represents an entitlement purchased by a developer in application test mode.""" free_purchase = 5 + """Represents an entitlement granted when the SKU was free.""" user_gift = 6 + """Represents an entitlement gifted by another user.""" premium_purchase = 7 + """Represents an entitlement claimed by a user for free as a Discord Nitro subscriber.""" application_subscription = 8 + """Represents an entitlement for an application subscription.""" class PollLayoutType(Enum): + """Specifies the layout of a :class:`Poll`. + + .. versionadded:: 2.10 + """ + default = 1 + """The default poll layout type.""" class VoiceChannelEffectAnimationType(Enum): + """The type of an emoji reaction effect animation in a voice channel. + + .. versionadded:: 2.10 + """ + premium = 0 + """A fun animation, sent by a Nitro subscriber.""" basic = 1 + """A standard animation.""" T = TypeVar("T") diff --git a/docs/api/activities.rst b/docs/api/activities.rst index cc2e7414c4..d1770c9ff4 100644 --- a/docs/api/activities.rst +++ b/docs/api/activities.rst @@ -74,67 +74,14 @@ Enumerations ActivityType ~~~~~~~~~~~~ -.. class:: ActivityType - - Specifies the type of :class:`Activity`. This is used to check how to - interpret the activity itself. - - .. attribute:: unknown - - An unknown activity type. This should generally not happen. - .. attribute:: playing - - A "Playing" activity type. - .. attribute:: streaming - - A "Streaming" activity type. - .. attribute:: listening - - A "Listening" activity type. - .. attribute:: watching - - A "Watching" activity type. - .. attribute:: custom - - A custom activity type. - .. attribute:: competing - - A competing activity type. - - .. versionadded:: 1.5 +.. autoclass:: ActivityType + :members: Status ~~~~~~ -.. class:: Status - - Specifies a :class:`Member` 's status. - - .. attribute:: online - - The member is online. - .. attribute:: offline - - The member is offline. - .. attribute:: idle - - The member is idle. - .. attribute:: dnd - - The member is "Do Not Disturb". - .. attribute:: do_not_disturb - - An alias for :attr:`dnd`. - .. attribute:: invisible - - The member is "invisible". In reality, this is only used in sending - a presence a la :meth:`Client.change_presence`. When you receive a - user's presence this will be :attr:`offline` instead. - .. attribute:: streaming - - The member is live streaming to Twitch or YouTube. - - .. versionadded:: 2.3 +.. autoclass:: Status + :members: Events ------ diff --git a/docs/api/app_commands.rst b/docs/api/app_commands.rst index a55e3670ab..7936404de2 100644 --- a/docs/api/app_commands.rst +++ b/docs/api/app_commands.rst @@ -114,85 +114,20 @@ Enumerations OptionType ~~~~~~~~~~ -.. class:: OptionType - - Represents the type of an option. - - .. versionadded:: 2.1 - - .. attribute:: sub_command - - Represents a sub command of the main command or group. - .. attribute:: sub_command_group - - Represents a sub command group of the main command. - .. attribute:: string - - Represents a string option. - .. attribute:: integer - - Represents an integer option. - .. attribute:: boolean - - Represents a boolean option. - .. attribute:: user - - Represents a user option. - .. attribute:: channel - - Represents a channel option. - .. attribute:: role - - Represents a role option. - .. attribute:: mentionable - - Represents a role + user option. - .. attribute:: number - - Represents a float option. - .. attribute:: attachment - - Represents an attachment option. - - .. versionadded:: 2.4 +.. autoclass:: OptionType + :members: ApplicationCommandType ~~~~~~~~~~~~~~~~~~~~~~ -.. class:: ApplicationCommandType - - Represents the type of an application command. - - .. versionadded:: 2.1 - - .. attribute:: chat_input - - Represents a slash command. - .. attribute:: user - - Represents a user command from the context menu. - .. attribute:: message - - Represents a message command from the context menu. +.. autoclass:: ApplicationCommandType + :members: ApplicationCommandPermissionType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: ApplicationCommandPermissionType - - Represents the type of a permission of an application command. - - .. versionadded:: 2.5 - - .. attribute:: role - - Represents a permission that affects roles. - .. attribute:: user - - Represents a permission that affects users. - .. attribute:: channel - - Represents a permission that affects channels. +.. autoclass:: ApplicationCommandPermissionType + :members: Events ------ diff --git a/docs/api/app_info.rst b/docs/api/app_info.rst index 7aa6c4148f..dc4fc8547f 100644 --- a/docs/api/app_info.rst +++ b/docs/api/app_info.rst @@ -76,81 +76,17 @@ Enumerations TeamMembershipState ~~~~~~~~~~~~~~~~~~~ -.. class:: TeamMembershipState - - Represents the membership state of a team member retrieved through :func:`Client.application_info`. - - .. versionadded:: 1.3 - - .. attribute:: invited - - Represents an invited member. - - .. attribute:: accepted - - Represents a member currently in the team. +.. autoclass:: TeamMembershipState + :members: TeamMemberRole ~~~~~~~~~~~~~~ -.. class:: TeamMemberRole - - Represents the role of a team member retrieved through :func:`Client.application_info`. - - .. versionadded:: 2.10 - - .. attribute:: admin - - Admins have the most permissions. An admin can only take destructive actions on the team or team-owned apps if they are the team owner. - - .. attribute:: developer - - Developers can access information about a team and team-owned applications, and take limited actions on them, like configuring interaction endpoints or resetting the bot token. - - .. attribute:: read_only - - Read-only members can access information about a team and team-owned applications. +.. autoclass:: TeamMemberRole + :members: ApplicationRoleConnectionMetadataType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: ApplicationRoleConnectionMetadataType - - Represents the type of a role connection metadata value. - - These offer comparison operations, which allow guilds to configure role requirements - based on the metadata value for each user and a guild-specified configured value. - - .. versionadded:: 2.8 - - .. attribute:: integer_less_than_or_equal - - The metadata value (``integer``) is less than or equal to the guild's configured value. - - .. attribute:: integer_greater_than_or_equal - - The metadata value (``integer``) is greater than or equal to the guild's configured value. - - .. attribute:: integer_equal - - The metadata value (``integer``) is equal to the guild's configured value. - - .. attribute:: integer_not_equal - - The metadata value (``integer``) is not equal to the guild's configured value. - - .. attribute:: datetime_less_than_or_equal - - The metadata value (``ISO8601 string``) is less than or equal to the guild's configured value (``integer``; days before current date). - - .. attribute:: datetime_greater_than_or_equal - - The metadata value (``ISO8601 string``) is greater than or equal to the guild's configured value (``integer``; days before current date). - - .. attribute:: boolean_equal - - The metadata value (``integer``) is equal to the guild's configured value. - - .. attribute:: boolean_not_equal - - The metadata value (``integer``) is not equal to the guild's configured value. +.. autoclass:: ApplicationRoleConnectionMetadataType + :members: diff --git a/docs/api/audit_logs.rst b/docs/api/audit_logs.rst index 29c03d52ab..27624174d6 100644 --- a/docs/api/audit_logs.rst +++ b/docs/api/audit_logs.rst @@ -1706,23 +1706,8 @@ AuditLogAction AuditLogActionCategory ~~~~~~~~~~~~~~~~~~~~~~ -.. class:: AuditLogActionCategory - - Represents the category that the :class:`AuditLogAction` belongs to. - - This can be retrieved via :attr:`AuditLogEntry.category`. - - .. attribute:: create - - The action is the creation of something. - - .. attribute:: delete - - The action is the deletion of something. - - .. attribute:: update - - The action is the update of something. +.. autoclass:: AuditLogActionCategory + :members: Events ------ diff --git a/docs/api/automod.rst b/docs/api/automod.rst index 1f1053674f..390e587cc9 100644 --- a/docs/api/automod.rst +++ b/docs/api/automod.rst @@ -83,75 +83,20 @@ Enumerations AutoModActionType ~~~~~~~~~~~~~~~~~ -.. class:: AutoModActionType - - Represents the type of action an auto moderation rule will take upon execution. - - .. versionadded:: 2.6 - - .. attribute:: block_message - - The rule will prevent matching messages from being posted. - - .. attribute:: send_alert_message - - The rule will send an alert to a specified channel. - - .. attribute:: timeout - - The rule will timeout the user that sent the message. - - .. note:: - This action type is only available for rules with trigger type - :attr:`~AutoModTriggerType.keyword` or :attr:`~AutoModTriggerType.mention_spam`, - and :attr:`~Permissions.moderate_members` permissions are required to use it. +.. autoclass:: AutoModActionType + :members: AutoModEventType ~~~~~~~~~~~~~~~~ -.. class:: AutoModEventType - - Represents the type of event/context an auto moderation rule will be checked in. - - .. versionadded:: 2.6 - - .. attribute:: message_send - - The rule will apply when a member sends or edits a message in the guild. +.. autoclass:: AutoModEventType + :members: AutoModTriggerType ~~~~~~~~~~~~~~~~~~ -.. class:: AutoModTriggerType - - Represents the type of content that can trigger an auto moderation rule. - - .. versionadded:: 2.6 - - .. versionchanged:: 2.9 - Removed obsolete ``harmful_link`` type. - - .. attribute:: keyword - - The rule will filter messages based on a custom keyword list. - - This trigger type requires additional :class:`metadata `. - - .. attribute:: spam - - The rule will filter messages suspected of being spam. - - .. attribute:: keyword_preset - - The rule will filter messages based on predefined lists containing commonly flagged words. - - This trigger type requires additional :class:`metadata `. - - .. attribute:: mention_spam - - The rule will filter messages based on the number of member/role mentions they contain. - - This trigger type requires additional :class:`metadata `. +.. autoclass:: AutoModTriggerType + :members: Events ------ diff --git a/docs/api/channels.rst b/docs/api/channels.rst index 3086583883..f42dc9a97b 100644 --- a/docs/api/channels.rst +++ b/docs/api/channels.rst @@ -206,150 +206,32 @@ Enumerations ChannelType ~~~~~~~~~~~ -.. class:: ChannelType - - Specifies the type of channel. - - .. attribute:: text - - A text channel. - .. attribute:: voice - - A voice channel. - .. attribute:: private - - A private text channel. Also called a direct message. - .. attribute:: group - - A private group text channel. - .. attribute:: category - - A category channel. - .. attribute:: news - - A guild news channel. - - .. attribute:: stage_voice - - A guild stage voice channel. - - .. versionadded:: 1.7 - - .. attribute:: news_thread - - A news thread. - - .. versionadded:: 2.0 - - .. attribute:: public_thread - - A public thread. - - .. versionadded:: 2.0 - - .. attribute:: private_thread - - A private thread. - - .. versionadded:: 2.0 - - .. attribute:: guild_directory - - A student hub channel. - - .. versionadded:: 2.1 - - .. attribute:: forum - - A channel of only threads. - - .. versionadded:: 2.5 - - .. attribute:: media - - A channel of only threads but with a focus on media, similar to forum channels. - - .. versionadded:: 2.10 +.. autoclass:: ChannelType + :members: ThreadArchiveDuration ~~~~~~~~~~~~~~~~~~~~~ -.. class:: ThreadArchiveDuration - - Represents the automatic archive duration of a thread in minutes. - - .. versionadded:: 2.3 - - .. attribute:: hour - - The thread will archive after an hour of inactivity. - - .. attribute:: day - - The thread will archive after a day of inactivity. - - .. attribute:: three_days - - The thread will archive after three days of inactivity. - - .. attribute:: week - - The thread will archive after a week of inactivity. +.. autoclass:: ThreadArchiveDuration + :members: VideoQualityMode ~~~~~~~~~~~~~~~~ -.. class:: VideoQualityMode - - Represents the camera video quality mode for voice channel participants. - - .. versionadded:: 2.0 - - .. attribute:: auto - - Represents auto camera video quality. - - .. attribute:: full - - Represents full camera video quality. +.. autoclass:: VideoQualityMode + :members: ThreadSortOrder ~~~~~~~~~~~~~~~ -.. class:: ThreadSortOrder - - Represents the sort order of threads in a :class:`ForumChannel` or :class:`MediaChannel`. - - .. versionadded:: 2.6 - - .. attribute:: latest_activity - - Sort forum threads by activity. - - .. attribute:: creation_date - - Sort forum threads by creation date/time (from newest to oldest). +.. autoclass:: ThreadSortOrder + :members: ThreadLayout ~~~~~~~~~~~~ -.. class:: ThreadLayout - - Represents the layout of threads in :class:`ForumChannel`\s. - - .. versionadded:: 2.8 - - .. attribute:: not_set - - No preferred layout has been set. - - .. attribute:: list_view - - Display forum threads in a text-focused list. - - .. attribute:: gallery_view - - Display forum threads in a media-focused collection of tiles. +.. autoclass:: ThreadLayout + :members: Events ------ diff --git a/docs/api/components.rst b/docs/api/components.rst index 628d6c6430..112529026e 100644 --- a/docs/api/components.rst +++ b/docs/api/components.rst @@ -129,137 +129,23 @@ Enumerations ComponentType ~~~~~~~~~~~~~ -.. class:: ComponentType - - Represents the type of component. - - .. versionadded:: 2.0 - - .. attribute:: action_row - - Represents the group component which holds different components in a row. - .. attribute:: button - - Represents a button component. - .. attribute:: string_select - - Represents a string select component. - - .. versionadded:: 2.7 - .. attribute:: select - - An alias of :attr:`string_select`. - - .. attribute:: text_input - - Represents a text input component. - .. attribute:: user_select - - Represents a user select component. - - .. versionadded:: 2.7 - .. attribute:: role_select - - Represents a role select component. - - .. versionadded:: 2.7 - .. attribute:: mentionable_select - - Represents a mentionable (user/member/role) select component. - - .. versionadded:: 2.7 - .. attribute:: channel_select - - Represents a channel select component. - - .. versionadded:: 2.7 +.. autoclass:: ComponentType + :members: ButtonStyle ~~~~~~~~~~~ -.. class:: ButtonStyle - - Represents the style of the button component. - - .. versionadded:: 2.0 - - .. attribute:: primary - - Represents a blurple button for the primary action. - .. attribute:: secondary - - Represents a grey button for the secondary action. - .. attribute:: success - - Represents a green button for a successful action. - .. attribute:: danger - - Represents a red button for a dangerous action. - .. attribute:: link - - Represents a link button. - - .. attribute:: blurple - - An alias for :attr:`primary`. - .. attribute:: grey - - An alias for :attr:`secondary`. - .. attribute:: gray - - An alias for :attr:`secondary`. - .. attribute:: green - - An alias for :attr:`success`. - .. attribute:: red - - An alias for :attr:`danger`. - .. attribute:: url - - An alias for :attr:`link`. +.. autoclass:: ButtonStyle + :members: TextInputStyle ~~~~~~~~~~~~~~ -.. class:: TextInputStyle - - Represents a style of the text input component. - - .. versionadded:: 2.4 - - .. attribute:: short - - Represents a single-line text input component. - .. attribute:: paragraph - - Represents a multi-line text input component. - .. attribute:: single_line - - An alias for :attr:`short`. - .. attribute:: multi_line - - An alias for :attr:`paragraph`. - .. attribute:: long - - An alias for :attr:`paragraph`. +.. autoclass:: TextInputStyle + :members: SelectDefaultValueType ~~~~~~~~~~~~~~~~~~~~~~ -.. class:: SelectDefaultValueType - - Represents the type of a :class:`SelectDefaultValue`. - - .. versionadded:: 2.10 - - .. attribute:: user - - Represents a user/member. - - .. attribute:: role - - Represents a role. - - .. attribute:: channel - - Represents a channel. +.. autoclass:: SelectDefaultValueType + :members: diff --git a/docs/api/entitlements.rst b/docs/api/entitlements.rst index e8b0c4aab4..5496c713e2 100644 --- a/docs/api/entitlements.rst +++ b/docs/api/entitlements.rst @@ -25,43 +25,8 @@ Enumerations EntitlementType ~~~~~~~~~~~~~~~ -.. class:: EntitlementType - - Represents the type of an entitlement. - - .. versionadded:: 2.10 - - .. attribute:: purchase - - Represents an entitlement purchased by a user. - - .. attribute:: premium_subscription - - Represents an entitlement for a Discord Nitro subscription. - - .. attribute:: developer_gift - - Represents an entitlement gifted by the application developer. - - .. attribute:: test_mode_purchase - - Represents an entitlement purchased by a developer in application test mode. - - .. attribute:: free_purchase - - Represents an entitlement granted when the SKU was free. - - .. attribute:: user_gift - - Represents an entitlement gifted by another user. - - .. attribute:: premium_purchase - - Represents an entitlement claimed by a user for free as a Discord Nitro subscriber. - - .. attribute:: application_subscription - - Represents an entitlement for an application subscription. +.. autoclass:: EntitlementType + :members: Events ------ diff --git a/docs/api/guild_scheduled_events.rst b/docs/api/guild_scheduled_events.rst index 8bc8c6985f..91ecb89810 100644 --- a/docs/api/guild_scheduled_events.rst +++ b/docs/api/guild_scheduled_events.rst @@ -43,67 +43,20 @@ Enumerations GuildScheduledEventEntityType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: GuildScheduledEventEntityType - - Represents the type of a guild scheduled event entity. - - .. versionadded:: 2.3 - - .. attribute:: stage_instance - - The guild scheduled event will take place in a stage channel. - - .. attribute:: voice - - The guild scheduled event will take place in a voice channel. - - .. attribute:: external - - The guild scheduled event will take place in a custom location. +.. autoclass:: GuildScheduledEventEntityType + :members: GuildScheduledEventStatus ~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: GuildScheduledEventStatus - - Represents the status of a guild scheduled event. - - .. versionadded:: 2.3 - - .. attribute:: scheduled - - Represents a scheduled event. - - .. attribute:: active - - Represents an active event. - - .. attribute:: completed - - Represents a completed event. - - .. attribute:: canceled - - Represents a canceled event. - - .. attribute:: cancelled - - An alias for :attr:`canceled`. - - .. versionadded:: 2.6 +.. autoclass:: GuildScheduledEventStatus + :members: GuildScheduledEventPrivacyLevel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: GuildScheduledEventPrivacyLevel - - Represents the privacy level of a guild scheduled event. - - .. versionadded:: 2.3 - - .. attribute:: guild_only - - The guild scheduled event is only for a specific guild. +.. autoclass:: GuildScheduledEventPrivacyLevel + :members: Events ------ diff --git a/docs/api/guilds.rst b/docs/api/guilds.rst index 614ad3f355..dd561484de 100644 --- a/docs/api/guilds.rst +++ b/docs/api/guilds.rst @@ -146,192 +146,32 @@ Enumerations VerificationLevel ~~~~~~~~~~~~~~~~~ -.. class:: VerificationLevel - - Specifies a :class:`Guild`\'s verification level, which is the criteria in - which a member must meet before being able to send messages to the guild. - - .. collapse:: operations - - .. versionadded:: 2.0 - - .. describe:: x == y - - Checks if two verification levels are equal. - .. describe:: x != y - - Checks if two verification levels are not equal. - .. describe:: x > y - - Checks if a verification level is higher than another. - .. describe:: x < y - - Checks if a verification level is lower than another. - .. describe:: x >= y - - Checks if a verification level is higher or equal to another. - .. describe:: x <= y - - Checks if a verification level is lower or equal to another. - - .. attribute:: none - - No criteria set. - .. attribute:: low - - Member must have a verified email on their Discord account. - .. attribute:: medium - - Member must have a verified email and be registered on Discord for more - than five minutes. - .. attribute:: high - - Member must have a verified email, be registered on Discord for more - than five minutes, and be a member of the guild itself for more than - ten minutes. - .. attribute:: highest - - Member must have a verified phone on their Discord account. +.. autoclass:: VerificationLevel + :members: NotificationLevel ~~~~~~~~~~~~~~~~~ -.. class:: NotificationLevel - - Specifies whether a :class:`Guild` has notifications on for all messages or mentions only by default. - - .. collapse:: operations - - .. describe:: x == y - - Checks if two notification levels are equal. - .. describe:: x != y - - Checks if two notification levels are not equal. - .. describe:: x > y - - Checks if a notification level is higher than another. - .. describe:: x < y - - Checks if a notification level is lower than another. - .. describe:: x >= y - - Checks if a notification level is higher or equal to another. - .. describe:: x <= y - - Checks if a notification level is lower or equal to another. - - .. attribute:: all_messages - - Members receive notifications for every message regardless of them being mentioned. - .. attribute:: only_mentions - - Members receive notifications for messages they are mentioned in. +.. autoclass:: NotificationLevel + :members: ContentFilter ~~~~~~~~~~~~~ -.. class:: ContentFilter - - Specifies a :class:`Guild`\'s explicit content filter, which is the machine - learning algorithms that Discord uses to detect if an image contains - NSFW content. - - .. collapse:: operations - - .. describe:: x == y - - Checks if two content filter levels are equal. - .. describe:: x != y - - Checks if two content filter levels are not equal. - .. describe:: x > y - - Checks if a content filter level is higher than another. - .. describe:: x < y - - Checks if a content filter level is lower than another. - .. describe:: x >= y - - Checks if a content filter level is higher or equal to another. - .. describe:: x <= y - - Checks if a content filter level is lower or equal to another. - - .. attribute:: disabled - - The guild does not have the content filter enabled. - .. attribute:: no_role - - The guild has the content filter enabled for members without a role. - .. attribute:: all_members - - The guild has the content filter enabled for every member. +.. autoclass:: ContentFilter + :members: NSFWLevel ~~~~~~~~~ -.. class:: NSFWLevel - - Represents the NSFW level of a guild. - - .. versionadded:: 2.0 - - .. collapse:: operations - - .. describe:: x == y - - Checks if two NSFW levels are equal. - .. describe:: x != y - - Checks if two NSFW levels are not equal. - .. describe:: x > y - - Checks if a NSFW level is higher than another. - .. describe:: x < y - - Checks if a NSFW level is lower than another. - .. describe:: x >= y - - Checks if a NSFW level is higher or equal to another. - .. describe:: x <= y - - Checks if a NSFW level is lower or equal to another. - - .. attribute:: default - - The guild has not been categorised yet. - - .. attribute:: explicit - - The guild contains NSFW content. - - .. attribute:: safe - - The guild does not contain any NSFW content. - - .. attribute:: age_restricted - - The guild may contain NSFW content. - +.. autoclass:: NSFWLevel + :members: OnboardingPromptType ~~~~~~~~~~~~~~~~~~~~ -.. class:: OnboardingPromptType - - Represents the type of onboarding prompt. - - .. versionadded:: 2.9 - - .. attribute:: multiple_choice - - The prompt is a multiple choice prompt. - - .. attribute:: dropdown - - The prompt is a dropdown prompt. - +.. autoclass:: OnboardingPromptType + :members: Events ------ diff --git a/docs/api/integrations.rst b/docs/api/integrations.rst index afbcc67728..b0e28b15cb 100644 --- a/docs/api/integrations.rst +++ b/docs/api/integrations.rst @@ -68,23 +68,8 @@ Enumerations ExpireBehaviour ~~~~~~~~~~~~~~~ -.. class:: ExpireBehaviour - - Represents the behaviour the :class:`Integration` should perform - when a user's subscription has finished. - - There is an alias for this called ``ExpireBehavior``. - - .. versionadded:: 1.4 - - .. attribute:: remove_role - - This will remove the :attr:`StreamIntegration.role` from the user - when their subscription is finished. - - .. attribute:: kick - - This will kick the user when their subscription is finished. +.. autoclass:: ExpireBehaviour + :members: Events ------ diff --git a/docs/api/interactions.rst b/docs/api/interactions.rst index 1ff84165bc..7ae3ca9547 100644 --- a/docs/api/interactions.rst +++ b/docs/api/interactions.rst @@ -178,84 +178,14 @@ Enumerations InteractionType ~~~~~~~~~~~~~~~ -.. class:: InteractionType - - Specifies the type of :class:`Interaction`. - - .. versionadded:: 2.0 - - .. attribute:: ping - - Represents Discord pinging to see if the interaction response server is alive. - .. attribute:: application_command - - Represents an application command interaction. - .. attribute:: component - - Represents a component based interaction, i.e. using the Discord Bot UI Kit. - .. attribute:: application_command_autocomplete - - Represents an application command autocomplete interaction. - .. attribute:: modal_submit - - Represents a modal submit interaction. +.. autoclass:: InteractionType + :members: InteractionResponseType ~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: InteractionResponseType - - Specifies the response type for the interaction. - - .. versionadded:: 2.0 - - .. attribute:: pong - - Pongs the interaction when given a ping. - - See also :meth:`InteractionResponse.pong` - .. attribute:: channel_message - - Responds to the interaction with a message. - - See also :meth:`InteractionResponse.send_message` - .. attribute:: deferred_channel_message - - Responds to the interaction with a message at a later time. - - See also :meth:`InteractionResponse.defer` - .. attribute:: deferred_message_update - - Acknowledges the component interaction with a promise that - the message will update later (though there is no need to actually update the message). - - See also :meth:`InteractionResponse.defer` - .. attribute:: message_update - - Responds to the interaction by editing the message. - - See also :meth:`InteractionResponse.edit_message` - .. attribute:: application_command_autocomplete_result - - Responds to the autocomplete interaction with suggested choices. - - See also :meth:`InteractionResponse.autocomplete` - .. attribute:: modal - - Responds to the interaction by displaying a modal. - - See also :meth:`InteractionResponse.send_modal` - - .. versionadded:: 2.4 - - .. attribute:: premium_required - - Responds to the interaction with a message containing an upgrade button. - Only available for applications with monetization enabled. - - See also :meth:`InteractionResponse.require_premium` - - .. versionadded:: 2.10 +.. autoclass:: InteractionResponseType + :members: Events ------ diff --git a/docs/api/invites.rst b/docs/api/invites.rst index aa58074c2f..982bbe490d 100644 --- a/docs/api/invites.rst +++ b/docs/api/invites.rst @@ -40,44 +40,14 @@ Enumerations InviteType ~~~~~~~~~~ -.. class:: InviteType - - Represents the type of an invite. - - .. versionadded:: 2.10 - - .. attribute:: guild - - Represents an invite to a guild. - - .. attribute:: group_dm - - Represents an invite to a group channel. - - .. attribute:: friend - - Represents a friend invite. +.. autoclass:: InviteType + :members: InviteTarget ~~~~~~~~~~~~ -.. class:: InviteTarget - - Represents the invite type for voice channel invites. - - .. versionadded:: 2.0 - - .. attribute:: unknown - - The invite doesn't target anyone or anything. - - .. attribute:: stream - - A stream invite that targets a user. - - .. attribute:: embedded_application - - A stream invite that targets an embedded application. +.. autoclass:: InviteTarget + :members: Events ------ diff --git a/docs/api/localization.rst b/docs/api/localization.rst index d9ab008d42..b99654c10d 100644 --- a/docs/api/localization.rst +++ b/docs/api/localization.rst @@ -43,140 +43,5 @@ Enumerations Locale ~~~~~~ -.. class:: Locale - - Represents supported locales by Discord. - - .. versionadded:: 2.5 - - .. attribute:: bg - - The ``bg`` (Bulgarian) locale. - - .. attribute:: cs - - The ``cs`` (Czech) locale. - - .. attribute:: da - - The ``da`` (Danish) locale. - - .. attribute:: de - - The ``de`` (German) locale. - - .. attribute:: el - - The ``el`` (Greek) locale. - - .. attribute:: en_GB - - The ``en-GB`` (English, UK) locale. - - .. attribute:: en_US - - The ``en-US`` (English, US) locale. - - .. attribute:: es_ES - - The ``es-ES`` (Spanish) locale. - - .. attribute:: es_LATAM - - The ``es-419`` (Spanish, LATAM) locale. - - .. versionadded:: 2.10 - - .. attribute:: fi - - The ``fi`` (Finnish) locale. - - .. attribute:: fr - - The ``fr`` (French) locale. - - .. attribute:: hi - - The ``hi`` (Hindi) locale. - - .. attribute:: hr - - The ``hr`` (Croatian) locale. - - .. attribute:: hu - - The ``hu`` (Hungarian) locale. - - .. attribute:: id - - The ``id`` (Indonesian) locale. - - .. versionadded:: 2.8 - - .. attribute:: it - - The ``it`` (Italian) locale. - - .. attribute:: ja - - The ``ja`` (Japanese) locale. - - .. attribute:: ko - - The ``ko`` (Korean) locale. - - .. attribute:: lt - - The ``lt`` (Lithuanian) locale. - - .. attribute:: nl - - The ``nl`` (Dutch) locale. - - .. attribute:: no - - The ``no`` (Norwegian) locale. - - .. attribute:: pl - - The ``pl`` (Polish) locale. - - .. attribute:: pt_BR - - The ``pt-BR`` (Portuguese) locale. - - .. attribute:: ro - - The ``ro`` (Romanian) locale. - - .. attribute:: ru - - The ``ru`` (Russian) locale. - - .. attribute:: sv_SE - - The ``sv-SE`` (Swedish) locale. - - .. attribute:: th - - The ``th`` (Thai) locale. - - .. attribute:: tr - - The ``tr`` (Turkish) locale. - - .. attribute:: uk - - The ``uk`` (Ukrainian) locale. - - .. attribute:: vi - - The ``vi`` (Vietnamese) locale. - - .. attribute:: zh_CN - - The ``zh-CN`` (Chinese, China) locale. - - .. attribute:: zh_TW - - The ``zh-TW`` (Chinese, Taiwan) locale. +.. autoclass:: Locale + :members: diff --git a/docs/api/messages.rst b/docs/api/messages.rst index 6c02bc0208..82d46db89a 100644 --- a/docs/api/messages.rst +++ b/docs/api/messages.rst @@ -215,204 +215,14 @@ Enumerations MessageType ~~~~~~~~~~~ -.. class:: MessageType - - Specifies the type of :class:`Message`. This is used to denote if a message - is to be interpreted as a system message or a regular message. - - .. collapse:: operations - - .. describe:: x == y - - Checks if two messages are equal. - .. describe:: x != y - - Checks if two messages are not equal. - - .. attribute:: default - - The default message type. This is the same as regular messages. - .. attribute:: recipient_add - - The system message when a user is added to a group private - message or a thread. - .. attribute:: recipient_remove - - The system message when a user is removed from a group private - message or a thread. - .. attribute:: call - - The system message denoting call state, e.g. missed call, started call, - etc. - .. attribute:: channel_name_change - - The system message denoting that a channel's name has been changed. - .. attribute:: channel_icon_change - - The system message denoting that a channel's icon has been changed. - .. attribute:: pins_add - - The system message denoting that a pinned message has been added to a channel. - .. attribute:: new_member - - The system message denoting that a new member has joined a Guild. - - .. attribute:: premium_guild_subscription - - The system message denoting that a member has "nitro boosted" a guild. - .. attribute:: premium_guild_tier_1 - - The system message denoting that a member has "nitro boosted" a guild - and it achieved level 1. - .. attribute:: premium_guild_tier_2 - - The system message denoting that a member has "nitro boosted" a guild - and it achieved level 2. - .. attribute:: premium_guild_tier_3 - - The system message denoting that a member has "nitro boosted" a guild - and it achieved level 3. - .. attribute:: channel_follow_add - - The system message denoting that an announcement channel has been followed. - - .. versionadded:: 1.3 - .. attribute:: guild_stream - - The system message denoting that a member is streaming in the guild. - - .. versionadded:: 1.7 - .. attribute:: guild_discovery_disqualified - - The system message denoting that the guild is no longer eligible for Server - Discovery. - - .. versionadded:: 1.7 - .. attribute:: guild_discovery_requalified - - The system message denoting that the guild has become eligible again for Server - Discovery. - - .. versionadded:: 1.7 - .. attribute:: guild_discovery_grace_period_initial_warning - - The system message denoting that the guild has failed to meet the Server - Discovery requirements for one week. - - .. versionadded:: 1.7 - .. attribute:: guild_discovery_grace_period_final_warning - - The system message denoting that the guild has failed to meet the Server - Discovery requirements for 3 weeks in a row. - - .. versionadded:: 1.7 - .. attribute:: thread_created - - The system message denoting that a thread has been created. This is only - sent if the thread has been created from an older message. The period of time - required for a message to be considered old cannot be relied upon and is up to - Discord. - - .. versionadded:: 2.0 - .. attribute:: reply - - The system message denoting that the author is replying to a message. - - .. versionadded:: 2.0 - .. attribute:: application_command - - The system message denoting that an application (or "slash") command was executed. - - .. versionadded:: 2.0 - .. attribute:: guild_invite_reminder - - The system message sent as a reminder to invite people to the guild. - - .. versionadded:: 2.0 - .. attribute:: thread_starter_message - - The system message denoting the message in the thread that is the one that started the - thread's conversation topic. - - .. versionadded:: 2.0 - .. attribute:: context_menu_command - - The system message denoting that a context menu command was executed. - - .. versionadded:: 2.3 - .. attribute:: auto_moderation_action - - The system message denoting that an auto moderation action was executed. - - .. versionadded:: 2.5 - .. attribute:: role_subscription_purchase - - The system message denoting that a role subscription was purchased. - - .. versionadded:: 2.9 - .. attribute:: interaction_premium_upsell - - The system message for an application premium subscription upsell. - - .. versionadded:: 2.8 - .. attribute:: stage_start - - The system message denoting the stage has been started. - - .. versionadded:: 2.9 - .. attribute:: stage_end - - The system message denoting the stage has ended. - - .. versionadded:: 2.9 - .. attribute:: stage_speaker - - The system message denoting a user has become a speaker. - - .. versionadded:: 2.9 - .. attribute:: stage_topic - - The system message denoting the stage topic has been changed. - - .. versionadded:: 2.9 - .. attribute:: guild_application_premium_subscription - - The system message denoting that a guild member has subscribed to an application. - - .. versionadded:: 2.8 - .. attribute:: guild_incident_alert_mode_enabled - - The system message denoting that an admin enabled security actions. - - .. versionadded:: 2.10 - .. attribute:: guild_incident_alert_mode_disabled - - The system message denoting that an admin disabled security actions. - - .. versionadded:: 2.10 - .. attribute:: guild_incident_report_raid - - The system message denoting that an admin reported a raid. - - .. versionadded:: 2.10 - .. attribute:: guild_incident_report_false_alarm - - The system message denoting that a raid report was a false alarm. - - .. versionadded:: 2.10 +.. autoclass:: MessageType + :members: PollLayoutType ~~~~~~~~~~~~~~ -.. class:: PollLayoutType - - Specifies the layout of a :class:`Poll`. - - .. versionadded:: 2.10 - - .. attribute:: default - - The default poll layout type. +.. autoclass:: PollLayoutType + :members: Events ------ diff --git a/docs/api/skus.rst b/docs/api/skus.rst index 05c457f947..0c1c9d0275 100644 --- a/docs/api/skus.rst +++ b/docs/api/skus.rst @@ -39,24 +39,5 @@ Enumerations SKUType ~~~~~~~ -.. class:: SKUType - - Represents the type of an SKU. - - .. versionadded:: 2.10 - - .. attribute:: durable - - Represents a durable one-time purchase. - - .. attribute:: consumable - - Represents a consumable one-time purchase. - - .. attribute:: subscription - - Represents a recurring subscription. - - .. attribute:: subscription_group - - Represents a system-generated group for each :attr:`subscription` SKU. +.. autoclass:: SKUType + :members: diff --git a/docs/api/stage_instances.rst b/docs/api/stage_instances.rst index f3c297f32e..b0ce11e5d5 100644 --- a/docs/api/stage_instances.rst +++ b/docs/api/stage_instances.rst @@ -25,27 +25,8 @@ Enumerations StagePrivacyLevel ~~~~~~~~~~~~~~~~~ -.. class:: StagePrivacyLevel - - Represents a stage instance's privacy level. - - .. versionadded:: 2.0 - - .. attribute:: public - - The stage instance can be joined by external users. - - .. deprecated:: 2.5 - - Public stages are no longer supported by discord. - - .. attribute:: closed - - The stage instance can only be joined by members of the guild. - - .. attribute:: guild_only - - Alias for :attr:`.closed` +.. autoclass:: StagePrivacyLevel + :members: Events ------ diff --git a/docs/api/stickers.rst b/docs/api/stickers.rst index 8719958753..babad31ff3 100644 --- a/docs/api/stickers.rst +++ b/docs/api/stickers.rst @@ -60,46 +60,14 @@ Enumerations StickerType ~~~~~~~~~~~ -.. class:: StickerType - - Represents the type of sticker. - - .. versionadded:: 2.0 - - .. attribute:: standard - - Represents a standard sticker that all users can use. - - .. attribute:: guild - - Represents a custom sticker created in a guild. +.. autoclass:: StickerType + :members: StickerFormatType ~~~~~~~~~~~~~~~~~ -.. class:: StickerFormatType - - Represents the type of sticker images. - - .. versionadded:: 1.6 - - .. attribute:: png - - Represents a sticker with a png image. - - .. attribute:: apng - - Represents a sticker with an apng image. - - .. attribute:: lottie - - Represents a sticker with a lottie image. - - .. attribute:: gif - - Represents a sticker with a gif image. - - .. versionadded:: 2.8 +.. autoclass:: StickerFormatType + :members: Events ------ diff --git a/docs/api/users.rst b/docs/api/users.rst index 36bfdc1faa..0797ef47e2 100644 --- a/docs/api/users.rst +++ b/docs/api/users.rst @@ -51,113 +51,14 @@ Enumerations UserFlags ~~~~~~~~~ -.. class:: UserFlags - - Represents Discord User flags. - - .. attribute:: staff - - The user is a Discord Employee. - .. attribute:: partner - - The user is a Discord Partner. - .. attribute:: hypesquad - - The user is a HypeSquad Events member. - .. attribute:: bug_hunter - - The user is a Bug Hunter. - .. attribute:: mfa_sms - - The user has SMS recovery for Multi Factor Authentication enabled. - .. attribute:: premium_promo_dismissed - - The user has dismissed the Discord Nitro promotion. - .. attribute:: hypesquad_bravery - - The user is a HypeSquad Bravery member. - .. attribute:: hypesquad_brilliance - - The user is a HypeSquad Brilliance member. - .. attribute:: hypesquad_balance - - The user is a HypeSquad Balance member. - .. attribute:: early_supporter - - The user is an Early Supporter. - .. attribute:: team_user - - The user is a Team User. - .. attribute:: system - - The user is a system user (i.e. represents Discord officially). - .. attribute:: has_unread_urgent_messages - - The user has an unread system message. - .. attribute:: bug_hunter_level_2 - - The user is a Bug Hunter Level 2. - .. attribute:: verified_bot - - The user is a Verified Bot. - .. attribute:: verified_bot_developer - - The user is an Early Verified Bot Developer. - .. attribute:: discord_certified_moderator - - The user is a Discord Certified Moderator. - .. attribute:: http_interactions_bot - - The user is a bot that only uses HTTP interactions. - - .. versionadded:: 2.3 - .. attribute:: spammer - - The user is marked as a spammer. - - .. versionadded:: 2.3 - .. attribute:: active_developer - - The user is an Active Developer. - - .. versionadded:: 2.8 +.. autoclass:: UserFlags + :members: DefaultAvatar ~~~~~~~~~~~~~ -.. class:: DefaultAvatar - - Represents the default avatar of a Discord :class:`User`. - - .. attribute:: blurple - - Represents the default avatar with the color blurple. - See also :attr:`Colour.blurple` - .. attribute:: grey - - Represents the default avatar with the color grey. - See also :attr:`Colour.greyple` - .. attribute:: gray - - An alias for :attr:`grey`. - .. attribute:: green - - Represents the default avatar with the color green. - See also :attr:`Colour.green` - .. attribute:: orange - - Represents the default avatar with the color orange. - See also :attr:`Colour.orange` - .. attribute:: red - - Represents the default avatar with the color red. - See also :attr:`Colour.red` - .. attribute:: fuchsia - - Represents the default avatar with the color fuchsia. - See also :attr:`Colour.fuchsia` - - .. versionadded:: 2.9 +.. autoclass:: DefaultAvatar + :members: Events ------ diff --git a/docs/api/voice.rst b/docs/api/voice.rst index e56d1a2eb9..a71eec38c5 100644 --- a/docs/api/voice.rst +++ b/docs/api/voice.rst @@ -124,78 +124,14 @@ Enumerations VoiceChannelEffectAnimationType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. class:: VoiceChannelEffectAnimationType - - The type of an emoji reaction effect animation in a voice channel. - - .. versionadded:: 2.10 - - .. attribute:: premium - - A fun animation, sent by a Nitro subscriber. - - .. attribute:: basic - - A standard animation. +.. autoclass:: VoiceChannelEffectAnimationType + :members: PartyType ~~~~~~~~~ -.. class:: PartyType - - Represents the type of a voice channel activity/application. - - .. attribute:: poker - - The "Poker Night" activity. - .. attribute:: betrayal - - The "Betrayal.io" activity. - .. attribute:: fishing - - The "Fishington.io" activity. - .. attribute:: chess - - The "Chess In The Park" activity. - .. attribute:: letter_tile - - The "Letter Tile" activity. - .. attribute:: word_snack - - The "Word Snacks" activity. - .. attribute:: doodle_crew - - The "Doodle Crew" activity. - .. attribute:: checkers - - The "Checkers In The Park" activity. - - .. versionadded:: 2.3 - .. attribute:: spellcast - - The "SpellCast" activity. - - .. versionadded:: 2.3 - .. attribute:: watch_together - - The "Watch Together" activity, a Youtube application. - - .. versionadded:: 2.3 - .. attribute:: sketch_heads - - The "Sketch Heads" activity. - - .. versionadded:: 2.4 - .. attribute:: ocho - - The "Ocho" activity. - - .. versionadded:: 2.4 - .. attribute:: gartic_phone - - The "Gartic Phone" activity. - - .. versionadded:: 2.9 +.. autoclass:: PartyType + :members: Events ------ diff --git a/docs/api/webhooks.rst b/docs/api/webhooks.rst index eeecf7fce9..78e30f2a10 100644 --- a/docs/api/webhooks.rst +++ b/docs/api/webhooks.rst @@ -67,25 +67,8 @@ Enumerations WebhookType ~~~~~~~~~~~ -.. class:: WebhookType - - Represents the type of webhook that can be received. - - .. versionadded:: 1.3 - - .. attribute:: incoming - - Represents a webhook that can post messages to channels with a token. - - .. attribute:: channel_follower - - Represents a webhook that is internally managed by Discord, used for following channels. - - .. attribute:: application - - Represents a webhook that is used for interactions or applications. - - .. versionadded:: 2.0 +.. autoclass:: WebhookType + :members: Events ------ diff --git a/docs/api/widgets.rst b/docs/api/widgets.rst index 386a91f37e..0f00409277 100644 --- a/docs/api/widgets.rst +++ b/docs/api/widgets.rst @@ -52,30 +52,5 @@ Enumerations WidgetStyle ~~~~~~~~~~~ -.. class:: WidgetStyle - - Represents the supported widget image styles. - - .. versionadded:: 2.5 - - .. attribute:: shield - - A shield style image with a Discord icon and the online member count. - - .. attribute:: banner1 - - A large image with guild icon, name and online member count and a footer. - - .. attribute:: banner2 - - A small image with guild icon, name and online member count. - - .. attribute:: banner3 - - A large image with guild icon, name and online member count and a footer, - with a "Chat Now" label on the right. - - .. attribute:: banner4 - - A large image with a large Discord logo, guild icon, name and online member count, - with a "Join My Server" label at the bottom. +.. autoclass:: WidgetStyle + :members: From 9b4124105cdceab28946cb958507a10956182927 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 18 Nov 2024 21:43:55 +0100 Subject: [PATCH 02/10] fix: don't show `value` parameter on enum classes --- docs/api/activities.rst | 4 ++-- docs/api/app_commands.rst | 6 +++--- docs/api/app_info.rst | 6 +++--- docs/api/audit_logs.rst | 2 +- docs/api/automod.rst | 6 +++--- docs/api/channels.rst | 10 +++++----- docs/api/components.rst | 8 ++++---- docs/api/entitlements.rst | 2 +- docs/api/events.rst | 2 +- docs/api/guild_scheduled_events.rst | 6 +++--- docs/api/guilds.rst | 10 +++++----- docs/api/integrations.rst | 2 +- docs/api/interactions.rst | 4 ++-- docs/api/invites.rst | 4 ++-- docs/api/localization.rst | 2 +- docs/api/messages.rst | 4 ++-- docs/api/skus.rst | 2 +- docs/api/stage_instances.rst | 2 +- docs/api/stickers.rst | 4 ++-- docs/api/users.rst | 4 ++-- docs/api/voice.rst | 4 ++-- docs/api/webhooks.rst | 2 +- docs/api/widgets.rst | 2 +- 23 files changed, 49 insertions(+), 49 deletions(-) diff --git a/docs/api/activities.rst b/docs/api/activities.rst index d1770c9ff4..6dd6b34bf2 100644 --- a/docs/api/activities.rst +++ b/docs/api/activities.rst @@ -74,13 +74,13 @@ Enumerations ActivityType ~~~~~~~~~~~~ -.. autoclass:: ActivityType +.. autoclass:: ActivityType() :members: Status ~~~~~~ -.. autoclass:: Status +.. autoclass:: Status() :members: Events diff --git a/docs/api/app_commands.rst b/docs/api/app_commands.rst index 7936404de2..2146d872e8 100644 --- a/docs/api/app_commands.rst +++ b/docs/api/app_commands.rst @@ -114,19 +114,19 @@ Enumerations OptionType ~~~~~~~~~~ -.. autoclass:: OptionType +.. autoclass:: OptionType() :members: ApplicationCommandType ~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: ApplicationCommandType +.. autoclass:: ApplicationCommandType() :members: ApplicationCommandPermissionType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: ApplicationCommandPermissionType +.. autoclass:: ApplicationCommandPermissionType() :members: Events diff --git a/docs/api/app_info.rst b/docs/api/app_info.rst index dc4fc8547f..ffdaa0a386 100644 --- a/docs/api/app_info.rst +++ b/docs/api/app_info.rst @@ -76,17 +76,17 @@ Enumerations TeamMembershipState ~~~~~~~~~~~~~~~~~~~ -.. autoclass:: TeamMembershipState +.. autoclass:: TeamMembershipState() :members: TeamMemberRole ~~~~~~~~~~~~~~ -.. autoclass:: TeamMemberRole +.. autoclass:: TeamMemberRole() :members: ApplicationRoleConnectionMetadataType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: ApplicationRoleConnectionMetadataType +.. autoclass:: ApplicationRoleConnectionMetadataType() :members: diff --git a/docs/api/audit_logs.rst b/docs/api/audit_logs.rst index 27624174d6..c4aa06e93f 100644 --- a/docs/api/audit_logs.rst +++ b/docs/api/audit_logs.rst @@ -1706,7 +1706,7 @@ AuditLogAction AuditLogActionCategory ~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: AuditLogActionCategory +.. autoclass:: AuditLogActionCategory() :members: Events diff --git a/docs/api/automod.rst b/docs/api/automod.rst index 390e587cc9..7e21b873b8 100644 --- a/docs/api/automod.rst +++ b/docs/api/automod.rst @@ -83,19 +83,19 @@ Enumerations AutoModActionType ~~~~~~~~~~~~~~~~~ -.. autoclass:: AutoModActionType +.. autoclass:: AutoModActionType() :members: AutoModEventType ~~~~~~~~~~~~~~~~ -.. autoclass:: AutoModEventType +.. autoclass:: AutoModEventType() :members: AutoModTriggerType ~~~~~~~~~~~~~~~~~~ -.. autoclass:: AutoModTriggerType +.. autoclass:: AutoModTriggerType() :members: Events diff --git a/docs/api/channels.rst b/docs/api/channels.rst index f42dc9a97b..8e8729ccfb 100644 --- a/docs/api/channels.rst +++ b/docs/api/channels.rst @@ -206,31 +206,31 @@ Enumerations ChannelType ~~~~~~~~~~~ -.. autoclass:: ChannelType +.. autoclass:: ChannelType() :members: ThreadArchiveDuration ~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: ThreadArchiveDuration +.. autoclass:: ThreadArchiveDuration() :members: VideoQualityMode ~~~~~~~~~~~~~~~~ -.. autoclass:: VideoQualityMode +.. autoclass:: VideoQualityMode() :members: ThreadSortOrder ~~~~~~~~~~~~~~~ -.. autoclass:: ThreadSortOrder +.. autoclass:: ThreadSortOrder() :members: ThreadLayout ~~~~~~~~~~~~ -.. autoclass:: ThreadLayout +.. autoclass:: ThreadLayout() :members: Events diff --git a/docs/api/components.rst b/docs/api/components.rst index 112529026e..14f1153679 100644 --- a/docs/api/components.rst +++ b/docs/api/components.rst @@ -129,23 +129,23 @@ Enumerations ComponentType ~~~~~~~~~~~~~ -.. autoclass:: ComponentType +.. autoclass:: ComponentType() :members: ButtonStyle ~~~~~~~~~~~ -.. autoclass:: ButtonStyle +.. autoclass:: ButtonStyle() :members: TextInputStyle ~~~~~~~~~~~~~~ -.. autoclass:: TextInputStyle +.. autoclass:: TextInputStyle() :members: SelectDefaultValueType ~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: SelectDefaultValueType +.. autoclass:: SelectDefaultValueType() :members: diff --git a/docs/api/entitlements.rst b/docs/api/entitlements.rst index 5496c713e2..6a1daeb9c0 100644 --- a/docs/api/entitlements.rst +++ b/docs/api/entitlements.rst @@ -25,7 +25,7 @@ Enumerations EntitlementType ~~~~~~~~~~~~~~~ -.. autoclass:: EntitlementType +.. autoclass:: EntitlementType() :members: Events diff --git a/docs/api/events.rst b/docs/api/events.rst index c5683e456c..8f4db3fb43 100644 --- a/docs/api/events.rst +++ b/docs/api/events.rst @@ -1589,5 +1589,5 @@ Enumerations Event ~~~~~ -.. autoclass:: Event +.. autoclass:: Event() :members: diff --git a/docs/api/guild_scheduled_events.rst b/docs/api/guild_scheduled_events.rst index 91ecb89810..f58625ec19 100644 --- a/docs/api/guild_scheduled_events.rst +++ b/docs/api/guild_scheduled_events.rst @@ -43,19 +43,19 @@ Enumerations GuildScheduledEventEntityType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: GuildScheduledEventEntityType +.. autoclass:: GuildScheduledEventEntityType() :members: GuildScheduledEventStatus ~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: GuildScheduledEventStatus +.. autoclass:: GuildScheduledEventStatus() :members: GuildScheduledEventPrivacyLevel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: GuildScheduledEventPrivacyLevel +.. autoclass:: GuildScheduledEventPrivacyLevel() :members: Events diff --git a/docs/api/guilds.rst b/docs/api/guilds.rst index dd561484de..25aaaa6f6d 100644 --- a/docs/api/guilds.rst +++ b/docs/api/guilds.rst @@ -146,31 +146,31 @@ Enumerations VerificationLevel ~~~~~~~~~~~~~~~~~ -.. autoclass:: VerificationLevel +.. autoclass:: VerificationLevel() :members: NotificationLevel ~~~~~~~~~~~~~~~~~ -.. autoclass:: NotificationLevel +.. autoclass:: NotificationLevel() :members: ContentFilter ~~~~~~~~~~~~~ -.. autoclass:: ContentFilter +.. autoclass:: ContentFilter() :members: NSFWLevel ~~~~~~~~~ -.. autoclass:: NSFWLevel +.. autoclass:: NSFWLevel() :members: OnboardingPromptType ~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: OnboardingPromptType +.. autoclass:: OnboardingPromptType() :members: Events diff --git a/docs/api/integrations.rst b/docs/api/integrations.rst index b0e28b15cb..4a5b9af43b 100644 --- a/docs/api/integrations.rst +++ b/docs/api/integrations.rst @@ -68,7 +68,7 @@ Enumerations ExpireBehaviour ~~~~~~~~~~~~~~~ -.. autoclass:: ExpireBehaviour +.. autoclass:: ExpireBehaviour() :members: Events diff --git a/docs/api/interactions.rst b/docs/api/interactions.rst index 7ae3ca9547..0b5b472dcd 100644 --- a/docs/api/interactions.rst +++ b/docs/api/interactions.rst @@ -178,13 +178,13 @@ Enumerations InteractionType ~~~~~~~~~~~~~~~ -.. autoclass:: InteractionType +.. autoclass:: InteractionType() :members: InteractionResponseType ~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: InteractionResponseType +.. autoclass:: InteractionResponseType() :members: Events diff --git a/docs/api/invites.rst b/docs/api/invites.rst index 982bbe490d..94d4cf9ad4 100644 --- a/docs/api/invites.rst +++ b/docs/api/invites.rst @@ -40,13 +40,13 @@ Enumerations InviteType ~~~~~~~~~~ -.. autoclass:: InviteType +.. autoclass:: InviteType() :members: InviteTarget ~~~~~~~~~~~~ -.. autoclass:: InviteTarget +.. autoclass:: InviteTarget() :members: Events diff --git a/docs/api/localization.rst b/docs/api/localization.rst index b99654c10d..8c8e991fe7 100644 --- a/docs/api/localization.rst +++ b/docs/api/localization.rst @@ -43,5 +43,5 @@ Enumerations Locale ~~~~~~ -.. autoclass:: Locale +.. autoclass:: Locale() :members: diff --git a/docs/api/messages.rst b/docs/api/messages.rst index 82d46db89a..96c2c53e7e 100644 --- a/docs/api/messages.rst +++ b/docs/api/messages.rst @@ -215,13 +215,13 @@ Enumerations MessageType ~~~~~~~~~~~ -.. autoclass:: MessageType +.. autoclass:: MessageType() :members: PollLayoutType ~~~~~~~~~~~~~~ -.. autoclass:: PollLayoutType +.. autoclass:: PollLayoutType() :members: Events diff --git a/docs/api/skus.rst b/docs/api/skus.rst index 0c1c9d0275..1041d1b38b 100644 --- a/docs/api/skus.rst +++ b/docs/api/skus.rst @@ -39,5 +39,5 @@ Enumerations SKUType ~~~~~~~ -.. autoclass:: SKUType +.. autoclass:: SKUType() :members: diff --git a/docs/api/stage_instances.rst b/docs/api/stage_instances.rst index b0ce11e5d5..2178922b39 100644 --- a/docs/api/stage_instances.rst +++ b/docs/api/stage_instances.rst @@ -25,7 +25,7 @@ Enumerations StagePrivacyLevel ~~~~~~~~~~~~~~~~~ -.. autoclass:: StagePrivacyLevel +.. autoclass:: StagePrivacyLevel() :members: Events diff --git a/docs/api/stickers.rst b/docs/api/stickers.rst index babad31ff3..7d7a2b5b2a 100644 --- a/docs/api/stickers.rst +++ b/docs/api/stickers.rst @@ -60,13 +60,13 @@ Enumerations StickerType ~~~~~~~~~~~ -.. autoclass:: StickerType +.. autoclass:: StickerType() :members: StickerFormatType ~~~~~~~~~~~~~~~~~ -.. autoclass:: StickerFormatType +.. autoclass:: StickerFormatType() :members: Events diff --git a/docs/api/users.rst b/docs/api/users.rst index 0797ef47e2..3b4d2309d9 100644 --- a/docs/api/users.rst +++ b/docs/api/users.rst @@ -51,13 +51,13 @@ Enumerations UserFlags ~~~~~~~~~ -.. autoclass:: UserFlags +.. autoclass:: UserFlags() :members: DefaultAvatar ~~~~~~~~~~~~~ -.. autoclass:: DefaultAvatar +.. autoclass:: DefaultAvatar() :members: Events diff --git a/docs/api/voice.rst b/docs/api/voice.rst index a71eec38c5..0ec05c694c 100644 --- a/docs/api/voice.rst +++ b/docs/api/voice.rst @@ -124,13 +124,13 @@ Enumerations VoiceChannelEffectAnimationType ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. autoclass:: VoiceChannelEffectAnimationType +.. autoclass:: VoiceChannelEffectAnimationType() :members: PartyType ~~~~~~~~~ -.. autoclass:: PartyType +.. autoclass:: PartyType() :members: Events diff --git a/docs/api/webhooks.rst b/docs/api/webhooks.rst index 78e30f2a10..09b63a5205 100644 --- a/docs/api/webhooks.rst +++ b/docs/api/webhooks.rst @@ -67,7 +67,7 @@ Enumerations WebhookType ~~~~~~~~~~~ -.. autoclass:: WebhookType +.. autoclass:: WebhookType() :members: Events diff --git a/docs/api/widgets.rst b/docs/api/widgets.rst index 0f00409277..8349e4dc1a 100644 --- a/docs/api/widgets.rst +++ b/docs/api/widgets.rst @@ -52,5 +52,5 @@ Enumerations WidgetStyle ~~~~~~~~~~~ -.. autoclass:: WidgetStyle +.. autoclass:: WidgetStyle() :members: From b7417c770faf76d68e7b96b6db67bf32c5091a82 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 18 Nov 2024 21:48:22 +0100 Subject: [PATCH 03/10] feat(docs): add custom enum attribute documenter --- docs/conf.py | 1 + docs/extensions/enumattrs.py | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docs/extensions/enumattrs.py diff --git a/docs/conf.py b/docs/conf.py index 575602bda9..99e6fa6c9e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,6 +53,7 @@ "attributetable", "resourcelinks", "collapse", + "enumattrs", "nitpick_file_ignorer", ] diff --git a/docs/extensions/enumattrs.py b/docs/extensions/enumattrs.py new file mode 100644 index 0000000000..8d3dd958a9 --- /dev/null +++ b/docs/extensions/enumattrs.py @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: MIT + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from sphinx.ext.autodoc import AttributeDocumenter + +import disnake + +if TYPE_CHECKING: + from sphinx.application import Sphinx + + from ._types import SphinxExtensionMeta + + +class EnumMemberDocumenter(AttributeDocumenter): + objtype = "enumattribute" + directivetype = AttributeDocumenter.objtype + priority = 10 + AttributeDocumenter.priority + + @classmethod + def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: Any) -> bool: + return super().can_document_member(member, membername, isattr, parent) and isinstance( + member, disnake.enums._EnumValueBase + ) + + def should_suppress_value_header(self) -> bool: + # always hide enum member values + return True + + +def setup(app: Sphinx) -> SphinxExtensionMeta: + app.setup_extension("sphinx.ext.autodoc") + app.add_autodocumenter(EnumMemberDocumenter) + + return { + "parallel_read_safe": True, + "parallel_write_safe": True, + } From ced8a0142cb0a1afbba35eb657144aabae213c28 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Mon, 18 Nov 2024 22:11:21 +0100 Subject: [PATCH 04/10] docs: monkeypatch enum repr to show string representation instead --- docs/extensions/enumattrs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/extensions/enumattrs.py b/docs/extensions/enumattrs.py index 8d3dd958a9..9d56779596 100644 --- a/docs/extensions/enumattrs.py +++ b/docs/extensions/enumattrs.py @@ -34,6 +34,9 @@ def setup(app: Sphinx) -> SphinxExtensionMeta: app.setup_extension("sphinx.ext.autodoc") app.add_autodocumenter(EnumMemberDocumenter) + # show `Enum.name` instead of `` in signatures + disnake.enums._EnumValueBase.__repr__ = disnake.enums._EnumValueBase.__str__ + return { "parallel_read_safe": True, "parallel_write_safe": True, From e71eafc753e1762e804a566d7ea9462fec4fef6a Mon Sep 17 00:00:00 2001 From: shiftinv Date: Tue, 19 Nov 2024 13:16:31 +0100 Subject: [PATCH 05/10] chore: add smol docstring to documenter --- docs/extensions/enumattrs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/extensions/enumattrs.py b/docs/extensions/enumattrs.py index 9d56779596..f022841baf 100644 --- a/docs/extensions/enumattrs.py +++ b/docs/extensions/enumattrs.py @@ -15,6 +15,11 @@ class EnumMemberDocumenter(AttributeDocumenter): + """ + Custom enum member documenter which hides enum values. + Gets used automatically for all `_EnumValueBase` instances. + """ + objtype = "enumattribute" directivetype = AttributeDocumenter.objtype priority = 10 + AttributeDocumenter.priority @@ -32,6 +37,7 @@ def should_suppress_value_header(self) -> bool: def setup(app: Sphinx) -> SphinxExtensionMeta: app.setup_extension("sphinx.ext.autodoc") + app.add_autodocumenter(EnumMemberDocumenter) # show `Enum.name` instead of `` in signatures From 978b20308c6eaf94ea0d8fe87994f6970e38d1f6 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Tue, 19 Nov 2024 13:16:53 +0100 Subject: [PATCH 06/10] fix: add missing `_enum_value_cls_` annotation to EnumMeta --- disnake/enums.py | 1 + 1 file changed, 1 insertion(+) diff --git a/disnake/enums.py b/disnake/enums.py index 247af085e6..7497898218 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -115,6 +115,7 @@ class EnumMeta(type): _enum_member_names_: ClassVar[List[str]] _enum_member_map_: ClassVar[Dict[str, Any]] _enum_value_map_: ClassVar[Dict[Any, Any]] + _enum_value_cls_: ClassVar[Type[_EnumValueBase]] def __new__(cls, name: str, bases, attrs, *, comparable: bool = False): value_mapping = {} From 5c8c4e880406cdd6ce600bc33f42d2aa330713cc Mon Sep 17 00:00:00 2001 From: shiftinv Date: Tue, 19 Nov 2024 13:24:28 +0100 Subject: [PATCH 07/10] fix(docs): fix indefinite articles --- disnake/enums.py | 8 ++++---- disnake/ext/commands/flags.py | 8 ++++---- disnake/flags.py | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/disnake/enums.py b/disnake/enums.py index 7497898218..f73c199a35 100644 --- a/disnake/enums.py +++ b/disnake/enums.py @@ -1369,16 +1369,16 @@ class NSFWLevel(Enum, comparable=True): Checks if two NSFW levels are not equal. .. describe:: x > y - Checks if a NSFW level is higher than another. + Checks if an NSFW level is higher than another. .. describe:: x < y - Checks if a NSFW level is lower than another. + Checks if an NSFW level is lower than another. .. describe:: x >= y - Checks if a NSFW level is higher or equal to another. + Checks if an NSFW level is higher or equal to another. .. describe:: x <= y - Checks if a NSFW level is lower or equal to another. + Checks if an NSFW level is lower or equal to another. """ default = 0 diff --git a/disnake/ext/commands/flags.py b/disnake/ext/commands/flags.py index 866566af3b..17fe65531f 100644 --- a/disnake/ext/commands/flags.py +++ b/disnake/ext/commands/flags.py @@ -35,16 +35,16 @@ class CommandSyncFlags(BaseFlags): Checks if two CommandSyncFlags instances are not equal. .. describe:: x <= y - Checks if an CommandSyncFlags instance is a subset of another CommandSyncFlags instance. + Checks if a CommandSyncFlags instance is a subset of another CommandSyncFlags instance. .. describe:: x >= y - Checks if an CommandSyncFlags instance is a superset of another CommandSyncFlags instance. + Checks if a CommandSyncFlags instance is a superset of another CommandSyncFlags instance. .. describe:: x < y - Checks if an CommandSyncFlags instance is a strict subset of another CommandSyncFlags instance. + Checks if a CommandSyncFlags instance is a strict subset of another CommandSyncFlags instance. .. describe:: x > y - Checks if an CommandSyncFlags instance is a strict superset of another CommandSyncFlags instance. + Checks if a CommandSyncFlags instance is a strict superset of another CommandSyncFlags instance. .. describe:: x | y, x |= y Returns a new CommandSyncFlags instance with all enabled flags from both x and y. diff --git a/disnake/flags.py b/disnake/flags.py index da3cba6904..fcba5ffb63 100644 --- a/disnake/flags.py +++ b/disnake/flags.py @@ -2282,16 +2282,16 @@ class MemberFlags(BaseFlags): Checks if two MemberFlags instances are not equal. .. describe:: x <= y - Checks if an MemberFlags instance is a subset of another MemberFlags instance. + Checks if a MemberFlags instance is a subset of another MemberFlags instance. .. describe:: x >= y - Checks if an MemberFlags instance is a superset of another MemberFlags instance. + Checks if a MemberFlags instance is a superset of another MemberFlags instance. .. describe:: x < y - Checks if an MemberFlags instance is a strict subset of another MemberFlags instance. + Checks if a MemberFlags instance is a strict subset of another MemberFlags instance. .. describe:: x > y - Checks if an MemberFlags instance is a strict superset of another MemberFlags instance. + Checks if a MemberFlags instance is a strict superset of another MemberFlags instance. .. describe:: x | y, x |= y Returns a new MemberFlags instance with all enabled flags from both x and y. @@ -2384,16 +2384,16 @@ class RoleFlags(BaseFlags): Checks if two RoleFlags instances are not equal. .. describe:: x <= y - Checks if an RoleFlags instance is a subset of another RoleFlags instance. + Checks if a RoleFlags instance is a subset of another RoleFlags instance. .. describe:: x >= y - Checks if an RoleFlags instance is a superset of another RoleFlags instance. + Checks if a RoleFlags instance is a superset of another RoleFlags instance. .. describe:: x < y - Checks if an RoleFlags instance is a strict subset of another RoleFlags instance. + Checks if a RoleFlags instance is a strict subset of another RoleFlags instance. .. describe:: x > y - Checks if an RoleFlags instance is a strict superset of another RoleFlags instance. + Checks if a RoleFlags instance is a strict superset of another RoleFlags instance. .. describe:: x | y, x |= y Returns a new RoleFlags instance with all enabled flags from both x and y. From 6cb0ffee9ffa9c1920aef69022c566badab40dca Mon Sep 17 00:00:00 2001 From: shiftinv Date: Tue, 19 Nov 2024 13:29:42 +0100 Subject: [PATCH 08/10] docs: move `ext.commands.BucketType` enum as well --- disnake/ext/commands/cooldowns.py | 12 ++++++++++++ docs/ext/commands/api/checks.rst | 29 ++--------------------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/disnake/ext/commands/cooldowns.py b/disnake/ext/commands/cooldowns.py index 354754550a..b71cd5f323 100644 --- a/disnake/ext/commands/cooldowns.py +++ b/disnake/ext/commands/cooldowns.py @@ -27,13 +27,25 @@ class BucketType(Enum): + """Specifies a type of bucket for, e.g. a cooldown.""" + default = 0 + """The default bucket operates on a global basis.""" user = 1 + """The user bucket operates on a per-user basis.""" guild = 2 + """The guild bucket operates on a per-guild basis.""" channel = 3 + """The channel bucket operates on a per-channel basis.""" member = 4 + """The member bucket operates on a per-member basis.""" category = 5 + """The category bucket operates on a per-category basis.""" role = 6 + """The role bucket operates on a per-role basis. + + .. versionadded:: 1.3 + """ def get_key(self, msg: Message) -> Any: if self is BucketType.user: diff --git a/docs/ext/commands/api/checks.rst b/docs/ext/commands/api/checks.rst index 2ced115197..9418f1cc6f 100644 --- a/docs/ext/commands/api/checks.rst +++ b/docs/ext/commands/api/checks.rst @@ -26,33 +26,8 @@ Enumerations BucketType ~~~~~~~~~~ -.. class:: BucketType - - Specifies a type of bucket for, e.g. a cooldown. - - .. attribute:: default - - The default bucket operates on a global basis. - .. attribute:: user - - The user bucket operates on a per-user basis. - .. attribute:: guild - - The guild bucket operates on a per-guild basis. - .. attribute:: channel - - The channel bucket operates on a per-channel basis. - .. attribute:: member - - The member bucket operates on a per-member basis. - .. attribute:: category - - The category bucket operates on a per-category basis. - .. attribute:: role - - The role bucket operates on a per-role basis. - - .. versionadded:: 1.3 +.. autoclass:: BucketType() + :members: Functions --------- From fdab2844ca32fa0a80a052acf66d2e9b424c3313 Mon Sep 17 00:00:00 2001 From: shiftinv Date: Tue, 19 Nov 2024 13:52:08 +0100 Subject: [PATCH 09/10] docs: add changelog entry --- changelog/1243.misc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/1243.misc.rst diff --git a/changelog/1243.misc.rst b/changelog/1243.misc.rst new file mode 100644 index 0000000000..b10a18609e --- /dev/null +++ b/changelog/1243.misc.rst @@ -0,0 +1 @@ +Move enum member documentation into docstrings. From 7a48fa302e5317326212e968a9b852dab6b379ea Mon Sep 17 00:00:00 2001 From: shiftinv Date: Sun, 29 Dec 2024 17:48:37 +0100 Subject: [PATCH 10/10] chore(docs): sort index toc --- docs/api/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/index.rst b/docs/api/index.rst index 0b04ea5e1d..0732544b14 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -96,7 +96,6 @@ Documents app_info audit_logs automod - ui channels clients components @@ -116,10 +115,11 @@ Documents permissions roles skus - subscriptions soundboard stage_instances stickers + subscriptions + ui users utilities voice