aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
Diffstat (limited to 'discord')
-rw-r--r--discord/client.py1
-rw-r--r--discord/integrations.py9
-rw-r--r--discord/invite.py15
-rw-r--r--discord/widget.py14
4 files changed, 28 insertions, 11 deletions
diff --git a/discord/client.py b/discord/client.py
index 59be489a..f0c1fee6 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE.
"""
import asyncio
-from collections import namedtuple
import logging
import signal
import sys
diff --git a/discord/integrations.py b/discord/integrations.py
index 91b39d0d..37fda5e9 100644
--- a/discord/integrations.py
+++ b/discord/integrations.py
@@ -25,13 +25,12 @@ DEALINGS IN THE SOFTWARE.
"""
import datetime
-from collections import namedtuple
from .utils import _get_as_snowflake, get, parse_time
from .user import User
from .errors import InvalidArgument
from .enums import try_enum, ExpireBehaviour
-class IntegrationAccount(namedtuple('IntegrationAccount', 'id name')):
+class IntegrationAccount:
"""Represents an integration account.
.. versionadded:: 1.4
@@ -44,7 +43,11 @@ class IntegrationAccount(namedtuple('IntegrationAccount', 'id name')):
The account name.
"""
- __slots__ = ()
+ __slots__ = ('id', 'name')
+
+ def __init__(self, **kwargs):
+ self.id = kwargs.pop('id')
+ self.name = kwargs.pop('name')
def __repr__(self):
return '<IntegrationAccount id={0.id} name={0.name!r}>'.format(self)
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.
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."""