From 4019693363ff551df7c529a564a48f2e99b6ac1d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 27 Dec 2017 21:23:00 +0100 Subject: [PATCH] Add export_chat_invite_link method --- pyrogram/client/client.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 750aed7f..321828d9 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1027,3 +1027,19 @@ class Client: ) return r + + def export_chat_invite_link(self, chat_id: int or str): + peer = self.resolve_peer(chat_id) + + if isinstance(peer, types.InputPeerChat): + return self.send( + functions.messages.ExportChatInvite( + chat_id=peer.chat_id + ) + ).link + elif isinstance(peer, types.InputPeerChannel): + return self.send( + functions.channels.ExportInvite( + channel=peer + ) + ).link