Skip to content

Commit 580c684

Browse files
committed
Fix export_chat_invite_link not working correctly (channels/supergroups)
1 parent 0d6f8cd commit 580c684

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

pyrogram/client/methods/chats/export_chat_invite_link.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,15 @@ def export_chat_invite_link(
4848
4949
Raises:
5050
RPCError: In case of a Telegram RPC error.
51+
ValueError: In case the chat_id belongs to a user.
5152
"""
5253
peer = self.resolve_peer(chat_id)
5354

54-
if isinstance(peer, types.InputPeerChat):
55+
if isinstance(peer, (types.InputPeerChannel, types.InputPeerChat)):
5556
return self.send(
5657
functions.messages.ExportChatInvite(
5758
peer=peer
5859
)
5960
).link
60-
elif isinstance(peer, types.InputPeerChannel):
61-
return self.send(
62-
functions.channels.ExportInvite(
63-
channel=peer
64-
)
65-
).link
61+
else:
62+
raise ValueError('The chat_id "{}" belongs to a user'.format(chat_id))

0 commit comments

Comments
 (0)