Use a thread values view when constructing TextChannel.threads

Avoids an accidental O(n^2) situation.
This commit is contained in:
Rapptz 2021-08-25 20:42:21 -04:00
parent 2d8f299b6b
commit dd7d4b8e7f

View File

@ -230,7 +230,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
.. versionadded:: 2.0
"""
return [thread for thread in self.guild.threads if thread.parent_id == self.id]
return [thread for thread in self.guild._threads.values() if thread.parent_id == self.id]
def is_nsfw(self) -> bool:
""":class:`bool`: Checks if the channel is NSFW."""