mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
Fix handling of ChannelForbidden in input peer, bump v1.10.3
This commit is contained in:
parent
9c06f29aaf
commit
c1774276c2
|
@ -189,11 +189,15 @@ def get_input_peer(entity, allow_self=True, check_hash=True):
|
||||||
if isinstance(entity, (types.Chat, types.ChatEmpty, types.ChatForbidden)):
|
if isinstance(entity, (types.Chat, types.ChatEmpty, types.ChatForbidden)):
|
||||||
return types.InputPeerChat(entity.id)
|
return types.InputPeerChat(entity.id)
|
||||||
|
|
||||||
if isinstance(entity, (types.Channel, types.ChannelForbidden)):
|
if isinstance(entity, types.Channel):
|
||||||
if (entity.access_hash is not None and not entity.min) or not check_hash:
|
if (entity.access_hash is not None and not entity.min) or not check_hash:
|
||||||
return types.InputPeerChannel(entity.id, entity.access_hash)
|
return types.InputPeerChannel(entity.id, entity.access_hash)
|
||||||
else:
|
else:
|
||||||
raise TypeError('Channel without access_hash or min info cannot be input')
|
raise TypeError('Channel without access_hash or min info cannot be input')
|
||||||
|
if isinstance(entity, types.ChannelForbidden):
|
||||||
|
# "channelForbidden are never min", and since their hash is
|
||||||
|
# also not optional, we assume that this truly is the case.
|
||||||
|
return types.InputPeerChannel(entity.id, entity.access_hash)
|
||||||
|
|
||||||
if isinstance(entity, types.InputUser):
|
if isinstance(entity, types.InputUser):
|
||||||
return types.InputPeerUser(entity.user_id, entity.access_hash)
|
return types.InputPeerUser(entity.user_id, entity.access_hash)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Versions should comply with PEP440.
|
# Versions should comply with PEP440.
|
||||||
# This line is parsed in setup.py:
|
# This line is parsed in setup.py:
|
||||||
__version__ = '1.10.2'
|
__version__ = '1.10.3'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user