2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Finally remove ports from older schemas and fix export_chat_invite_link

This commit is contained in:
Dan 2019-08-03 19:40:45 +02:00
parent c8c93b9ce6
commit 937987a361

View File

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