mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-31 05:23:03 +00:00 
			
		
		
		
	Add Thread.members and Thread.fetch_members
This commit is contained in:
		| @@ -217,6 +217,16 @@ class Thread(Messageable, Hashable): | ||||
|         """:class:`str`: The string that allows you to mention the thread.""" | ||||
|         return f'<#{self.id}>' | ||||
|  | ||||
|     @property | ||||
|     def members(self) -> List[ThreadMember]: | ||||
|         """List[:class:`ThreadMember`]: A list of thread members in this thread. | ||||
|  | ||||
|         This requires :attr:`Intents.members` to be properly filled. Most of the time however, | ||||
|         this data is not provided by the gateway and a call to :meth:`fetch_members` is | ||||
|         needed. | ||||
|         """ | ||||
|         return list(self._members.values()) | ||||
|  | ||||
|     @property | ||||
|     def last_message(self) -> Optional[Message]: | ||||
|         """Fetches the last message from this channel in cache. | ||||
| @@ -636,6 +646,28 @@ class Thread(Messageable, Hashable): | ||||
|         """ | ||||
|         await self._state.http.remove_user_from_thread(self.id, user.id) | ||||
|  | ||||
|     async def fetch_members(self) -> List[ThreadMember]: | ||||
|         """|coro| | ||||
|  | ||||
|         Retrieves all :class:`ThreadMember` that are in this thread. | ||||
|  | ||||
|         This requires :attr:`Intents.members` to get information about members | ||||
|         other than yourself. | ||||
|  | ||||
|         Raises | ||||
|         ------- | ||||
|         HTTPException | ||||
|             Retrieving the members failed. | ||||
|  | ||||
|         Returns | ||||
|         -------- | ||||
|         List[:class:`ThreadMember`] | ||||
|             All thread members in the thread. | ||||
|         """ | ||||
|  | ||||
|         members = await self._state.http.get_thread_members(self.id) | ||||
|         return [ThreadMember(parent=self, data=data) for data in members] | ||||
|  | ||||
|     async def delete(self): | ||||
|         """|coro| | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user