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/role.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/role.py')
| -rw-r--r-- | discord/role.py | 18 |
1 files changed, 17 insertions, 1 deletions
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') |