mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-17 03:09:05 +00:00
Update permission class methods to match Discord UI
This commit is contained in:
parent
63ec23bac2
commit
9c52432274
@ -140,35 +140,62 @@ class Permissions(BaseFlags):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def all(cls):
|
def all(cls):
|
||||||
"""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(0b01111111111111111111111111111111)
|
"""
|
||||||
|
return cls(0b11111111111111111111111111111111)
|
||||||
|
|
||||||
@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:
|
||||||
|
- manage_emojis
|
||||||
|
- view_audit_log
|
||||||
|
- view_guild_insights
|
||||||
- manage_guild
|
- manage_guild
|
||||||
|
- change_nickname
|
||||||
|
- manage_nicknames
|
||||||
- kick_members
|
- kick_members
|
||||||
- ban_members
|
- ban_members
|
||||||
- administrator
|
- 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
|
@classmethod
|
||||||
def general(cls):
|
def general(cls):
|
||||||
"""A factory method that creates a :class:`Permissions` with all
|
"""A factory method that creates a :class:`Permissions` with all
|
||||||
"General" permissions from the official Discord UI set to ``True``."""
|
"General" permissions from the official Discord UI set to ``True``.
|
||||||
return cls(0b01111100000010000000000010111111)
|
|
||||||
|
.. 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
|
@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``.
|
||||||
return cls(0b00000000000001111111110001000000)
|
|
||||||
|
.. 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
|
@classmethod
|
||||||
def voice(cls):
|
def voice(cls):
|
||||||
@ -176,6 +203,15 @@ class Permissions(BaseFlags):
|
|||||||
"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 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):
|
def update(self, **kwargs):
|
||||||
r"""Bulk updates this permission object.
|
r"""Bulk updates this permission object.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user