mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 11:06:39 +00: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:
|
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user