Merge pull request #51 from eyMarv/patch-3

Fix sender retrieval of Story() object
This commit is contained in:
2024-03-21 13:21:21 +07:00 committed by GitHub
commit dc4d6ce9b5
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):