mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +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:
@ -213,9 +213,11 @@ class Namespace:
|
||||
for (message_id, message_data) in resolved.get('messages', {}).items():
|
||||
channel_id = int(message_data['channel_id'])
|
||||
if guild is None:
|
||||
channel = PartialMessageable(state=state, id=channel_id)
|
||||
channel = PartialMessageable(state=state, guild_id=guild_id, id=channel_id)
|
||||
else:
|
||||
channel = guild.get_channel_or_thread(channel_id) or PartialMessageable(state=state, id=channel_id)
|
||||
channel = guild.get_channel_or_thread(channel_id) or PartialMessageable(
|
||||
state=state, guild_id=guild_id, id=channel_id
|
||||
)
|
||||
|
||||
# Type checker doesn't understand this due to failure to narrow
|
||||
message = Message(state=state, channel=channel, data=message_data) # type: ignore
|
||||
|
Reference in New Issue
Block a user