diff options
| author | Rapptz <[email protected]> | 2019-02-27 06:23:08 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-02-27 06:23:08 -0500 |
| commit | 7240d170c1bfe9851faaa2d17f00e6bc195108b3 (patch) | |
| tree | c927877dffb4edcad7496422cdb2db4c1ea128d0 /discord/member.py | |
| parent | [commands] Add support for stacking Cog.listener decorator. (diff) | |
| download | discord.py-7240d170c1bfe9851faaa2d17f00e6bc195108b3.tar.xz discord.py-7240d170c1bfe9851faaa2d17f00e6bc195108b3.zip | |
Update Member.joined_at on MESSAGE_CREATE and document it can be None.
Fixes #1638
Diffstat (limited to 'discord/member.py')
| -rw-r--r-- | discord/member.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/discord/member.py b/discord/member.py index 1c0b19df..57de6d22 100644 --- a/discord/member.py +++ b/discord/member.py @@ -138,9 +138,9 @@ class Member(discord.abc.Messageable, _BaseUser): Attributes ---------- - joined_at: `datetime.datetime` + joined_at: Optional[:class:`datetime.datetime`] A datetime object that specifies the date and time in UTC that the member joined the guild for - the first time. + the first time. In certain cases, this can be ``None``. activities: Tuple[Union[:class:`Game`, :class:`Streaming`, :class:`Spotify`, :class:`Activity`]] The activities that the user is currently doing. guild: :class:`Guild` @@ -180,6 +180,16 @@ class Member(discord.abc.Messageable, _BaseUser): return hash(self._user) @classmethod + def _from_message(cls, *, message, data): + author = message.author + data['user'] = { + attr: getattr(author, attr) + for attr in author.__slots__ + if attr[0] != '_' + } + return cls(data=data, guild=message.guild, state=message._state) + + @classmethod def _copy(cls, member): self = cls.__new__(cls) # to bypass __init__ |