Add support for premium app integrations

Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
Co-authored-by: Lucas Hardt <lucas.hardt@fu-berlin.de>
Co-authored-by: Andrin S. <65789180+Puncher1@users.noreply.github.com>
This commit is contained in:
Lucas Hardt
2023-10-19 13:27:29 +02:00
committed by GitHub
parent 5d353282dc
commit 99618c823a
12 changed files with 828 additions and 4 deletions

View File

@ -60,6 +60,7 @@ __all__ = (
'MemberFlags',
'AttachmentFlags',
'RoleFlags',
'SKUFlags',
)
BF = TypeVar('BF', bound='BaseFlags')
@ -1971,3 +1972,76 @@ class RoleFlags(BaseFlags):
def in_prompt(self):
""":class:`bool`: Returns ``True`` if the role can be selected by members in an onboarding prompt."""
return 1 << 0
@fill_with_flags()
class SKUFlags(BaseFlags):
r"""Wraps up the Discord SKU flags
.. versionadded:: 2.4
.. container:: operations
.. describe:: x == y
Checks if two SKUFlags are equal.
.. describe:: x != y
Checks if two SKUFlags are not equal.
.. describe:: x | y, x |= y
Returns a SKUFlags instance with all enabled flags from
both x and y.
.. describe:: x & y, x &= y
Returns a SKUFlags instance with only flags enabled on
both x and y.
.. describe:: x ^ y, x ^= y
Returns a SKUFlags instance with only flags enabled on
only one of x or y, not on both.
.. describe:: ~x
Returns a SKUFlags instance with all flags inverted from x.
.. describe:: hash(x)
Return the flag's hash.
.. describe:: iter(x)
Returns an iterator of ``(name, value)`` pairs. This allows it
to be, for example, constructed as a dict or a list of pairs.
Note that aliases are not shown.
.. describe:: bool(b)
Returns whether any flag is set to ``True``.
Attributes
-----------
value: :class:`int`
The raw value. You should query flags via the properties
rather than using this raw value.
"""
@flag_value
def available(self):
""":class:`bool`: Returns ``True`` if the SKU is available for purchase."""
return 1 << 2
@flag_value
def guild_subscription(self):
""":class:`bool`: Returns ``True`` if the SKU is a guild subscription."""
return 1 << 7
@flag_value
def user_subscription(self):
""":class:`bool`: Returns ``True`` if the SKU is a user subscription."""
return 1 << 8