Update create/edit_chat_invite_link

This commit is contained in:
Dan 2021-12-22 14:08:24 +01:00
parent 56e7e11037
commit 29b4615848
2 changed files with 22 additions and 0 deletions

View File

@ -27,8 +27,10 @@ class CreateChatInviteLink(Scaffold):
async def create_chat_invite_link(
self,
chat_id: Union[int, str],
name: str = None,
expire_date: int = None,
member_limit: int = None,
creates_join_request: bool = None
) -> "types.ChatInviteLink":
"""Create an additional invite link for a chat.
@ -41,6 +43,9 @@ class CreateChatInviteLink(Scaffold):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
name (``str``, *optional*):
Invite link name.
expire_date (``int``, *optional*):
Point in time (Unix timestamp) when the link will expire.
Defaults to None (no expiration date).
@ -50,6 +55,10 @@ class CreateChatInviteLink(Scaffold):
this invite link; 1-99999.
Defaults to None (no member limit).
creates_join_request (``bool``, *optional*):
True, if users joining the chat via the link need to be approved by chat administrators.
If True, member_limit can't be specified.
Returns:
:obj:`~pyrogram.types.ChatInviteLink`: On success, the new invite link is returned.
@ -67,6 +76,8 @@ class CreateChatInviteLink(Scaffold):
peer=await self.resolve_peer(chat_id),
expire_date=expire_date,
usage_limit=member_limit,
title=name,
request_needed=creates_join_request
)
)

View File

@ -28,8 +28,10 @@ class EditChatInviteLink(Scaffold):
self,
chat_id: Union[int, str],
invite_link: str,
name: str = None,
expire_date: int = None,
member_limit: int = None,
creates_join_request: bool = None
) -> "types.ChatInviteLink":
"""Edit a non-primary invite link.
@ -43,6 +45,9 @@ class EditChatInviteLink(Scaffold):
invite_link (``str``):
The invite link to edit
name (``str``, *optional*):
Invite link name.
expire_date (``int``, *optional*):
Point in time (Unix timestamp) when the link will expire.
Defaults to None (no change), pass 0 to set no expiration date.
@ -52,6 +57,10 @@ class EditChatInviteLink(Scaffold):
invite link; 1-99999.
Defaults to None (no change), pass 0 to set no member limit.
creates_join_request (``bool``, *optional*):
True, if users joining the chat via the link need to be approved by chat administrators.
If True, member_limit can't be specified.
Returns:
:obj:`~pyrogram.types.ChatInviteLink`: On success, the new invite link is returned
@ -70,6 +79,8 @@ class EditChatInviteLink(Scaffold):
link=invite_link,
expire_date=expire_date,
usage_limit=member_limit,
title=name,
request_needed=creates_join_request
)
)