From 5c7f4e08262c5aed11a0780bc1a666163a0b9266 Mon Sep 17 00:00:00 2001 From: M SHAH Date: Thu, 23 Mar 2023 20:16:52 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20`onGroupApprovalRequest`=20?= =?UTF-8?q?#3070?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Client.ts | 11 +++++++++++ src/api/model/events.ts | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/api/Client.ts b/src/api/Client.ts index 1779d6f99c..a013d3fdba 100644 --- a/src/api/Client.ts +++ b/src/api/Client.ts @@ -1075,6 +1075,17 @@ export class Client { return this.registerListener(SimpleListener.GlobalParticipantsChanged, fn); } + /** + * Listents to group approval requests. Emits a message object. Use it with `message.isGroupApprovalRequest()` to check if it is a group approval request. + * + * @event + * @param fn callback function that handles a [[Message]] as the first and only parameter. + * @returns `true` if the callback was registered + */ + public async onGroupApprovalRequest(fn: (groupApprovalRequestMessage: Message) => void) : Promise { + return this.registerListener(SimpleListener.GroupApprovalRequest, fn); + } + /** * Listens to all group (gp2) events. This can be useful if you want to catch when a group title, subject or picture is changed. * diff --git a/src/api/model/events.ts b/src/api/model/events.ts index 5885e48b71..c2bdfbd34b 100644 --- a/src/api/model/events.ts +++ b/src/api/model/events.ts @@ -47,6 +47,10 @@ * Represents [[onGlobalParticipantsChanged]] */ GlobalParticipantsChanged = 'onGlobalParticipantsChanged', + /** + * Represents [[onGroupApprovalRequest]] + */ + GroupApprovalRequest = 'onGroupApprovalRequest', /** * Represents [[onChatState]] */