From 8b101d1f3d0027ce5fe8898f7a1d33555660da26 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Fri, 25 Dec 2020 19:08:25 -0400 Subject: [PATCH] feat: get links included in message (#457) --- index.d.ts | 2 ++ src/structures/Message.js | 6 ++++++ src/util/Injected.js | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/index.d.ts b/index.d.ts index 0f8dcc3..1775aff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -499,6 +499,8 @@ declare namespace WAWebJS { to: string, /** Message type */ type: MessageTypes, + /** Links included in the message. */ + links: string[], /** Deletes the message from the chat */ delete: (everyone?: boolean) => Promise, diff --git a/src/structures/Message.js b/src/structures/Message.js index 5e259a0..2722165 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -133,6 +133,12 @@ class Message extends Base { this.mentionedIds = data.mentionedJidList; } + /** + * Links included in the message. + * @type {Array} + */ + this.links = data.links; + return super._patch(data); } diff --git a/src/util/Injected.js b/src/util/Injected.js index d019563..1c1628d 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -250,11 +250,16 @@ exports.LoadUtils = () => { window.WWebJS.getMessageModel = message => { const msg = message.serialize(); + msg.isStatusV3 = message.isStatusV3; + msg.links = (message.getLinks()).map(link => link.href); + if (msg.buttons) { msg.buttons = msg.buttons.serialize(); } + delete msg.pendingAckUpdate; + return msg; };