mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
Update Member.joined_at on MESSAGE_CREATE and document it can be None.
Fixes #1638
This commit is contained in:
@ -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`
|
||||
@ -179,6 +179,16 @@ class Member(discord.abc.Messageable, _BaseUser):
|
||||
def __hash__(self):
|
||||
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__
|
||||
|
Reference in New Issue
Block a user