diff options
| author | Benjamin Mintz <[email protected]> | 2019-05-13 20:06:57 +0000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-05-13 20:29:08 -0400 |
| commit | a62641bd65a651f5c9fb79ad23b67b2f96262cfe (patch) | |
| tree | d2bab94fbc5f780bf02f6ff5458dcdb18107b210 | |
| parent | [tasks] Return coro from before and after decorators (diff) | |
| download | discord.py-a62641bd65a651f5c9fb79ad23b67b2f96262cfe.tar.xz discord.py-a62641bd65a651f5c9fb79ad23b67b2f96262cfe.zip | |
Add back __repr__ that were deleted in the Asset redesign
The Asset PR (be227ebcf0c8bad6b56798339b5414b8da414dc0) changed some namedtuple-deriving
classes to object-deriving classes, which meant that the free __repr__ provided by namedtuple
was removed
| -rw-r--r-- | discord/appinfo.py | 4 | ||||
| -rw-r--r-- | discord/emoji.py | 3 | ||||
| -rw-r--r-- | discord/invite.py | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/discord/appinfo.py b/discord/appinfo.py index 744517ee..f38f40b9 100644 --- a/discord/appinfo.py +++ b/discord/appinfo.py @@ -68,6 +68,10 @@ class AppInfo: self.bot_require_code_grant = data['bot_require_code_grant'] self.owner = User(state=self._state, data=data['owner']) + def __repr__(self): + return '<{0.__class__.__name__} id={0.id} name={0.name!r} description={0.description!r} public={0.bot_public} ' \ + 'owner={0.owner!r}>'.format(self) + @property def icon_url(self): """:class:`.Asset`: Retrieves the application's icon asset.""" diff --git a/discord/emoji.py b/discord/emoji.py index 492d29ea..ff43d1b5 100644 --- a/discord/emoji.py +++ b/discord/emoji.py @@ -86,6 +86,9 @@ class PartialEmoji: return '<a:%s:%s>' % (self.name, self.id) return '<:%s:%s>' % (self.name, self.id) + def __repr__(self): + return '<{0.__class__.__name__} animated={0.animated} name={0.name!r} id={0.id}>'.format(self) + def __eq__(self, other): if self.is_unicode_emoji(): return isinstance(other, PartialEmoji) and self.name == other.name diff --git a/discord/invite.py b/discord/invite.py index e79eb895..d378c3d7 100644 --- a/discord/invite.py +++ b/discord/invite.py @@ -140,6 +140,10 @@ class PartialInviteGuild: def __str__(self): return self.name + def __repr__(self): + return '<{0.__class__.__name__} id={0.id} name={0.name!r} features={0.features} ' \ + 'description={0.description!r}>'.format(self) + @property def created_at(self): """Returns the guild's creation time in UTC.""" |