From cf21808118737005beb3450e31a387b6c41b285f Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 2 Feb 2018 17:23:28 +0100 Subject: [PATCH] Raise error on .get_entity() on non-joined invite link --- telethon/telegram_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 84c77b9c..9dda06af 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -1716,10 +1716,10 @@ class TelegramClient(TelegramBareClient): if is_join_chat: invite = self(CheckChatInviteRequest(string)) if isinstance(invite, ChatInvite): - # If it's an invite to a chat, the user must join before - # for the link to be resolved and work, otherwise raise. - if invite.channel: - return invite.channel + raise ValueError( + 'Cannot get entity from a channel ' + '(or group) that you are not part of' + ) elif isinstance(invite, ChatInviteAlready): return invite.chat else: