mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-14 05:26:36 +03:00
Let InputPeerChannel be casted automatically into InputChannel
This commit is contained in:
parent
9e88d9d219
commit
83c346ccc5
|
@ -98,6 +98,9 @@ def get_input_channel(entity):
|
||||||
if isinstance(entity, Channel) or isinstance(entity, ChannelForbidden):
|
if isinstance(entity, Channel) or isinstance(entity, ChannelForbidden):
|
||||||
return InputChannel(entity.id, entity.access_hash)
|
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.'
|
raise ValueError('Cannot cast {} to any kind of InputChannel.'
|
||||||
.format(type(entity).__name__))
|
.format(type(entity).__name__))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user