diff options
| author | TheOneMusic <[email protected]> | 2021-03-01 05:30:08 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-28 23:30:08 -0500 |
| commit | 9c52432274bdb0907a909a4031ecb6f04eaa016f (patch) | |
| tree | e882c1f82657d14be10d6583121250c183bf6829 /discord/permissions.py | |
| parent | Code optimisations and refactoring via Sourcery (diff) | |
| download | discord.py-9c52432274bdb0907a909a4031ecb6f04eaa016f.tar.xz discord.py-9c52432274bdb0907a909a4031ecb6f04eaa016f.zip | |
Update permission class methods to match Discord UI
Diffstat (limited to 'discord/permissions.py')
| -rw-r--r-- | discord/permissions.py | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/discord/permissions.py b/discord/permissions.py index 68d2a496..10435e13 100644 --- a/discord/permissions.py +++ b/discord/permissions.py @@ -140,41 +140,77 @@ class Permissions(BaseFlags): @classmethod def all(cls): """A factory method that creates a :class:`Permissions` with all - permissions set to ``True``.""" - return cls(0b01111111111111111111111111111111) + permissions set to ``True``. + """ + return cls(0b11111111111111111111111111111111) @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: - + - manage_emojis + - view_audit_log + - view_guild_insights - manage_guild + - change_nickname + - manage_nicknames - kick_members - ban_members - administrator - - change_nickname - - manage_nicknames + + .. versionchanged:: 1.7 + Added :attr:`stream`, :attr:`priority_speaker` and :attr:`use_slash_commands` permissions. """ - return cls(0b00110011111101111111110001010001) + return cls(0b10110011111101111111111101010001) @classmethod def general(cls): """A factory method that creates a :class:`Permissions` with all - "General" permissions from the official Discord UI set to ``True``.""" - return cls(0b01111100000010000000000010111111) - + "General" permissions from the official Discord UI set to ``True``. + + .. versionchanged:: 1.7 + Permission :attr:`read_messages` is now included in the general permissions, but + permissions :attr:`administrator`, :attr:`create_instant_invite`, :attr:`kick_members`, + :attr:`ban_members`, :attr:`change_nickname` and :attr:`manage_nicknames` are + no longer part of the general permissions. + """ + return cls(0b01110000000010000000010010110000) + + @classmethod + def membership(cls): + """A factory method that creates a :class:`Permissions` with all + "Membership" permissions from the official Discord UI set to ``True``. + + .. 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``.""" - return cls(0b00000000000001111111110001000000) + "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. + Added :attr:`use_slash_commands` permission. + """ + return cls(0b10000000000001111111100001000000) @classmethod def voice(cls): """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 advanced(cls): + """A factory method that creates a :class:`Permissions` with all + "Advanced" permissions from the official Discord UI set to ``True``. + + .. versionadded: 1.7 + """ + return cls(1 << 3) def update(self, **kwargs): |