Skip to content

Commit

Permalink
Fix export_chat_invite_link not working correctly (channels/supergroups)
Browse files Browse the repository at this point in the history
  • Loading branch information
delivrance committed Jun 30, 2019
1 parent 0d6f8cd commit 580c684
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pyrogram/client/methods/chats/export_chat_invite_link.py
Expand Up @@ -48,18 +48,15 @@ def export_chat_invite_link(
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))

0 comments on commit 580c684

Please sign in to comment.