mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-27 17:54:38 +03:00
Fix get_input_peer allow_self for custom.Dialog
This commit is contained in:
parent
3bf259d6b3
commit
17a2946311
|
@ -91,9 +91,11 @@ def get_input_peer(entity, allow_self=True):
|
||||||
if entity.SUBCLASS_OF_ID == 0xc91c90b6: # crc32(b'InputPeer')
|
if entity.SUBCLASS_OF_ID == 0xc91c90b6: # crc32(b'InputPeer')
|
||||||
return entity
|
return entity
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
if hasattr(entity, 'input_entity'):
|
# e.g. custom.Dialog (can't cyclic import).
|
||||||
# e.g. custom.Dialog (can't cyclic import)
|
if allow_self and hasattr(entity, 'input_entity'):
|
||||||
return entity.input_entity
|
return entity.input_entity
|
||||||
|
elif hasattr(entity, 'entity'):
|
||||||
|
return get_input_peer(entity.entity)
|
||||||
else:
|
else:
|
||||||
_raise_cast_fail(entity, 'InputPeer')
|
_raise_cast_fail(entity, 'InputPeer')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user