mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
Upgrade WebhookMessage.channel to Thread if available
This commit is contained in:
parent
538ba0d076
commit
29d4c26466
@ -1344,7 +1344,16 @@ class Webhook(BaseWebhook):
|
||||
def _create_message(self, data, *, thread: Snowflake):
|
||||
state = _WebhookState(self, parent=self._state, thread=thread)
|
||||
# state may be artificial (unlikely at this point...)
|
||||
if thread is MISSING:
|
||||
channel = self.channel or PartialMessageable(state=self._state, id=int(data['channel_id'])) # type: ignore
|
||||
else:
|
||||
channel = self.channel
|
||||
if isinstance(channel, TextChannel):
|
||||
channel = channel.get_thread(thread.id)
|
||||
|
||||
if channel is None:
|
||||
channel = PartialMessageable(state=self._state, id=int(data['channel_id'])) # type: ignore
|
||||
|
||||
# state is artificial
|
||||
return WebhookMessage(data=data, state=state, channel=channel) # type: ignore
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user