mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +03:00
Simplify .process_entities() flow
This commit is contained in:
parent
f96d88d3b5
commit
843e777eba
|
@ -318,26 +318,23 @@ class Session:
|
|||
try:
|
||||
p = utils.get_input_peer(e, allow_self=False)
|
||||
marked_id = utils.get_peer_id(p, add_mark=True)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
p_hash = None
|
||||
if isinstance(p, InputPeerChat):
|
||||
p_hash = 0
|
||||
elif p.access_hash:
|
||||
p_hash = getattr(p, 'access_hash', 0)
|
||||
if p_hash is None:
|
||||
# Some users and channels seem to be returned without
|
||||
# an 'access_hash', meaning Telegram doesn't want you
|
||||
# to access them. This is the reason behind ensuring
|
||||
# that the 'access_hash' is non-zero. See issue #354.
|
||||
p_hash = p.access_hash
|
||||
continue
|
||||
|
||||
if p_hash is not None:
|
||||
username = getattr(e, 'username', None) or None
|
||||
if username is not None:
|
||||
username = username.lower()
|
||||
phone = getattr(e, 'phone', None)
|
||||
name = utils.get_display_name(e) or None
|
||||
rows.append((marked_id, p_hash, username, phone, name))
|
||||
except ValueError:
|
||||
pass
|
||||
if not rows:
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user