diff --git a/discord/enums.py b/discord/enums.py index 3972b1bb55..af629b92aa 100644 --- a/discord/enums.py +++ b/discord/enums.py @@ -185,6 +185,8 @@ class ChannelType(Enum): public_thread = 11 private_thread = 12 stage_voice = 13 + directory = 14 + forum = 15 def __str__(self): return self.name @@ -214,6 +216,7 @@ class MessageType(Enum): application_command = 20 thread_starter_message = 21 guild_invite_reminder = 22 + context_menu_command = 23 class VoiceRegion(Enum): @@ -285,6 +288,7 @@ class Status(Enum): dnd = 'dnd' do_not_disturb = 'dnd' invisible = 'invisible' + streaming = 'streaming' def __str__(self): return self.value @@ -356,6 +360,9 @@ class AuditLogAction(Enum): sticker_create = 90 sticker_update = 91 sticker_delete = 92 + scheduled_event_create = 100 + scheduled_event_update = 101 + scheduled_event_delete = 102 thread_create = 110 thread_update = 111 thread_delete = 112 @@ -406,6 +413,9 @@ def category(self) -> Optional[AuditLogActionCategory]: AuditLogAction.sticker_create: AuditLogActionCategory.create, AuditLogAction.sticker_update: AuditLogActionCategory.update, AuditLogAction.sticker_delete: AuditLogActionCategory.delete, + AuditLogAction.scheduled_event_create: AuditLogActionCategory.create, + AuditLogAction.scheduled_event_update: AuditLogActionCategory.update, + AuditLogAction.scheduled_event_delete: AuditLogActionCategory.delete, AuditLogAction.thread_create: AuditLogActionCategory.create, AuditLogAction.thread_update: AuditLogActionCategory.update, AuditLogAction.thread_delete: AuditLogActionCategory.delete, @@ -442,6 +452,8 @@ def target_type(self) -> Optional[str]: return 'stage_instance' elif v < 93: return 'sticker' + elif v < 103: + return 'scheduled_event' elif v < 113: return 'thread' @@ -458,12 +470,16 @@ class UserFlags(Enum): hypesquad_balance = 256 early_supporter = 512 team_user = 1024 + partner_or_verification_application = 2048 system = 4096 has_unread_urgent_messages = 8192 bug_hunter_level_2 = 16384 + underage_deleted = 32768 verified_bot = 65536 verified_bot_developer = 131072 discord_certified_moderator = 262144 + bot_http_interactions = 524288 + spammer = 1048576 class ActivityType(Enum): @@ -530,6 +546,7 @@ class InteractionType(Enum): ping = 1 application_command = 2 component = 3 + auto_complete = 4 class InteractionResponseType(Enum): @@ -540,6 +557,7 @@ class InteractionResponseType(Enum): deferred_channel_message = 5 # (with source) deferred_message_update = 6 # for components message_update = 7 # for components + auto_complete_result = 8 # for autocomplete interactions class VideoQualityMode(Enum): diff --git a/discord/flags.py b/discord/flags.py index 8f757ccf33..a64cf7726f 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -296,6 +296,24 @@ def ephemeral(self): """ return 64 + @flag_value + def loading(self): + """:class:`bool`: Returns ``True`` if the source message an deferred. + + The user sees a 'thinking' state + + .. versionadded:: 2.0 + """ + return 128 + + @flag_value + def failed_to_mention_some_roles_in_thread(self): + """:class:`bool`: Returns ``True`` if some roles are failed to mention in a thread. + + .. versionadded:: 2.0 + """ + return 256 + @fill_with_flags() class PublicUserFlags(BaseFlags): @@ -350,6 +368,16 @@ def bug_hunter(self): """:class:`bool`: Returns ``True`` if the user is a Bug Hunter""" return UserFlags.bug_hunter.value + @flag_value + def mfa_sms(self): + """:class:`bool`: Returns ``True`` if the user has SMS recovery for 2FA enabled""" + return UserFlags.mfa_sms.value + + @flag_value + def premium_promo_dismissed(self): + """:class:`bool`: Returns ``True`` if the user is marked as dismissed Nitro promotion""" + return UserFlags.premium_promo_dismissed.value + @flag_value def hypesquad_bravery(self): """:class:`bool`: Returns ``True`` if the user is a HypeSquad Bravery member.""" @@ -375,6 +403,11 @@ def team_user(self): """:class:`bool`: Returns ``True`` if the user is a Team User.""" return UserFlags.team_user.value + @flag_value + def partner_or_verification_application(self): + """:class:`bool`: Relates to partner/verification applications.""" + return UserFlags.partner_or_verification_application.value + @flag_value def system(self): """:class:`bool`: Returns ``True`` if the user is a system user (i.e. represents Discord officially).""" @@ -385,6 +418,11 @@ def bug_hunter_level_2(self): """:class:`bool`: Returns ``True`` if the user is a Bug Hunter Level 2""" return UserFlags.bug_hunter_level_2.value + @flag_value + def underage_deleted(self): + """:class:`bool`: Returns ``True`` if the user has a pending deletion for being underage in DOB prompt""" + return UserFlags.underage_deleted.value + @flag_value def verified_bot(self): """:class:`bool`: Returns ``True`` if the user is a Verified Bot.""" @@ -411,6 +449,22 @@ def discord_certified_moderator(self): """ return UserFlags.discord_certified_moderator.value + @flag_value + def bot_http_interactions(self): + """:class:`bool`: Returns ``True`` if is a bot http interaction. + + .. versionadded:: 2.0 + """ + return UserFlags.bot_http_interactions.value + + @flag_value + def spammer(self): + """:class:`bool`: Returns ``True`` if the user is flagged as spammer. + + .. versionadded:: 2.0 + """ + return UserFlags.spammer.value + def all(self) -> List[UserFlags]: """List[:class:`UserFlags`]: Returns all public flags the user has.""" return [public_flag for public_flag in UserFlags if self._has_flag(public_flag.value)] diff --git a/discord/guild.py b/discord/guild.py index a03713ea1a..10b43187db 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -199,22 +199,34 @@ class Guild(Hashable): They are currently as follows: + - ``ANIMATED_BANNER``: Guild can upload an animated banner. - ``ANIMATED_ICON``: Guild can upload an animated icon. - ``BANNER``: Guild can upload and use a banner. (i.e. :attr:`.banner`) - ``COMMERCE``: Guild can sell things using store channels. - ``COMMUNITY``: Guild is a community server. - ``DISCOVERABLE``: Guild shows up in Server Discovery. - ``FEATURABLE``: Guild is able to be featured in Server Discovery. + - ``HAS_DIRECTORY_ENTRY``: Unknown. + - ``HUB``: Hubs contain a directory channel that let you find school-related, student-run servers for your school or university. - ``INVITE_SPLASH``: Guild's invite page can have a special splash. + - ``LINKED_TO_HUB``: 'Guild is linked to a hub. + - ``MEMBER_PROFILES``: Unknown. - ``MEMBER_VERIFICATION_GATE_ENABLED``: Guild has Membership Screening enabled. - ``MONETIZATION_ENABLED``: Guild has enabled monetization. - ``MORE_EMOJI``: Guild has increased custom emoji slots. - ``MORE_STICKERS``: Guild has increased custom sticker slots. - ``NEWS``: Guild can create news channels. + - ``NEW_THREAD_PERMISSIONS``: Guild has new thread permissions. - ``PARTNERED``: Guild is a partnered server. + - ``PREMIUM_TIER_3_OVERRIDE``: Forces the server to server boosting level 3 (specifically created by Discord Staff Member "Jethro" for their personal server). - ``PREVIEW_ENABLED``: Guild can be viewed before being accepted via Membership Screening. - ``PRIVATE_THREADS``: Guild has access to create private threads. + - ``ROLE_ICONS``: Guild can set an image or emoji as a role icon. + - ``ROLE_SUBSCRIPTIONS_ENABLED``: Guild is able to view and manage role subscriptions. - ``SEVEN_DAY_THREAD_ARCHIVE``: Guild has access to the seven day archive time for threads. + - ``TEXT_IN_VOICE_ENABLED``: Guild has a chat button inside voice channels that opens a dedicated text channel in a sidebar similar to thread view. + - ``THREAD_DEFAULT_AUTO_ARCHIVE_DURATION``: Unknown, presumably used for testing changes to the thread default auto archive duration.. + - ``THREADS_ENABLED_TESTING``: Used by bot developers to test their bots with threads in guilds with 5 or less members and a bot. Also gives the premium thread features. - ``THREE_DAY_THREAD_ARCHIVE``: Guild has access to the three day archive time for threads. - ``TICKETED_EVENTS_ENABLED``: Guild has enabled ticketed events. - ``VANITY_URL``: Guild can have a vanity invite URL (e.g. discord.gg/discord-api). diff --git a/discord/types/guild.py b/discord/types/guild.py index 13bf104053..162356a225 100644 --- a/discord/types/guild.py +++ b/discord/types/guild.py @@ -76,22 +76,34 @@ class _GuildOptional(TypedDict, total=False): NSFWLevel = Literal[0, 1, 2, 3] PremiumTier = Literal[0, 1, 2, 3] GuildFeature = Literal[ + 'ANIMATED_BANNER', 'ANIMATED_ICON', 'BANNER', 'COMMERCE', 'COMMUNITY', 'DISCOVERABLE', 'FEATURABLE', + 'HAS_DIRECTORY_ENTRY', + 'HUB', 'INVITE_SPLASH', + 'LINKED_TO_HUB', + 'MEMBER_PROFILES', 'MEMBER_VERIFICATION_GATE_ENABLED', 'MONETIZATION_ENABLED', 'MORE_EMOJI', 'MORE_STICKERS', 'NEWS', + 'NEW_THREAD_PERMISSIONS', 'PARTNERED', + 'PREMIUM_TIER_3_OVERRIDE', 'PREVIEW_ENABLED', 'PRIVATE_THREADS', + 'ROLE_ICONS', + 'ROLE_SUBSCRIPTIONS_ENABLED', 'SEVEN_DAY_THREAD_ARCHIVE', + 'TEXT_IN_VOICE_ENABLED', + 'THREAD_DEFAULT_AUTO_ARCHIVE_DURATION', + 'THREADS_ENABLED_TESTING', 'THREE_DAY_THREAD_ARCHIVE', 'TICKETED_EVENTS_ENABLED', 'VANITY_URL', diff --git a/docs/api.rst b/docs/api.rst index 3933f13930..70fabf6be7 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1251,6 +1251,26 @@ of :class:`enum.Enum`. .. versionadded:: 2.0 + .. attribute:: directory + + A guild directory entry. + + Used in hub guilds. + + In Experiment. + + .. versionadded:: 2.0 + + .. attribute:: forum + + User can only write in threads. + + Similar functionality to a forum. + + In Experiment. + + .. versionadded:: 2.0 + .. class:: MessageType Specifies the type of :class:`Message`. This is used to denote if a message @@ -1370,6 +1390,11 @@ of :class:`enum.Enum`. 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 an context menu command was executed. + .. versionadded:: 2.0 .. class:: UserFlags @@ -1472,6 +1497,9 @@ of :class:`enum.Enum`. .. attribute:: component Represents a component based interaction, i.e. using the Discord Bot UI Kit. + .. attribute:: auto_complete + + Represents a autocomplete interaction for slash commands. .. class:: InteractionResponseType @@ -1505,6 +1533,9 @@ of :class:`enum.Enum`. Responds to the interaction by editing the message. See also :meth:`InteractionResponse.edit_message` + .. attribute:: auto_complete_result + + Responds to autocomplete requests. .. class:: ComponentType @@ -1791,6 +1822,9 @@ of :class:`enum.Enum`. 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 streaming. .. class:: AuditLogAction @@ -2385,6 +2419,24 @@ of :class:`enum.Enum`. .. versionadded:: 2.0 + .. attribute:: scheduled_event_create + + A scheduled event was created. + + .. versionadded:: 2.0 + + .. attribute:: scheduled_event_update + + A scheduled event was updated. + + .. versionadded:: 2.0 + + .. attribute:: scheduled_event_delete + + A scheduled event was deleted. + + .. versionadded:: 2.0 + .. attribute:: thread_create A thread was created.