diff --git a/discord/member.py b/discord/member.py index 266e15dd8..d78710666 100644 --- a/discord/member.py +++ b/discord/member.py @@ -189,11 +189,7 @@ class Member(discord.abc.Messageable, _BaseUser): @classmethod def _from_message(cls, *, message, data): author = message.author - data['user'] = { - attr: getattr(author, attr) - for attr in author.__slots__ - if attr[0] != '_' - } + data['user'] = author._to_minimal_user_json() return cls(data=data, guild=message.guild, state=message._state) @classmethod diff --git a/discord/message.py b/discord/message.py index b283ee3f0..3d7e5a0ba 100644 --- a/discord/message.py +++ b/discord/message.py @@ -403,9 +403,12 @@ class Message: # ourselves to a more "partial" member object. author = self.author try: + # Update member reference if author.joined_at is None: author.joined_at = utils.parse_time(member.get('joined_at')) except AttributeError: + # It's a user here + # TODO: consider adding to cache here self.author = Member._from_message(message=self, data=member) def _handle_mentions(self, mentions): diff --git a/discord/user.py b/discord/user.py index b567913f8..7970f5283 100644 --- a/discord/user.py +++ b/discord/user.py @@ -112,6 +112,15 @@ class BaseUser(_BaseUser): return self + def _to_minimal_user_json(self): + return { + 'name': self.name, + 'id': self.id, + 'avatar': self.avatar, + 'discriminator': self.discriminator, + 'bot': self.bot, + } + @property def avatar_url(self): """Returns an :class:`Asset` for the avatar the user has.