Fix sender retrieval of Story() object

This commit is contained in:
Marvin 2024-03-06 18:50:17 +01:00 committed by GitHub
parent 517f2256b6
commit 7b107a69ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -230,8 +230,13 @@ class Story(Object, Update):
)
)
if stories.from_id is not None:
from_user = await client.get_users(stories.from_id.user_id)
chat = types.Chat._parse_chat(client, chat.chats[0])
if getattr(stories.from_id, "user_id", None) is not None:
from_user = await client.get_users(stories.from_id.user_id)
chat = types.Chat._parse_chat(client, chat.chats[0])
elif getattr(stories.from_id, "channel_id", None) is not None:
sender_chat = types.Chat._parse_chat(client, stories.from_id.channel_id)
elif getattr(stories.from_id, "chat_id", None) is not None:
sender_chat = types.Chat._parse_chat(client, stories.from_id.chat_id)
else:
sender_chat = types.Chat._parse_chat(client, chat.chats[0])
elif isinstance(peer, raw.types.InputPeerSelf):