mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-03-03 19:00:21 +03:00
Clearer variable names in get_input_entity (#738)
This commit is contained in:
parent
cb226e7f45
commit
a1448f3da8
|
@ -196,14 +196,15 @@ class MemorySession(Session):
|
|||
result = self.get_entity_rows_by_name(key)
|
||||
|
||||
if result:
|
||||
i, h = result # unpack resulting tuple
|
||||
i, k = utils.resolve_id(i) # removes the mark and returns kind
|
||||
if k == PeerUser:
|
||||
return InputPeerUser(i, h)
|
||||
elif k == PeerChat:
|
||||
return InputPeerChat(i)
|
||||
elif k == PeerChannel:
|
||||
return InputPeerChannel(i, h)
|
||||
entity_id, entity_hash = result # unpack resulting tuple
|
||||
entity_id, kind = utils.resolve_id(entity_id)
|
||||
# removes the mark and returns type of entity
|
||||
if kind == PeerUser:
|
||||
return InputPeerUser(entity_id, entity_hash)
|
||||
elif kind == PeerChat:
|
||||
return InputPeerChat(entity_id)
|
||||
elif kind == PeerChannel:
|
||||
return InputPeerChannel(entity_id, entity_hash)
|
||||
else:
|
||||
raise ValueError('Could not find input entity with key ', key)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user