Browse Source

Add new use_soundboard and manage_guild_expressions permissions

pull/9319/head
Andrin S 2 years ago
committed by GitHub
parent
commit
e3e0d93dd9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      discord/permissions.py

37
discord/permissions.py

@ -177,7 +177,7 @@ class Permissions(BaseFlags):
"""A factory method that creates a :class:`Permissions` with all
permissions set to ``True``.
"""
return cls(0b11111111111111111111111111111111111111111)
return cls(0b1111111111111111111111111111111111111111111)
@classmethod
def _timeout_mask(cls) -> int:
@ -204,7 +204,7 @@ class Permissions(BaseFlags):
``True`` and the guild-specific ones set to ``False``. The guild-specific
permissions are currently:
- :attr:`manage_emojis`
- :attr:`manage_guild_expressions`
- :attr:`view_audit_log`
- :attr:`view_guild_insights`
- :attr:`manage_guild`
@ -221,8 +221,11 @@ class Permissions(BaseFlags):
Added :attr:`create_public_threads`, :attr:`create_private_threads`, :attr:`manage_threads`,
:attr:`use_external_stickers`, :attr:`send_messages_in_threads` and
:attr:`request_to_speak` permissions.
.. versionchanged:: 2.3
Added :attr:`use_soundboard`
"""
return cls(0b111110110110011111101111111111101010001)
return cls(0b1000111110110110011111101111111111101010001)
@classmethod
def general(cls) -> Self:
@ -265,7 +268,7 @@ class Permissions(BaseFlags):
def voice(cls) -> Self:
"""A factory method that creates a :class:`Permissions` with all
"Voice" permissions from the official Discord UI set to ``True``."""
return cls(0b1000000000000011111100000000001100000000)
return cls(0b1001000000000000011111100000000001100000000)
@classmethod
def stage(cls) -> Self:
@ -305,7 +308,7 @@ class Permissions(BaseFlags):
- :attr:`manage_messages`
- :attr:`manage_roles`
- :attr:`manage_webhooks`
- :attr:`manage_emojis_and_stickers`
- :attr:`manage_guild_expressions`
- :attr:`manage_threads`
- :attr:`moderate_members`
@ -544,13 +547,21 @@ class Permissions(BaseFlags):
return 1 << 29
@flag_value
def manage_guild_expressions(self) -> int:
""":class:`bool`: Returns ``True`` if a user can create, edit, or delete emojis, stickers, and soundboard sounds.
.. versionadded:: 2.3
"""
return 1 << 30
@make_permission_alias('manage_guild_expressions')
def manage_emojis(self) -> int:
""":class:`bool`: Returns ``True`` if a user can create, edit, or delete emojis."""
""":class:`bool`: An alias for :attr:`manage_guild_expressions`."""
return 1 << 30
@make_permission_alias('manage_emojis')
@make_permission_alias('manage_guild_expressions')
def manage_emojis_and_stickers(self) -> int:
""":class:`bool`: An alias for :attr:`manage_emojis`.
""":class:`bool`: An alias for :attr:`manage_guild_expressions`.
.. versionadded:: 2.0
"""
@ -644,6 +655,14 @@ class Permissions(BaseFlags):
"""
return 1 << 40
@flag_value
def use_soundboard(self) -> int:
""":class:`bool`: Returns ``True`` if a user can use the soundboard.
.. versionadded:: 2.3
"""
return 1 << 42
def _augment_from_permissions(cls):
cls.VALID_NAMES = set(Permissions.VALID_FLAGS)
@ -745,6 +764,7 @@ class PermissionOverwrite:
manage_roles: Optional[bool]
manage_permissions: Optional[bool]
manage_webhooks: Optional[bool]
manage_guild_expressions: Optional[bool]
manage_emojis: Optional[bool]
manage_emojis_and_stickers: Optional[bool]
use_application_commands: Optional[bool]
@ -758,6 +778,7 @@ class PermissionOverwrite:
use_external_stickers: Optional[bool]
use_embedded_activities: Optional[bool]
moderate_members: Optional[bool]
use_soundboard: Optional[bool]
def __init__(self, **kwargs: Optional[bool]):
self._values: Dict[str, Optional[bool]] = {}

Loading…
Cancel
Save