mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 05:48:14 +00:00
Add support for Bot API channel/supergroup IDs starting with -100
This commit is contained in:
parent
b1f11b7a97
commit
38fb4b8d2a
@ -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
|
||||||
|
|
||||||
@ -577,7 +578,10 @@ class Client:
|
|||||||
try:
|
try:
|
||||||
return self.peers_by_id[chat_id]
|
return self.peers_by_id[chat_id]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise PeerIdInvalid
|
try:
|
||||||
|
return self.peers_by_id[int("-100" + str(chat_id))]
|
||||||
|
except KeyError:
|
||||||
|
raise PeerIdInvalid
|
||||||
|
|
||||||
def get_me(self):
|
def get_me(self):
|
||||||
"""A simple method for testing the user authorization. Requires no parameters.
|
"""A simple method for testing the user authorization. Requires no parameters.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user