Skip to content

Commit

Permalink
feat: add received vcards to the message (#400)
Browse files Browse the repository at this point in the history
close #398 

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
  • Loading branch information
pedroslopez and pedroslopez committed Nov 5, 2020
2 parents 6b3c846 + 054ef4a commit 709c43c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
6 changes: 6 additions & 0 deletions src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>}
Expand Down

0 comments on commit 709c43c

Please sign in to comment.