mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
Add support for role flags
This commit is contained in:
@ -59,6 +59,7 @@ __all__ = (
|
||||
'AutoModPresets',
|
||||
'MemberFlags',
|
||||
'AttachmentFlags',
|
||||
'RoleFlags',
|
||||
)
|
||||
|
||||
BF = TypeVar('BF', bound='BaseFlags')
|
||||
@ -1898,3 +1899,66 @@ class AttachmentFlags(BaseFlags):
|
||||
def remix(self):
|
||||
""":class:`bool`: Returns ``True`` if the attachment has been edited using the remix feature."""
|
||||
return 1 << 2
|
||||
|
||||
|
||||
@fill_with_flags()
|
||||
class RoleFlags(BaseFlags):
|
||||
r"""Wraps up the Discord Role flags
|
||||
|
||||
.. versionadded:: 2.4
|
||||
|
||||
.. container:: operations
|
||||
|
||||
.. describe:: x == y
|
||||
|
||||
Checks if two RoleFlags are equal.
|
||||
|
||||
.. describe:: x != y
|
||||
|
||||
Checks if two RoleFlags are not equal.
|
||||
|
||||
.. describe:: x | y, x |= y
|
||||
|
||||
Returns a RoleFlags instance with all enabled flags from
|
||||
both x and y.
|
||||
|
||||
.. describe:: x & y, x &= y
|
||||
|
||||
Returns a RoleFlags instance with only flags enabled on
|
||||
both x and y.
|
||||
|
||||
.. describe:: x ^ y, x ^= y
|
||||
|
||||
Returns a RoleFlags instance with only flags enabled on
|
||||
only one of x or y, not on both.
|
||||
|
||||
.. describe:: ~x
|
||||
|
||||
Returns a RoleFlags 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 in_prompt(self):
|
||||
""":class:`bool`: Returns ``True`` if the role can be selected by members in an onboarding prompt."""
|
||||
return 1 << 0
|
||||
|
Reference in New Issue
Block a user