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 .user import BaseUser
from .activity import create_activity
from .invite import Invite
from .enums import Status, try_enum
from collections import namedtuple
class WidgetChannel(namedtuple('WidgetChannel', 'id name position')):
class WidgetChannel:
"""Represents a "partial" widget channel.
.. container:: operations
@ -61,11 +60,20 @@ class WidgetChannel(namedtuple('WidgetChannel', 'id name position')):
position: :class:`int`
The channel's position
"""
__slots__ = ()
__slots__ = ('id', 'name', 'position')
def __init__(self, **kwargs):
self.id = kwargs.pop('id')
self.name = kwargs.pop('name')
self.position = kwargs.pop('position')
def __str__(self):
return self.name
def __repr__(self):
return '<WidgetChannel id={0.id} name={0.name!r} position={0.position!r}>'.format(self)
@property
def mention(self):
""":class:`str`: The string that allows you to mention the channel."""