mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Add suport for slug to join/leave folder
This commit is contained in:
parent
e31edb62b8
commit
9a993b918e
@ -49,12 +49,16 @@ class JoinFolder:
|
||||
"""
|
||||
match = re.match(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:addlist/|\+))([\w-]+)$", link)
|
||||
|
||||
if not match:
|
||||
if match:
|
||||
slug = match.group(1)
|
||||
elif isinstance(link, str):
|
||||
slug = link
|
||||
else:
|
||||
raise ValueError("Invalid folder invite link")
|
||||
|
||||
r = await self.invoke(
|
||||
raw.functions.chatlists.CheckChatlistInvite(
|
||||
slug=match.group(1)
|
||||
slug=slug
|
||||
)
|
||||
)
|
||||
|
||||
@ -65,7 +69,7 @@ class JoinFolder:
|
||||
|
||||
await self.invoke(
|
||||
raw.functions.chatlists.JoinChatlistInvite(
|
||||
slug=match.group(1),
|
||||
slug=slug,
|
||||
peers=[
|
||||
await self.resolve_peer(utils.get_peer_id(id)) for id in peers
|
||||
],
|
||||
|
@ -55,12 +55,16 @@ class LeaveFolder:
|
||||
"""
|
||||
match = re.match(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:addlist/|\+))([\w-]+)$", link)
|
||||
|
||||
if not match:
|
||||
if match:
|
||||
slug = match.group(1)
|
||||
elif isinstance(link, str):
|
||||
slug = link
|
||||
else:
|
||||
raise ValueError("Invalid folder invite link")
|
||||
|
||||
r = await self.invoke(
|
||||
raw.functions.chatlists.CheckChatlistInvite(
|
||||
slug=match.group(1)
|
||||
slug=slug
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user