Fix Client.fetch_channel not returning Thread
This commit is contained in:
@@ -691,7 +691,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
type=ChannelType.public_thread.value,
|
||||
)
|
||||
|
||||
return Thread(guild=self.guild, data=data)
|
||||
return Thread(guild=self.guild, state=self._state, data=data)
|
||||
|
||||
def archived_threads(
|
||||
self,
|
||||
@@ -753,7 +753,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
"""
|
||||
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', [])]
|
||||
return [Thread(guild=self.guild, state=self._state, data=d) for d in data.get('threads', [])]
|
||||
|
||||
|
||||
class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
|
||||
@@ -1924,3 +1924,9 @@ def _channel_factory(channel_type: Union[ChannelType, int]):
|
||||
return GroupChannel, value
|
||||
else:
|
||||
return cls, value
|
||||
|
||||
def _threaded_channel_factory(channel_type: Union[ChannelType, int]):
|
||||
cls, value = _channel_factory(channel_type)
|
||||
if value in (ChannelType.private_thread, ChannelType.public_thread, ChannelType.news_thread):
|
||||
return Thread, value
|
||||
return cls, value
|
||||
|
||||
Reference in New Issue
Block a user