Skip to content

Commit

Permalink
feat: add received vcards to the message.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrosa90 committed Oct 26, 2020
1 parent b15ec76 commit 75296b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Message extends Base {
* Message content
* @type {string}
*/
this.body = data.type === MessageTypes.CONTACT_CARD_MULTI ? data.vcardList.map((c) => c.vcard) : this.hasMedia ? data.caption || '' : data.body || '';
this.body = this.hasMedia ? data.caption || '' : data.body || '';

/**
* Message type
Expand Down 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, if the message is a vcard or multiple vcards.
* @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 75296b6

Please sign in to comment.