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