mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Fix export_chat_invite_link not working correctly (channels/supergroups)
This commit is contained in:
parent
0d6f8cd462
commit
580c684cb3
@ -48,18 +48,15 @@ class ExportChatInviteLink(BaseClient):
|
|||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
RPCError: In case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
ValueError: In case the chat_id belongs to a user.
|
||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
if isinstance(peer, types.InputPeerChat):
|
if isinstance(peer, (types.InputPeerChannel, types.InputPeerChat)):
|
||||||
return self.send(
|
return self.send(
|
||||||
functions.messages.ExportChatInvite(
|
functions.messages.ExportChatInvite(
|
||||||
peer=peer
|
peer=peer
|
||||||
)
|
)
|
||||||
).link
|
).link
|
||||||
elif isinstance(peer, types.InputPeerChannel):
|
else:
|
||||||
return self.send(
|
raise ValueError('The chat_id "{}" belongs to a user'.format(chat_id))
|
||||||
functions.channels.ExportInvite(
|
|
||||||
channel=peer
|
|
||||||
)
|
|
||||||
).link
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user