Skip to content

Commit bdd5545

Browse files
committed
Fix export_chat_invite_link not working for bots on channels/supergroups
Telegram still hasn't enabled this for bots... Closes
1 parent 18b581f commit bdd5545

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

compiler/api/source/main_api.tl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,4 +1364,7 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua
13641364
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
13651365
folders.deleteFolder#1c295881 folder_id:int = Updates;
13661366

1367+
// Ports
1368+
channels.exportInvite#c7560885 channel:InputChannel = ExportedChatInvite;
1369+
13671370
// LAYER 102

pyrogram/client/methods/chats/export_chat_invite_link.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,17 @@ def export_chat_invite_link(
5252
"""
5353
peer = self.resolve_peer(chat_id)
5454

55-
if isinstance(peer, (types.InputPeerChannel, types.InputPeerChat)):
55+
if isinstance(peer, types.InputPeerChat):
5656
return self.send(
5757
functions.messages.ExportChatInvite(
5858
peer=peer
5959
)
6060
).link
61+
elif isinstance(peer, types.InputPeerChannel):
62+
return self.send(
63+
functions.channels.ExportInvite(
64+
channel=peer
65+
)
66+
).link
6167
else:
6268
raise ValueError('The chat_id "{}" belongs to a user'.format(chat_id))

0 commit comments

Comments
 (0)