mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-29 23:00:08 +00:00
Add ForumChannel.get_thread
This commit is contained in:
parent
799e3c5bf0
commit
039d588447
@ -2204,6 +2204,31 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
|
|||||||
base.value &= ~denied.value
|
base.value &= ~denied.value
|
||||||
return base
|
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
|
@property
|
||||||
def threads(self) -> List[Thread]:
|
def threads(self) -> List[Thread]:
|
||||||
"""List[:class:`Thread`]: Returns all the threads that you can see."""
|
"""List[:class:`Thread`]: Returns all the threads that you can see."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user