mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-03 00:25:14 +00:00
Improve generic duck type programming with PartialMessageable
This adds jump_url, permissions_for, and created_at. Luckily, most cases of this type being constructed already have the guild_id at creation time.
This commit is contained in:
@ -1345,14 +1345,14 @@ class Webhook(BaseWebhook):
|
||||
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
|
||||
channel = self.channel or PartialMessageable(state=self._state, guild_id=self.guild_id, 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
|
||||
channel = PartialMessageable(state=self._state, guild_id=self.guild_id, id=int(data['channel_id'])) # type: ignore
|
||||
|
||||
# state is artificial
|
||||
return WebhookMessage(data=data, state=state, channel=channel) # type: ignore
|
||||
|
Reference in New Issue
Block a user