Add get/fetch_member to ThreadMember objects
This commit is contained in:
parent
6bcc717e63
commit
693fee979e
@ -800,3 +800,39 @@ class ThreadMember(Hashable):
|
|||||||
def thread(self) -> Thread:
|
def thread(self) -> Thread:
|
||||||
""":class:`Thread`: The thread this member belongs to."""
|
""":class:`Thread`: The thread this member belongs to."""
|
||||||
return self.parent
|
return self.parent
|
||||||
|
|
||||||
|
async def fetch_member(self) -> Member:
|
||||||
|
"""|coro|
|
||||||
|
|
||||||
|
Retrieves a :class:`Member` from the ThreadMember object.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This method is an API call. If you have :attr:`Intents.members` and member cache enabled, consider :meth:`get_member` instead.
|
||||||
|
|
||||||
|
Raises
|
||||||
|
-------
|
||||||
|
Forbidden
|
||||||
|
You do not have access to the guild.
|
||||||
|
HTTPException
|
||||||
|
Fetching the member failed.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
--------
|
||||||
|
:class:`Member`
|
||||||
|
The member.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return await self.thread.guild.fetch_member(self.id)
|
||||||
|
|
||||||
|
def get_member(self) -> Optional[Member]:
|
||||||
|
"""
|
||||||
|
Get the :class:`Member` from cache for the ThreadMember object.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
--------
|
||||||
|
Optional[:class:`Member`]
|
||||||
|
The member or ``None`` if not found.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return await self.thread.guild.get_member(self.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user