curious.dataclasses.permissions¶
Wrappers for Permission objects.
This class uses some automatic generation to create the objects.
Functions
build_permissions_class([name]) |
Builds the permissions class automagically. |
Classes
Overwrite(allow, …) |
Represents a permission overwrite. |
Permissions(value, **kwargs) |
Represents the permissions a user can have. |
-
curious.dataclasses.permissions.build_permissions_class(name='Permissions')[source]¶ Builds the permissions class automagically. This should *not* be used by normal user code - it is designed for internal usage by curious.
Parameters: name ( str) – The name of the class.Return type: typeReturns: A new type representing the permissions class.
-
class
curious.dataclasses.permissions.Permissions(value: int = 0, **kwargs)¶ Bases:
objectRepresents the permissions a user can have. This type is automatically generated based upon a set of constant permission bits.
Every permission is accessible via a property getter and setter. The raw permissions value is accessible via
bitfield.Creates a new Permissions object.
Parameters: value ( int) – The bitfield value of the permissions object.-
classmethod
all()¶ Returns: A new Permissions object with all permissions.
-
change_nickname¶ Return type: boolReturns: If this member has the change_nickname permission (bit 26).
-
create_instant_invite¶ Return type: boolReturns: If this member has the create_instant_invite permission (bit 0).
-
manage_channels¶ Return type: boolReturns: If this member has the manage_channels permission (bit 4).
-
manage_messages¶ Return type: boolReturns: If this member has the manage_messages permission (bit 13).
-
manage_nicknames¶ Return type: boolReturns: If this member has the manage_nicknames permission (bit 27).
-
manage_webhooks¶ Return type: boolReturns: If this member has the manage_webhooks permission (bit 29).
-
mention_everyone¶ Return type: boolReturns: If this member has the mention_everyone permission (bit 17).
-
classmethod
none()¶ Returns: A new permissions object with no permissions.
-
raise_for_permission(permission)¶ Raises
PermissionsErrorif this permission does not have the required bit.Return type: None
-
read_message_history¶ Return type: boolReturns: If this member has the read_message_history permission (bit 16).
-
send_tts_messages¶ Return type: boolReturns: If this member has the send_tts_messages permission (bit 12).
-
use_external_emojis¶ Return type: boolReturns: If this member has the use_external_emojis permission (bit 18).
-
voice_deafen_members¶ Return type: boolReturns: If this member has the voice_deafen_members permission (bit 23).
-
voice_move_members¶ Return type: boolReturns: If this member has the voice_move_members permission (bit 24).
-
classmethod
-
class
curious.dataclasses.permissions.Overwrite(allow: typing.Union[int, curious.dataclasses.permissions.Permissions], deny: typing.Union[int, curious.dataclasses.permissions.Permissions], obb: typing.Union[curious.dataclasses.member.Member, curious.dataclasses.role.Role], channel_id: int = None)[source]¶ Bases:
objectRepresents a permission overwrite.
This has all properties that the base Permissions object, but it takes into accounts the overwrites for the channels. It is always recommended to use this over the server permissions, as it will fall back to the default permissions for the role if it can’t find specific overwrites.
The overwrite has a permission marked as
Trueif the object has a) an overwrite on the channel OR b) the object has that permission and no overwrite. The overwrite is marked asFalseif the object has a) an overwrite on the channel OR b) the object does not have that permission and no overwrite/a deny overwrite.You can set an attribute to None to clear the overwrite, True to set an allow overwrite, and False to set a deny overwrite.
Warning
You probably don’t want to create an instance of this class directly - instead, use
Overwrite.overwrite_in(channel, target)().Parameters: - allow (
Union[int,Permissions]) – APermissionsthat this overwrite allows. - deny (
Union[int,Permissions]) – APermissionsthat this overwrite denies. - obb (
Union[Member,Role]) – Optional: TheMemberorRolethat this overwrite is for. - channel_id (
Optional[int]) – Optional: The channel ID this overwrite is in.
- allow (