Browse Source

Oversight in Permissions still having a table.

pull/573/head
Rapptz 8 years ago
parent
commit
bd7b2e2d35
  1. 60
      discord/permissions.py

60
discord/permissions.py

@ -27,42 +27,42 @@ DEALINGS IN THE SOFTWARE.
class Permissions: class Permissions:
"""Wraps up the Discord permission value. """Wraps up the Discord permission value.
Supported operations: The properties provided are two way. You can set and retrieve individual
bits using the properties as if they were regular bools. This allows
you to edit permissions.
+-----------+------------------------------------------+ .. container:: operations
| Operation | Description |
+===========+==========================================+ .. describe:: x == y
| x == y | Checks if two permissions are equal. |
+-----------+------------------------------------------+ Checks if two permissions are equal.
| x != y | Checks if two permissions are not equal. | .. describe:: x != y
+-----------+------------------------------------------+
| x <= y | Checks if a permission is a subset | Checks if two permissions are not equal.
| | of another permission. | .. describe:: x <= y
+-----------+------------------------------------------+
| x >= y | Checks if a permission is a superset | Checks if a permission is a subset of another permission.
| | of another permission. | .. describe:: x >= y
+-----------+------------------------------------------+
| x < y | Checks if a permission is a strict | Checks if a permission is a superset of another permission.
| | subset of another permission. | .. describe:: x < y
+-----------+------------------------------------------+
| x > y | Checks if a permission is a strict | Checks if a permission is a strict subset of another permission.
| | superset of another permission. | .. describe:: x > y
+-----------+------------------------------------------+
| hash(x) | Return the permission's hash. | Checks if a permission is a strict superset of another permission.
+-----------+------------------------------------------+ .. describe:: hash(x)
| iter(x) | Returns an iterator of (perm, value) |
| | pairs. This allows this class to be used | Return the permission's hash.
| | as an iterable in e.g. set/list/dict | .. describe:: iter(x)
| | constructions. |
+-----------+------------------------------------------+
The properties provided are two way. You can set and retrieve individual bits using the properties as if they Returns an iterator of ``(perm, value)`` pairs. This allows it
were regular bools. This allows you to edit permissions. to be, for example, constructed as a dict or a list of pairs.
Attributes Attributes
----------- -----------
value value
The raw value. This value is a bit array field of a 32-bit integer The raw value. This value is a bit array field of a 53-bit integer
representing the currently available permissions. You should query representing the currently available permissions. You should query
permissions via the properties rather than using this raw value. permissions via the properties rather than using this raw value.
""" """

Loading…
Cancel
Save