diff options
| author | Rapptz <[email protected]> | 2021-05-05 20:55:49 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-06-08 07:26:22 -0400 |
| commit | 4b51e3e253fba8b9e45ab15d6c6d4722f40bc0d6 (patch) | |
| tree | 3f132c86d3660241545ca55ea7d407a6ed98da20 /discord/channel.py | |
| parent | Clarify actions that require manage_threads permission (diff) | |
| download | discord.py-4b51e3e253fba8b9e45ab15d6c6d4722f40bc0d6.tar.xz discord.py-4b51e3e253fba8b9e45ab15d6c6d4722f40bc0d6.zip | |
Add TextChannel.active_threads
Diffstat (limited to 'discord/channel.py')
| -rw-r--r-- | discord/channel.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/discord/channel.py b/discord/channel.py index 058cd3cb..9b1825f9 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -704,6 +704,26 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable): """ return ArchivedThreadIterator(self.id, self.guild, limit=limit, joined=joined, private=private, before=before) + async def active_threads(self) -> List[Thread]: + """|coro| + + Returns a list of active :class:`Thread` that the client can access. + + This includes both private and public threads. + + Raises + ------ + HTTPException + The request to get the active threads failed. + + Returns + -------- + List[:class:`Thread`] + The archived threads + """ + data = await self._state.http.get_active_threads(self.id) + # TODO: thread members? + return [Thread(guild=self.guild, data=d) for d in data.get('threads', [])] class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable): __slots__ = ('name', 'id', 'guild', 'bitrate', 'user_limit', |