PermissionOverwrite
Represents a permission overwrite of a guild channel.
Attributes allow :
The allowed permissions by the overwrite.
The denied permission by the overwrite.
int
The permission overwrites target's identifier.
The permission overwrite's target's type.
Properties
target
Methods
(target_id, ...)
__new__Creates a new permission overwrite from the given parameters.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
target_id |
| The permission overwrite's target. | |||
target_type |
| The permission overwrite's target's type. Required if | |||
allow |
|
| The permission overwrite's allowed permission's value. | ||
deny |
|
| 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.
()
copyCopies the permission overwrite.
Returns
new : instance<cls<self>>
(...)
copy_withCopies the permission overwrite modifying the given values.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
**keyword_parameters | Keyword parameters | The specified fields to change. |
(data)
from_dataCreates a permission overwrite from the given data received from Discord.
Parameter | Type | Description |
---|---|---|
data |
| Received permission overwrite data. |
Returns
self : PermissionOverwrite
()
itemsYields 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:
Name | Value |
---|---|
Enabled | +1 |
None | 0 |
Disabled | -1 |
()
keysYields the permissions' names.
This method is an iterable generator.
Yields
name : str
Permissions' respective name.
(...)
to_dataConverts the permission overwrite to a json serializable object.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
defaults |
|
| Whether default fields should be included as well.
| ||
include_internals |
|
| Whether internal fields (like id-s) should be included. |
Returns
data : dict
of (str
, object
) items
()
valuesYields 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:
Name | Value |
---|---|
Enabled | +1 |
None | 0 |
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.