From 3576e2ee01d9e9849ca56f101b210fc667ff75ea Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 1 Apr 2021 00:52:21 -0400 Subject: [PATCH] Add support for Permissions.request_to_speak --- discord/permissions.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/discord/permissions.py b/discord/permissions.py index 05b6d5110..1b0dd5a2d 100644 --- a/discord/permissions.py +++ b/discord/permissions.py @@ -142,14 +142,14 @@ class Permissions(BaseFlags): """A factory method that creates a :class:`Permissions` with all permissions set to ``True``. """ - return cls(0b11111111111111111111111111111111) + return cls(0b111111111111111111111111111111111) @classmethod def all_channel(cls): """A :class:`Permissions` with all channel-specific permissions set to ``True`` and the guild-specific ones set to ``False``. The guild-specific permissions are currently: - + - :attr:`manage_emojis` - :attr:`view_audit_log` - :attr:`view_guild_insights` @@ -177,7 +177,7 @@ class Permissions(BaseFlags): no longer part of the general permissions. """ return cls(0b01110000000010000000010010110000) - + @classmethod def membership(cls): """A factory method that creates a :class:`Permissions` with all @@ -186,14 +186,14 @@ class Permissions(BaseFlags): .. versionadded:: 1.7 """ return cls(0b00001100000000000000000000000111) - + @classmethod def text(cls): """A factory method that creates a :class:`Permissions` with all "Text" permissions from the official Discord UI set to ``True``. .. 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. """ return cls(0b10000000000001111111100001000000) @@ -203,7 +203,16 @@ class Permissions(BaseFlags): """A factory method that creates a :class:`Permissions` with all "Voice" permissions from the official Discord UI set to ``True``.""" 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 def advanced(cls): """A factory method that creates a :class:`Permissions` with all @@ -448,6 +457,14 @@ class Permissions(BaseFlags): """ 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): cls.VALID_NAMES = set(Permissions.VALID_FLAGS) aliases = set()