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/invite.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/invite.py')
| -rw-r--r-- | discord/invite.py | 18 |
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.""" |