Let InputPeerChannel be casted automatically into InputChannel

This commit is contained in:
Lonami Exo 2017-08-05 09:37:34 +02:00
parent 9e88d9d219
commit 83c346ccc5

View File

@ -98,6 +98,9 @@ def get_input_channel(entity):
if isinstance(entity, Channel) or isinstance(entity, ChannelForbidden):
return InputChannel(entity.id, entity.access_hash)
if isinstance(entity, InputPeerChannel):
return InputChannel(entity.channel_id, entity.access_hash)
raise ValueError('Cannot cast {} to any kind of InputChannel.'
.format(type(entity).__name__))