diff options
| author | Rapptz <[email protected]> | 2015-12-13 22:53:48 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-13 22:53:48 -0500 |
| commit | 9137d92f67a6d50782e199ca6d6558c1ea6015e2 (patch) | |
| tree | d900865b68c18ad1712de4d6d6914f93c43bb7bf /discord/permissions.py | |
| parent | Changed functions that return a constant value into properties. (diff) | |
| download | discord.py-9137d92f67a6d50782e199ca6d6558c1ea6015e2.tar.xz discord.py-9137d92f67a6d50782e199ca6d6558c1ea6015e2.zip | |
All data classes now support !=, == and str(obj).
Diffstat (limited to 'discord/permissions.py')
| -rw-r--r-- | discord/permissions.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/discord/permissions.py b/discord/permissions.py index 5f826a1f..079bb464 100644 --- a/discord/permissions.py +++ b/discord/permissions.py @@ -37,6 +37,16 @@ def create_permission_masks(cls): class Permissions(object): """Wraps up the Discord permission value. + Supported operations: + + +-----------+------------------------------------------+ + | Operation | Description | + +===========+==========================================+ + | x == y | Checks if two permissions are equal. | + +-----------+------------------------------------------+ + | x != y | Checks if two permissions are not equal. | + +-----------+------------------------------------------+ + Class attributes: .. attribute:: NONE @@ -80,6 +90,12 @@ class Permissions(object): def __init__(self, permissions=0, **kwargs): self.value = permissions + def __eq__(self, other): + return isinstance(other, Permissions) and self.value == other.value + + def __ne__(self, other): + return not self.__eq__(other) + @classmethod def none(cls): """A factory method that creates a :class:`Permission` with all |