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/invite.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'discord/invite.py') 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.""" -- cgit v1.2.3