mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 03:59:16 +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,
|
||||
/** Message type */
|
||||
type: MessageTypes,
|
||||
/** Links included in the message. */
|
||||
links: string[],
|
||||
|
||||
/** Deletes the message from the chat */
|
||||
delete: (everyone?: boolean) => Promise<void>,
|
||||
|
||||
@@ -133,6 +133,12 @@ class Message extends Base {
|
||||
this.mentionedIds = data.mentionedJidList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links included in the message.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
this.links = data.links;
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user