mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 07:51:44 +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:
parent
18b581fb45
commit
bdd554575a
@ -1364,4 +1364,7 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua
|
|||||||
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
||||||
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
||||||
|
|
||||||
|
// Ports
|
||||||
|
channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite;
|
||||||
|
|
||||||
// LAYER 102
|
// LAYER 102
|
@ -52,11 +52,17 @@ class ExportChatInviteLink(BaseClient):
|
|||||||
"""
|
"""
|
||||||
peer = self.resolve_peer(chat_id)
|
peer = self.resolve_peer(chat_id)
|
||||||
|
|
||||||
if isinstance(peer, (types.InputPeerChannel, types.InputPeerChat)):
|
if isinstance(peer, 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):
|
||||||
|
return self.send(
|
||||||
|
functions.channels.ExportInvite(
|
||||||
|
channel=peer
|
||||||
|
)
|
||||||
|
).link
|
||||||
else:
|
else:
|
||||||
raise ValueError('The chat_id "{}" belongs to a user'.format(chat_id))
|
raise ValueError('The chat_id "{}" belongs to a user'.format(chat_id))
|
||||||
|
Loading…
Reference in New Issue
Block a user