1
0
mirror of https://github.com/Rapptz/discord.py.git synced 2025-05-15 02:09:49 +00:00

Add ForumChannel.get_thread

This commit is contained in:
rdrescher909 2022-12-14 19:06:37 -05:00 committed by GitHub
parent 799e3c5bf0
commit 039d588447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2204,6 +2204,31 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
base.value &= ~denied.value
return base
def get_thread(self, thread_id: int, /) -> Optional[Thread]:
"""Returns a thread with the given ID.
.. note::
This does not always retrieve archived threads, as they are not retained in the internal
cache. Use :func:`Guild.fetch_channel` instead.
.. versionadded:: 2.2
Parameters
-----------
thread_id: :class:`int`
The ID to search for.
Returns
--------
Optional[:class:`Thread`]
The returned thread or ``None`` if not found.
"""
thread = self.guild.get_thread(thread_id)
if thread is not None and thread.parent_id == self.id:
return thread
return None
@property
def threads(self) -> List[Thread]:
"""List[:class:`Thread`]: Returns all the threads that you can see."""