From 9137d92f67a6d50782e199ca6d6558c1ea6015e2 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 13 Dec 2015 22:53:48 -0500 Subject: All data classes now support !=, == and str(obj). --- discord/permissions.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'discord/permissions.py') 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 -- cgit v1.2.3