@ -147,7 +147,7 @@ class Permissions(BaseFlags):
""" A factory method that creates a :class:`Permissions` with all
permissions set to ` ` True ` ` .
"""
return cls ( 0b11111111111111111111111111111111111111 1)
return cls ( - 1 )
@classmethod
def all_channel ( cls : Type [ P ] ) - > P :
@ -194,8 +194,11 @@ class Permissions(BaseFlags):
" Membership " permissions from the official Discord UI set to ` ` True ` ` .
. . versionadded : : 1.7
. . versionchanged : : 2.0
Added : attr : ` moderate_members ` permission .
"""
return cls ( 0b00001100000000000000000000000111 )
return cls ( 0b100000000 00001100000000000000000000000111 )
@classmethod
def text ( cls : Type [ P ] ) - > P :
@ -215,8 +218,12 @@ class Permissions(BaseFlags):
@classmethod
def voice ( cls : Type [ P ] ) - > P :
""" A factory method that creates a :class:`Permissions` with all
" Voice " permissions from the official Discord UI set to ` ` True ` ` . """
return cls ( 0b00000011111100000000001100000000 )
" Voice " permissions from the official Discord UI set to ` ` True ` ` .
. . versionchanged : : 2.0
Added : attr : ` start_embedded_activities ` permission .
"""
return cls ( 0b1000000000000011111100000000001100000000 )
@classmethod
def stage ( cls : Type [ P ] ) - > P :
@ -551,13 +558,31 @@ class Permissions(BaseFlags):
"""
return 1 << 38
@flag_value
def start_embedded_activities ( self ) - > int :
""" :class:`bool`: Returns ``True`` if a user can launch activities (applications with the :attr:`discord.ApplicationFlags.embedded` flag) in a voice channel.
. . versionadded : : 2.0
"""
return 1 << 39
@flag_value
def moderate_members ( self ) - > int :
""" :class:`bool`: Returns ``True`` if a user can timeout users
( prevent them from sending or reacting to messages , and from connecting to voice / stage channels ) .
. . versionadded : : 2.0
"""
return 1 << 40
PO = TypeVar ( ' PO ' , bound = ' PermissionOverwrite ' )
def _augment_from_permissions ( cls ) :
cls . VALID_NAMES = set ( Permissions . VALID_FLAGS )
aliases = set ( )
# make descriptors for all the valid names and aliases
# M ake descriptors for all the valid names and aliases
for name , value in Permissions . __dict__ . items ( ) :
if isinstance ( value , permission_alias ) :
key = value . alias
@ -567,7 +592,7 @@ def _augment_from_permissions(cls):
else :
continue
# g od bless Python
# G od bless Python
def getter ( self , x = key ) :
return self . _values . get ( x )
@ -664,6 +689,8 @@ class PermissionOverwrite:
send_messages_in_threads : Optional [ bool ]
external_stickers : Optional [ bool ]
use_external_stickers : Optional [ bool ]
start_embedded_activities : Optional [ bool ]
moderate_members : Optional [ bool ]
def __init__ ( self , * * kwargs : Optional [ bool ] ) :
self . _values : Dict [ str , Optional [ bool ] ] = { }