mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
All data classes now support !=, == and str(obj).
This commit is contained in:
@ -26,13 +26,26 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from .user import User
|
||||
from .utils import parse_time
|
||||
from .mixins import EqualityComparable
|
||||
|
||||
class Invite(object):
|
||||
class Invite(EqualityComparable):
|
||||
"""Represents a Discord :class:`Server` or :class:`Channel` invite.
|
||||
|
||||
Depending on the way this object was created, some of the attributes can
|
||||
have a value of ``None``.
|
||||
|
||||
Supported Operations:
|
||||
|
||||
+-----------+--------------------------------------+
|
||||
| Operation | Description |
|
||||
+===========+======================================+
|
||||
| x == y | Checks if two invites are equal. |
|
||||
+-----------+--------------------------------------+
|
||||
| x != y | Checks if two invites are not equal. |
|
||||
+-----------+--------------------------------------+
|
||||
| str(x) | Returns the invite's URL. |
|
||||
+-----------+--------------------------------------+
|
||||
|
||||
Attributes
|
||||
-----------
|
||||
max_age : int
|
||||
@ -75,6 +88,9 @@ class Invite(object):
|
||||
self.inviter = None if inviter_data is None else User(**inviter_data)
|
||||
self.channel = kwargs.get('channel')
|
||||
|
||||
def __str__(self):
|
||||
return self.url
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
"""Returns the proper code portion of the invite."""
|
||||
|
Reference in New Issue
Block a user