2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-30 13:57:54 +00:00

Add support for Bot API channel/supergroup IDs starting with -100

This commit is contained in:
Dan
2018-01-26 14:44:53 +01:00
parent b1f11b7a97
commit 38fb4b8d2a

View File

@@ -524,6 +524,7 @@ class Client:
peer_id, peer_id,
peer_access_hash peer_access_hash
) )
peer_id = int("-100" + str(peer_id))
else: else:
continue continue
@@ -553,7 +554,7 @@ class Client:
channel_id=resolved_peer.chats[0].id, channel_id=resolved_peer.chats[0].id,
access_hash=resolved_peer.chats[0].access_hash access_hash=resolved_peer.chats[0].access_hash
) )
chat_id = input_peer.channel_id chat_id = int("-100" + str(input_peer.channel_id))
else: else:
raise PeerIdInvalid raise PeerIdInvalid
@@ -576,6 +577,9 @@ class Client:
else: else:
try: try:
return self.peers_by_id[chat_id] return self.peers_by_id[chat_id]
except KeyError:
try:
return self.peers_by_id[int("-100" + str(chat_id))]
except KeyError: except KeyError:
raise PeerIdInvalid raise PeerIdInvalid