Browse Source

Add ForumChannel.get_thread

pull/9141/head
rdrescher909 2 years ago
committed by GitHub
parent
commit
039d588447
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      discord/channel.py

25
discord/channel.py

@ -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."""

Loading…
Cancel
Save