mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-04-05 09:44:13 +03:00
Raise error on .get_entity() on non-joined invite link
This commit is contained in:
parent
fbd53e2126
commit
cf21808118
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user