mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 19:03:03 +00:00
All data classes now support !=, == and str(obj).
This commit is contained in:
@ -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')
|
||||
|
Reference in New Issue
Block a user