PermissionOverwrite

Represents a permission overwrite of a guild channel.

Attributes

allow : Permission

The allowed permissions by the overwrite.

deny : Permission

The denied permission by the overwrite.

target_id : int

The permission overwrites target's identifier.

The permission overwrite's target's type.

Properties

target

Returns the target entity of the overwrite.

Returns

target : ClientUserBase, Role, None

Methods

__new__(target_id, ...)

Creates a new permission overwrite from the given parameters.

ParameterTypeOptionalKeyword onlyDefaultDescription
target_id

int, Role, ClientUserBase

The permission overwrite's target.

target_type

None, PermissionOverwriteTargetType

None

The permission overwrite's target's type. Required if target_id is given as a snowflake.

allow

None, Permission, int

None

The permission overwrite's allowed permission's value.

deny

None, Permission, int

None

The permission overwrite's denied permission's value.

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

copy()

Copies the permission overwrite.

Returns

new : instance<cls<self>>

copy_with(...)

Copies the permission overwrite modifying the given values.

ParameterTypeOptionalKeyword onlyDescription
**keyword_parameters

Keyword parameters

The specified fields to change.

from_data(data)

Creates a permission overwrite from the given data received from Discord.

ParameterTypeDescription
data

dict of (str, object) items

Received permission overwrite data.

Returns

self : PermissionOverwrite

items()

Yields the permission overwrite's items. What includes their name and their state. As state +1 is yielded if the permission is enabled, -1 if disabled and 0 if neither.

This method is a generator.

Yields

name : str

Permissions' respective name.

state : int

The permission's state.

Can be one of the following:

NameValue
Enabled+1
None0
Disabled-1

keys()

Yields the permissions' names.

This method is an iterable generator.

Yields

name : str

Permissions' respective name.

to_data(...)

Converts the permission overwrite to a json serializable object.

ParameterTypeOptionalKeyword onlyDefaultDescription
defaults

bool

False

Whether default fields should be included as well.

This parameter has no effect on any fields.

include_internals

bool

False

Whether internal fields (like id-s) should be included.

Returns

data : dict of (str, object) items

values()

Yields position by position each permission's state. +1 is yielded if the permission is enabled, -1 if disabled and 0 if neither.

This method is a generator.

Yields

state : int

The permission's state.

Can be one of the following:

NameValue
Enabled+1
None0
Disabled-1

__eq__()

Returns whether is this permission overwrite is same as the other.

__getattr__()

Drops a rich attribute error.

__getitem__()

Returns the permission's state for the given permission name.

__gt__()

Returns whether is this permission overwrite is at greater position in ordering than the order.

__hash__()

Returns the permission overwrite's hash.

__lt__()

Returns whether is this permission overwrite is at lower position in ordering than the order.

__repr__()

Returns the permission overwrite's representation.