mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 17:36:15 +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:
@ -842,7 +842,7 @@ class SyncWebhook(BaseWebhook):
|
||||
def _create_message(self, data: MessagePayload, *, thread: Snowflake = MISSING) -> SyncWebhookMessage:
|
||||
state = _WebhookState(self, parent=self._state, thread=thread)
|
||||
# state may be artificial (unlikely at this point...)
|
||||
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
|
||||
# state is artificial
|
||||
return SyncWebhookMessage(data=data, state=state, channel=channel) # type: ignore
|
||||
|
||||
|
Reference in New Issue
Block a user