From 580c684cb3a60d73a3c0a1aa90012a47f9dcc466 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 30 Jun 2019 16:13:10 +0200 Subject: [PATCH] Fix export_chat_invite_link not working correctly (channels/supergroups) --- .../client/methods/chats/export_chat_invite_link.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pyrogram/client/methods/chats/export_chat_invite_link.py b/pyrogram/client/methods/chats/export_chat_invite_link.py index 9266183d..6e39dd84 100644 --- a/pyrogram/client/methods/chats/export_chat_invite_link.py +++ b/pyrogram/client/methods/chats/export_chat_invite_link.py @@ -48,18 +48,15 @@ class ExportChatInviteLink(BaseClient): Raises: RPCError: In case of a Telegram RPC error. + ValueError: In case the chat_id belongs to a user. """ peer = self.resolve_peer(chat_id) - if isinstance(peer, types.InputPeerChat): + if isinstance(peer, (types.InputPeerChannel, types.InputPeerChat)): return self.send( functions.messages.ExportChatInvite( peer=peer ) ).link - elif isinstance(peer, types.InputPeerChannel): - return self.send( - functions.channels.ExportInvite( - channel=peer - ) - ).link + else: + raise ValueError('The chat_id "{}" belongs to a user'.format(chat_id))