mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 20:49:14 +00:00
feat: get links included in message (#457)
This commit is contained in:
2
index.d.ts
vendored
2
index.d.ts
vendored
@@ -499,6 +499,8 @@ declare namespace WAWebJS {
|
|||||||
to: string,
|
to: string,
|
||||||
/** Message type */
|
/** Message type */
|
||||||
type: MessageTypes,
|
type: MessageTypes,
|
||||||
|
/** Links included in the message. */
|
||||||
|
links: string[],
|
||||||
|
|
||||||
/** Deletes the message from the chat */
|
/** Deletes the message from the chat */
|
||||||
delete: (everyone?: boolean) => Promise<void>,
|
delete: (everyone?: boolean) => Promise<void>,
|
||||||
|
|||||||
@@ -133,6 +133,12 @@ class Message extends Base {
|
|||||||
this.mentionedIds = data.mentionedJidList;
|
this.mentionedIds = data.mentionedJidList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Links included in the message.
|
||||||
|
* @type {Array<string>}
|
||||||
|
*/
|
||||||
|
this.links = data.links;
|
||||||
|
|
||||||
return super._patch(data);
|
return super._patch(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,11 +250,16 @@ exports.LoadUtils = () => {
|
|||||||
|
|
||||||
window.WWebJS.getMessageModel = message => {
|
window.WWebJS.getMessageModel = message => {
|
||||||
const msg = message.serialize();
|
const msg = message.serialize();
|
||||||
|
|
||||||
msg.isStatusV3 = message.isStatusV3;
|
msg.isStatusV3 = message.isStatusV3;
|
||||||
|
msg.links = (message.getLinks()).map(link => link.href);
|
||||||
|
|
||||||
if (msg.buttons) {
|
if (msg.buttons) {
|
||||||
msg.buttons = msg.buttons.serialize();
|
msg.buttons = msg.buttons.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete msg.pendingAckUpdate;
|
delete msg.pendingAckUpdate;
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user