feat: add received vcards to the message (#400)

close #398 

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
Pedro S. Lopez
2020-11-05 02:07:40 -04:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

2
index.d.ts vendored
View File

@@ -465,6 +465,8 @@ declare namespace WAWebJS {
isForwarded: boolean,
/** Location information contained in the message, if the message is type "location" */
location: Location,
/** List of vCards contained in the message */
vCards: string[],
/** MediaKey that represents the sticker 'ID' */
mediaKey?: string,
/** Indicates the mentions in the message body. */

View File

@@ -117,6 +117,12 @@ class Message extends Base {
*/
this.location = data.type === MessageTypes.LOCATION ? new Location(data.lat, data.lng, data.loc) : undefined;
/**
* List of vCards contained in the message.
* @type {Array<string>}
*/
this.vCards = data.type === MessageTypes.CONTACT_CARD_MULTI ? data.vcardList.map((c) => c.vcard) : data.type === MessageTypes.CONTACT_CARD ? [data.body] : [];
/**
* Indicates the mentions in the message body.
* @type {Array<string>}