Remove namedtuples to better future guard the library

This commit is contained in:
Tarek
2020-09-21 09:36:58 +02:00
committed by GitHub
parent e7b4bbe2f6
commit 7f17dc79a6
4 changed files with 28 additions and 11 deletions

View File

@ -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.