From 75296b652bca722b689c2d64b34e3b04bb413130 Mon Sep 17 00:00:00 2001 From: Lucas Rosa Date: Mon, 26 Oct 2020 19:49:06 -0300 Subject: [PATCH] feat: add received vcards to the message. --- src/structures/Message.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 5214fe8..f30f98e 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -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 @@ -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} + */ + 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}