Browse Source

Update some flags

pull/10109/head
dolfies 6 months ago
parent
commit
25360912aa
  1. 5
      discord/enums.py
  2. 73
      discord/flags.py
  3. 32
      docs/api.rst

5
discord/enums.py

@ -680,11 +680,9 @@ 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
@ -692,7 +690,10 @@ class UserFlags(Enum):
spammer = 1048576
disable_premium = 2097152
active_developer = 4194304
provisional_account = 8388608
quarantined = 17592186044416
collaborator = 1125899906842624
restricted_collaborator = 2251799813685248
class ActivityType(Enum):

73
discord/flags.py

@ -522,6 +522,18 @@ class SystemChannelFlags(BaseFlags):
"""
return 32
@flag_value
def unknown_6(self):
return 64
@flag_value
def channel_prompt_deadchat(self):
""":class:`bool`: Returns ``True`` if dead chat prompts are enabled.
.. versionadded:: 2.1
"""
return 128
@fill_with_flags()
class MessageFlags(BaseFlags):
@ -740,6 +752,10 @@ class PublicUserFlags(BaseFlags):
.. versionadded:: 1.4
.. versionchanged:: 2.1
Removed the ``system`` flag as it is no longer used.
Attributes
-----------
value: :class:`int`
@ -803,11 +819,6 @@ class PublicUserFlags(BaseFlags):
""":class:`bool`: Returns ``True`` if the user is a Team User."""
return UserFlags.team_user.value
@flag_value
def system(self):
""":class:`bool`: Returns ``True`` if the user is a system user (i.e. represents Discord officially)."""
return UserFlags.system.value
@flag_value
def bug_hunter_level_2(self):
""":class:`bool`: Returns ``True`` if the user is a level 2 Bug Hunter"""
@ -864,6 +875,14 @@ class PublicUserFlags(BaseFlags):
"""
return UserFlags.active_developer.value
@flag_value
def provisional_account(self):
""":class:`bool`: Returns ``True`` if the user is a provisional account used with the social layer integration.
.. versionadded:: 2.1
"""
return UserFlags.provisional_account.value
def all(self) -> List[UserFlags]:
"""List[:class:`UserFlags`]: Returns all flags the user has."""
return [public_flag for public_flag in UserFlags if self._has_flag(public_flag.value)]
@ -914,6 +933,11 @@ class PrivateUserFlags(PublicUserFlags):
.. versionadded:: 2.0
.. versionchanged:: 2.1
Removed the ``underage_deleted``, ``partner_or_verification_application``,
and ``disable_premium`` flags as they are not sent or no longer used.
Attributes
-----------
value: :class:`int`
@ -940,24 +964,19 @@ class PrivateUserFlags(PublicUserFlags):
return UserFlags.mfa_sms.value
@flag_value
def underage_deleted(self):
""":class:`bool`: Returns ``True`` if the user has been flagged for deletion for being underage."""
return UserFlags.underage_deleted.value
def quarantined(self):
""":class:`bool`: Returns ``True`` if the user is quarantined."""
return UserFlags.quarantined.value
@flag_value
def partner_or_verification_application(self):
""":class:`bool`: Returns ``True`` if the user has a partner or a verification application."""
return UserFlags.partner_or_verification_application.value
def collaborator(self):
""":class:`bool`: Returns ``True`` if the user is a collaborator and is considered staff."""
return UserFlags.collaborator.value
@flag_value
def disable_premium(self):
""":class:`bool`: Returns ``True`` if the user bought premium but has it manually disabled."""
return UserFlags.disable_premium.value
@flag_value
def quarantined(self):
""":class:`bool`: Returns ``True`` if the user is quarantined."""
return UserFlags.quarantined.value
def restricted_collaborator(self):
""":class:`bool`: Returns ``True`` if the user is a restricted collaborator and is considered staff."""
return UserFlags.restricted_collaborator.value
@fill_with_flags()
@ -1316,6 +1335,14 @@ class ApplicationFlags(BaseFlags):
"""
return 1 << 8
@flag_value
def contextless_activity(self):
""":class:`bool`: Returns ``True`` if the embedded application's activity can be launched without a context.
.. versionadded:: 2.1
"""
return 1 << 9
@flag_value
def gateway_presence(self):
""":class:`bool`: Returns ``True`` if the application is verified and is allowed to
@ -1815,6 +1842,14 @@ class PromotionFlags(BaseFlags):
""":class:`bool`: Returns ``True`` if the promotion is redeemable by trial users."""
return 1 << 6
@flag_value
def suppress_notification(self):
""":class:`bool`: Returns ``True`` if the client should suppress notifications for the promotion.
.. versionadded:: 2.1
"""
return 1 << 7
@fill_with_flags()
class GiftFlags(BaseFlags):

32
docs/api.rst

@ -2048,6 +2048,7 @@ of :class:`enum.Enum`.
The user is a Bug Hunter.
.. versionadded:: 2.0
.. attribute:: mfa_sms
The user has SMS recovery for Multi Factor Authentication enabled.
@ -2076,15 +2077,12 @@ of :class:`enum.Enum`.
The user is a Team User.
.. attribute:: partner_or_verification_application
The user has a partner or verification application.
.. attribute:: system
The user is a system user (i.e. represents Discord officially).
.. versionadded:: 2.0
.. attribute:: has_unread_urgent_messages
The user has an unread system message.
@ -2093,11 +2091,6 @@ of :class:`enum.Enum`.
The user is a Bug Hunter Level 2.
.. attribute:: underage_deleted
The user has been flagged for deletion for being underage.
.. versionadded:: 2.0
.. attribute:: verified_bot
The user is a Verified Bot.
@ -2115,16 +2108,19 @@ of :class:`enum.Enum`.
The user is a bot that only uses HTTP interactions and is shown in the online member list.
.. versionadded:: 2.0
.. attribute:: spammer
The user is flagged as a spammer by Discord.
.. versionadded:: 2.0
.. attribute:: disable_premium
The user bought premium but has it manually disabled.
.. versionadded:: 2.0
.. attribute:: quarantined
The user is quarantined.
@ -2137,6 +2133,24 @@ of :class:`enum.Enum`.
.. versionadded:: 2.0
.. attribute:: provisional_account
The user is a provisional account used with the social layer integration.
.. versionadded:: 2.1
.. attribute:: collaborator
The user is a collaborator and is considered staff.
.. versionadded:: 2.1
.. attribute:: restricted_collaborator
The user is a restricted collaborator and is considered staff.
.. versionadded:: 2.1
.. class:: ActivityType
Specifies the type of :class:`Activity`. This is used to check how to

Loading…
Cancel
Save