Pyrofork: Refactor Story.sender_chat

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2023-12-25 18:56:15 +07:00
parent bb9abd880e
commit 454f155845
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -212,7 +212,13 @@ class Story(Object, Update):
else:
media_type = None
if isinstance(peer, raw.types.PeerChannel) or isinstance(peer, raw.types.InputPeerChannel):
sender_chat = await client.get_chat(utils.get_channel_id(peer.channel_id))
chat_id = utils.get_channel_id(peer.channel_id)
chat = await client.invoke(
raw.functions.channels.GetChannels(
id=[await client.resolve_peer(chat_id)]
)
)
sender_chat = types.Chat._parse_chat(client, chat.chats[0])
elif isinstance(peer, raw.types.InputPeerSelf):
from_user = client.me
else: