feat: acceptGroupV4Invite (#677)

* Added option client.acceptGroupV4Invite()

* Update Client.js

* Update index.d.ts

Added a description to the inviteV4 object

Renamed "invite" by "inviteV4"

* Update Client.js

* Update Message.js

renamed "invite" to "inviteV4"

* Update Client.js

* Added message.acceptGroupV4Invite method

* Update index.d.ts

acceptGroupV4Invite

* better typings, refactor some names

Co-authored-by: Pedro Lopez <pedroslopez@me.com>
This commit is contained in:
JoseHM8A 2021-06-05 21:10:47 +00:00 • committed by GitHub
commit cdc00e934d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

17
index.d.ts vendored
View file

@ -19,6 +19,9 @@ declare namespace WAWebJS {
/**Accepts an invitation to join a group */
acceptInvite(inviteCode: string): Promise<string>
/** Accepts a private invitation to join a group (v4 invite) */
acceptGroupV4Invite: (inviteV4: InviteV4Data) => Promise<{status: number}>
/**Returns an object with information about the invite code's group */
getInviteInfo(inviteCode: string): Promise<object>
@ -419,6 +422,7 @@ declare namespace WAWebJS {
ORDER = 'order',
PRODUCT = 'product',
UNKNOWN = 'unknown',
GROUP_INVITE = 'groups_v4_invite',
}
/** Client status */
@ -453,6 +457,15 @@ declare namespace WAWebJS {
readRemaining: number
}
export type InviteV4Data = {
inviteCode: string,
inviteCodeExp: number,
groupId: string,
groupName?: string,
fromId: string,
toId: string
}
/**
* Represents a Message on WhatsApp
*
@ -510,6 +523,8 @@ declare namespace WAWebJS {
location: Location,
/** List of vCards contained in the message */
vCards: string[],
/** Invite v4 info */
inviteV4?: InviteV4Data,
/** MediaKey that represents the sticker 'ID' */
mediaKey?: string,
/** Indicates the mentions in the message body. */
@ -536,6 +551,8 @@ declare namespace WAWebJS {
businessOwnerJid?: string,
/** Product JID */
productId?: string,
/** Accept the Group V4 Invite in message */
acceptGroupV4Invite: () => Promise<{status: number}>,
/** Deletes the message from the chat */
delete: (everyone?: boolean) => Promise<void>,
/** Downloads and returns the attatched message media */