aboutsummaryrefslogtreecommitdiff
path: root/discord/invite.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/invite.py')
-rw-r--r--discord/invite.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/discord/invite.py b/discord/invite.py
index 5b59e20a..bc1ae3fb 100644
--- a/discord/invite.py
+++ b/discord/invite.py
@@ -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."""