aboutsummaryrefslogtreecommitdiff
path: root/discord/widget.py
diff options
context:
space:
mode:
authorTarek <[email protected]>2020-09-21 09:36:58 +0200
committerGitHub <[email protected]>2020-09-21 03:36:58 -0400
commit7f17dc79a6e2dece4a8e37b8c3ac18bfe3b1d49d (patch)
tree87c85d078110d4c0c8a8937f0f6a6637fb169273 /discord/widget.py
parentAdd bot.listen() suggestion to on_message faq (diff)
downloaddiscord.py-7f17dc79a6e2dece4a8e37b8c3ac18bfe3b1d49d.tar.xz
discord.py-7f17dc79a6e2dece4a8e37b8c3ac18bfe3b1d49d.zip
Remove namedtuples to better future guard the library
Diffstat (limited to 'discord/widget.py')
-rw-r--r--discord/widget.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/discord/widget.py b/discord/widget.py
index 291b70ef..0fcf7ec0 100644
--- a/discord/widget.py
+++ b/discord/widget.py
@@ -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."""