Add useful repr to all data classes.

This commit is contained in:
Rapptz
2016-12-30 04:34:42 -05:00
parent ec6c7f8b34
commit dceba9d962
12 changed files with 48 additions and 1 deletions

View File

@ -123,6 +123,9 @@ class Message:
self.reactions = [Reaction(message=self, data=d) for d in data.get('reactions', [])]
self._update(channel, data)
def __repr__(self):
return '<Message id={0.id} pinned={0.pinned} author={0.author!r}>'.format(self)
def _try_patch(self, data, key, transform):
try:
value = data[key]