mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 09:53:45 +03:00
Fix wrong peer type being used when not found in the session
This commit is contained in:
parent
a9c83250a1
commit
67a782a6d7
|
@ -2178,17 +2178,16 @@ class TelegramClient(TelegramBareClient):
|
||||||
return InputPeerSelf()
|
return InputPeerSelf()
|
||||||
return utils.get_input_peer(self._get_entity_from_string(peer))
|
return utils.get_input_peer(self._get_entity_from_string(peer))
|
||||||
|
|
||||||
is_peer = False
|
|
||||||
if isinstance(peer, int):
|
if isinstance(peer, int):
|
||||||
peer = PeerUser(peer)
|
peer, kind = utils.resolve_id(peer)
|
||||||
is_peer = True
|
peer = kind(peer)
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
is_peer = peer.SUBCLASS_OF_ID == 0x2d45687 # crc32(b'Peer')
|
is_peer = peer.SUBCLASS_OF_ID == 0x2d45687 # crc32(b'Peer')
|
||||||
if not is_peer:
|
if not is_peer:
|
||||||
return utils.get_input_peer(peer)
|
return utils.get_input_peer(peer)
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError):
|
||||||
pass # Attribute if not TLObject, Type if not "casteable"
|
is_peer = False
|
||||||
|
|
||||||
if not is_peer:
|
if not is_peer:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user