2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-10 11:15:27 +00:00

Add get_chat method

This commit is contained in:
Dan
2018-05-05 18:42:28 +02:00
parent 68986171ef
commit 553e7f714c
2 changed files with 51 additions and 0 deletions

View File

@@ -3794,3 +3794,18 @@ class Client:
url=url
)
)
def get_chat(self, chat_id: int or str):
# TODO: Add docstrings
peer = self.resolve_peer(chat_id)
if isinstance(peer, types.InputPeerChannel):
r = self.send(functions.channels.GetFullChannel(peer))
elif isinstance(peer, (types.InputPeerUser, types.InputPeerSelf)):
r = self.send(functions.users.GetFullUser(peer))
else:
r = self.send(functions.messages.GetFullChat(peer.chat_id))
return utils.parse_chat_full(self, r)