diff options
| author | Tarek <[email protected]> | 2020-09-21 09:36:58 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-09-21 03:36:58 -0400 |
| commit | 7f17dc79a6e2dece4a8e37b8c3ac18bfe3b1d49d (patch) | |
| tree | 87c85d078110d4c0c8a8937f0f6a6637fb169273 /discord/invite.py | |
| parent | Add bot.listen() suggestion to on_message faq (diff) | |
| download | discord.py-7f17dc79a6e2dece4a8e37b8c3ac18bfe3b1d49d.tar.xz discord.py-7f17dc79a6e2dece4a8e37b8c3ac18bfe3b1d49d.zip | |
Remove namedtuples to better future guard the library
Diffstat (limited to 'discord/invite.py')
| -rw-r--r-- | discord/invite.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/discord/invite.py b/discord/invite.py index e8049169..2f7c273d 100644 --- a/discord/invite.py +++ b/discord/invite.py @@ -29,9 +29,8 @@ from .utils import parse_time, snowflake_time, _get_as_snowflake from .object import Object from .mixins import Hashable from .enums import ChannelType, VerificationLevel, try_enum -from collections import namedtuple -class PartialInviteChannel(namedtuple('PartialInviteChannel', 'id name type')): +class PartialInviteChannel: """Represents a "partial" invite channel. This model will be given when the user is not part of the @@ -65,11 +64,19 @@ class PartialInviteChannel(namedtuple('PartialInviteChannel', 'id name type')): The partial channel's type. """ - __slots__ = () + __slots__ = ('id', 'name', 'type') + + def __init__(self, **kwargs): + self.id = kwargs.pop('id') + self.name = kwargs.pop('name') + self.type = kwargs.pop('type') def __str__(self): return self.name + def __repr__(self): + return '<PartialInviteChannel id={0.id} name={0.name} type={0.type!r}>'.format(self) + @property def mention(self): """:class:`str`: The string that allows you to mention the channel.""" @@ -154,7 +161,7 @@ class PartialInviteGuild: def icon_url(self): """:class:`Asset`: Returns the guild's icon asset.""" return self.icon_url_as() - + def is_icon_animated(self): """:class:`bool`: Returns ``True`` if the guild has an animated icon. |