Skip to content

Commit

Permalink
✨ feat: onGroupApprovalRequest #3070
Browse files Browse the repository at this point in the history
  • Loading branch information
smashah committed Mar 23, 2023
1 parent 480e1dc commit 5c7f4e0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/api/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Listener | boolean> {
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.
*
Expand Down
4 changes: 4 additions & 0 deletions src/api/model/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
* Represents [[onGlobalParticipantsChanged]]
*/
GlobalParticipantsChanged = 'onGlobalParticipantsChanged',
/**
* Represents [[onGroupApprovalRequest]]
*/
GroupApprovalRequest = 'onGroupApprovalRequest',
/**
* Represents [[onChatState]]
*/
Expand Down

0 comments on commit 5c7f4e0

Please sign in to comment.