From 83c346ccc53ad47068cd0b2cf5660102e67b8af4 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 5 Aug 2017 09:37:34 +0200 Subject: [PATCH] Let InputPeerChannel be casted automatically into InputChannel --- telethon/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/telethon/utils.py b/telethon/utils.py index 60dfd76e..c4811a6f 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -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__))