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/role.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'discord/role.py') diff --git a/discord/role.py b/discord/role.py index 760a0bce..93d8e3b5 100644 --- a/discord/role.py +++ b/discord/role.py @@ -26,10 +26,23 @@ DEALINGS IN THE SOFTWARE. from .permissions import Permissions from .colour import Colour +from .mixins import EqualityComparable -class Role(object): +class Role(EqualityComparable): """Represents a Discord role in a :class:`Server`. + Supported Operations: + + +-----------+------------------------------------+ + | Operation | Description | + +===========+====================================+ + | x == y | Checks if two roles are equal. | + +-----------+------------------------------------+ + | x != y | Checks if two roles are not equal. | + +-----------+------------------------------------+ + | str(x) | Returns the role's name. | + +-----------+------------------------------------+ + Attributes ---------- id : str @@ -53,6 +66,9 @@ class Role(object): self._is_everyone = kwargs.get('everyone', False) self.update(**kwargs) + def __str__(self): + return self.name + def update(self, **kwargs): self.id = kwargs.get('id') self.name = kwargs.get('name') -- cgit v1.2.3