Browse Source

Add support for Permissions.request_to_speak

pull/6607/head
Rapptz 4 years ago
parent
commit
3576e2ee01
  1. 29
      discord/permissions.py

29
discord/permissions.py

@ -142,14 +142,14 @@ class Permissions(BaseFlags):
"""A factory method that creates a :class:`Permissions` with all """A factory method that creates a :class:`Permissions` with all
permissions set to ``True``. permissions set to ``True``.
""" """
return cls(0b11111111111111111111111111111111) return cls(0b111111111111111111111111111111111)
@classmethod @classmethod
def all_channel(cls): def all_channel(cls):
"""A :class:`Permissions` with all channel-specific permissions set to """A :class:`Permissions` with all channel-specific permissions set to
``True`` and the guild-specific ones set to ``False``. The guild-specific ``True`` and the guild-specific ones set to ``False``. The guild-specific
permissions are currently: permissions are currently:
- :attr:`manage_emojis` - :attr:`manage_emojis`
- :attr:`view_audit_log` - :attr:`view_audit_log`
- :attr:`view_guild_insights` - :attr:`view_guild_insights`
@ -177,7 +177,7 @@ class Permissions(BaseFlags):
no longer part of the general permissions. no longer part of the general permissions.
""" """
return cls(0b01110000000010000000010010110000) return cls(0b01110000000010000000010010110000)
@classmethod @classmethod
def membership(cls): def membership(cls):
"""A factory method that creates a :class:`Permissions` with all """A factory method that creates a :class:`Permissions` with all
@ -186,14 +186,14 @@ class Permissions(BaseFlags):
.. versionadded:: 1.7 .. versionadded:: 1.7
""" """
return cls(0b00001100000000000000000000000111) return cls(0b00001100000000000000000000000111)
@classmethod @classmethod
def text(cls): def text(cls):
"""A factory method that creates a :class:`Permissions` with all """A factory method that creates a :class:`Permissions` with all
"Text" permissions from the official Discord UI set to ``True``. "Text" permissions from the official Discord UI set to ``True``.
.. versionchanged:: 1.7 .. versionchanged:: 1.7
Permission :attr:`read_messages` is no longer part of the text permissions. Permission :attr:`read_messages` is no longer part of the text permissions.
Added :attr:`use_slash_commands` permission. Added :attr:`use_slash_commands` permission.
""" """
return cls(0b10000000000001111111100001000000) return cls(0b10000000000001111111100001000000)
@ -203,7 +203,16 @@ class Permissions(BaseFlags):
"""A factory method that creates a :class:`Permissions` with all """A factory method that creates a :class:`Permissions` with all
"Voice" permissions from the official Discord UI set to ``True``.""" "Voice" permissions from the official Discord UI set to ``True``."""
return cls(0b00000011111100000000001100000000) return cls(0b00000011111100000000001100000000)
@classmethod
def stage(cls):
"""A factory method that creates a :class:`Permissions` with all
"Stage Channel" permissions from the official Discord UI set to ``True``.
.. versionadded:: 1.7
"""
return cls(1 << 32)
@classmethod @classmethod
def advanced(cls): def advanced(cls):
"""A factory method that creates a :class:`Permissions` with all """A factory method that creates a :class:`Permissions` with all
@ -448,6 +457,14 @@ class Permissions(BaseFlags):
""" """
return 1 << 31 return 1 << 31
@flag_value
def request_to_speak(self):
""":class:`bool`: Returns ``True`` if a user can request to speak in a stage channel.
.. versionadded:: 1.7
"""
return 1 << 32
def augment_from_permissions(cls): def augment_from_permissions(cls):
cls.VALID_NAMES = set(Permissions.VALID_FLAGS) cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
aliases = set() aliases = set()

Loading…
Cancel
Save