2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-09-05 08:45:13 +00:00

Fix export_chat_invite_link not working for bots on channels/supergroups

Telegram still hasn't enabled this for bots...
Closes
This commit is contained in:
Dan
2019-07-04 21:00:22 +02:00
parent 18b581fb45
commit bdd554575a
2 changed files with 10 additions and 1 deletions

View File

@@ -52,11 +52,17 @@ class ExportChatInviteLink(BaseClient):
"""
peer = self.resolve_peer(chat_id)
if isinstance(peer, (types.InputPeerChannel, types.InputPeerChat)):
if isinstance(peer, 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))