mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 03:22:29 +00:00
Fix InputPeer* with None hash, drop them off database (closes #354)
This commit is contained in:
@@ -84,13 +84,13 @@ def get_input_peer(entity, allow_self=True):
|
||||
if entity.is_self and allow_self:
|
||||
return InputPeerSelf()
|
||||
else:
|
||||
return InputPeerUser(entity.id, entity.access_hash)
|
||||
return InputPeerUser(entity.id, entity.access_hash or 0)
|
||||
|
||||
if isinstance(entity, (Chat, ChatEmpty, ChatForbidden)):
|
||||
return InputPeerChat(entity.id)
|
||||
|
||||
if isinstance(entity, (Channel, ChannelForbidden)):
|
||||
return InputPeerChannel(entity.id, entity.access_hash)
|
||||
return InputPeerChannel(entity.id, entity.access_hash or 0)
|
||||
|
||||
# Less common cases
|
||||
if isinstance(entity, UserEmpty):
|
||||
@@ -120,7 +120,7 @@ def get_input_channel(entity):
|
||||
return entity
|
||||
|
||||
if isinstance(entity, (Channel, ChannelForbidden)):
|
||||
return InputChannel(entity.id, entity.access_hash)
|
||||
return InputChannel(entity.id, entity.access_hash or 0)
|
||||
|
||||
if isinstance(entity, InputPeerChannel):
|
||||
return InputChannel(entity.channel_id, entity.access_hash)
|
||||
@@ -140,7 +140,7 @@ def get_input_user(entity):
|
||||
if entity.is_self:
|
||||
return InputUserSelf()
|
||||
else:
|
||||
return InputUser(entity.id, entity.access_hash)
|
||||
return InputUser(entity.id, entity.access_hash or 0)
|
||||
|
||||
if isinstance(entity, InputPeerSelf):
|
||||
return InputUserSelf()
|
||||
|
Reference in New Issue
Block a user