mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Fix early cast to input from 932ed9e
causing error on Peer
This commit is contained in:
parent
d2121c76cb
commit
cbf6306599
|
@ -336,10 +336,12 @@ class Session:
|
|||
Raises ValueError if it cannot be found.
|
||||
"""
|
||||
if isinstance(key, TLObject):
|
||||
key = utils.get_input_peer(key)
|
||||
if type(key).SUBCLASS_OF_ID == 0xc91c90b6: # crc32(b'InputPeer')
|
||||
return key
|
||||
key = utils.get_peer_id(key)
|
||||
try:
|
||||
# Try to early return if this key can be casted as input peer
|
||||
return utils.get_input_peer(key)
|
||||
except TypeError:
|
||||
# Otherwise, get the ID of the peer
|
||||
key = utils.get_peer_id(key)
|
||||
|
||||
c = self._conn.cursor()
|
||||
if isinstance(key, str):
|
||||
|
|
Loading…
Reference in New Issue
Block a user