Make __repr__ slightly more detailed and add a few missing ones.

This includes raw events (which didn't have any) and a few other
types that were missing them. Upon review some more useful fields were
added to the repr output which would be more useful during debugging.
This commit is contained in:
Rapptz committed 2019-05-26 02:32:47 -04:00
1 parent ab6dd2a27a
commit 2cd6d771ec
9 files changed
+65 -15

No files matched your search

+6 -1
View File
@@ -160,7 +160,12 @@ class Guild(Hashable):
return self.name
def __repr__(self):
return '<Guild id={0.id} name={0.name!r} chunked={0.chunked}>'.format(self)
attrs = (
'id', 'name', 'shard_id', 'chunked'
)
resolved = ['%s=%r' % (attr, getattr(self, attr)) for attr in attrs]
resolved.append('member_count=%r' % getattr(self, '_member_count', None))
return '<Guild %s>' % ' '.join(resolved)
def _update_voice_state(self, data, channel_id):
user_id = int(data['user_id'])