Raise error on .get_entity() on non-joined invite link

This commit is contained in:
Lonami Exo 2018-02-02 17:23:28 +01:00
parent fbd53e2126
commit cf21808118

View File

@ -1716,10 +1716,10 @@ class TelegramClient(TelegramBareClient):
if is_join_chat: if is_join_chat:
invite = self(CheckChatInviteRequest(string)) invite = self(CheckChatInviteRequest(string))
if isinstance(invite, ChatInvite): if isinstance(invite, ChatInvite):
# If it's an invite to a chat, the user must join before raise ValueError(
# for the link to be resolved and work, otherwise raise. 'Cannot get entity from a channel '
if invite.channel: '(or group) that you are not part of'
return invite.channel )
elif isinstance(invite, ChatInviteAlready): elif isinstance(invite, ChatInviteAlready):
return invite.chat return invite.chat
else: else: