From 29b4615848591eaf4c982a0be722879671ad026f Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 22 Dec 2021 14:08:24 +0100 Subject: [PATCH] Update create/edit_chat_invite_link --- .../methods/invite_links/create_chat_invite_link.py | 11 +++++++++++ .../methods/invite_links/edit_chat_invite_link.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/pyrogram/methods/invite_links/create_chat_invite_link.py b/pyrogram/methods/invite_links/create_chat_invite_link.py index 006e7e14..b90b9b15 100644 --- a/pyrogram/methods/invite_links/create_chat_invite_link.py +++ b/pyrogram/methods/invite_links/create_chat_invite_link.py @@ -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 ) ) diff --git a/pyrogram/methods/invite_links/edit_chat_invite_link.py b/pyrogram/methods/invite_links/edit_chat_invite_link.py index 07c84d3c..ea4be32f 100644 --- a/pyrogram/methods/invite_links/edit_chat_invite_link.py +++ b/pyrogram/methods/invite_links/edit_chat_invite_link.py @@ -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 ) )