From dabc15b6065f754052f87bb306fd6b8f05f07a4f Mon Sep 17 00:00:00 2001 From: M SHAH Date: Thu, 23 Mar 2023 15:38:53 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20`setGroupApprovalMode`=20#3?= =?UTF-8?q?070?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Client.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/api/Client.ts b/src/api/Client.ts index 2ee408e8ad..ea3ce0456a 100644 --- a/src/api/Client.ts +++ b/src/api/Client.ts @@ -130,6 +130,7 @@ declare module WAPI { const demoteParticipant: (groupId: string, contactId: string) => Promise; const setGroupToAdminsOnly: (groupId: string, onlyAdmins: boolean) => Promise; const setGroupEditToAdminsOnly: (groupId: string, onlyAdmins: boolean) => Promise; + const setGroupApprovalMode: (groupId: string, requireApproval: boolean) => Promise; const setGroupDescription: (groupId: string, description: string) => Promise; const setGroupTitle: (groupId: string, title: string) => Promise; const sendPoll: (groupId: string, name: string, options: string[], quotedMsgId ?: string, allowMultiSelect ?: boolean) => Promise; @@ -3604,6 +3605,20 @@ public async getStatus(contactId: ContactId) : Promise<{ ) as Promise; } + /** + * + * Turn on or off the approval requirement for new members to join a group + * @param groupId '0000000000-00000000@g.us' the group id. + * @param requireApproval set to true to turn on the approval requirement, false to turn off + * @returns boolean true if action completed successfully. + */ + public async setGroupApprovalMode(groupId: GroupChatId, requireApproval: boolean) : Promise { + return await this.pup( + ({ groupId, requireApproval }) => WAPI.setGroupEditToAdminsOnly(groupId, requireApproval), + { groupId, requireApproval } + ) as Promise; + } + /** * Change the group chant description * @param groupId '0000000000-00000000@g.us' the group id.