mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-05-30 19:23:04 +03:00
Assert user/channel ID is non-zero too for #392
This commit is contained in:
parent
f2fbdc6416
commit
f357d00911
|
@ -323,12 +323,19 @@ class Session:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
p_hash = getattr(p, 'access_hash', 0)
|
if isinstance(p, (InputPeerUser, InputPeerChannel)):
|
||||||
if p_hash is None:
|
if not p.access_hash:
|
||||||
# Some users and channels seem to be returned without
|
# Some users and channels seem to be returned without
|
||||||
# an 'access_hash', meaning Telegram doesn't want you
|
# an 'access_hash', meaning Telegram doesn't want you
|
||||||
# to access them. This is the reason behind ensuring
|
# to access them. This is the reason behind ensuring
|
||||||
# that the 'access_hash' is non-zero. See issue #354.
|
# that the 'access_hash' is non-zero. See issue #354.
|
||||||
|
# Note that this checks for zero or None, see #392.
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
p_hash = p.access_hash
|
||||||
|
elif isinstance(p, InputPeerChat):
|
||||||
|
p_hash = 0
|
||||||
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
username = getattr(e, 'username', None) or None
|
username = getattr(e, 'username', None) or None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user