fix: Add protocolMessageKey and fix revoked messages to preserve original before.id (#3715)
* Add protocolMessageKey and fix revoke * Add protocolMessageKey and fix revoke * docs: add explanation
This commit is contained in:
parent
2ac982ee1c
commit
912b78d299
3 changed files with 16 additions and 0 deletions
5
index.d.ts
vendored
5
index.d.ts
vendored
|
|
@ -1086,6 +1086,11 @@ declare namespace WAWebJS {
|
|||
latestEditSenderTimestampMs?: number,
|
||||
/** Last edit message author */
|
||||
latestEditMsgKey?: MessageId,
|
||||
/**
|
||||
* Protocol message key.
|
||||
* Can be used to retrieve the ID of an original message that was revoked.
|
||||
*/
|
||||
protocolMessageKey?: MessageId,
|
||||
/** Message buttons */
|
||||
dynamicReplyButtons?: object,
|
||||
/** Selected button ID */
|
||||
|
|
|
|||
|
|
@ -468,6 +468,9 @@ class Client extends EventEmitter {
|
|||
let revoked_msg;
|
||||
if (last_message && msg.id.id === last_message.id.id) {
|
||||
revoked_msg = new Message(this, last_message);
|
||||
|
||||
if (message.protocolMessageKey)
|
||||
revoked_msg.id = { ...message.protocolMessageKey };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -258,6 +258,14 @@ class Message extends Base {
|
|||
this.latestEditMsgKey = data.latestEditMsgKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protocol message key.
|
||||
* Can be used to retrieve the ID of an original message that was revoked.
|
||||
*/
|
||||
if (data.protocolMessageKey) {
|
||||
this.protocolMessageKey = data.protocolMessageKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links included in the message.
|
||||
* @type {Array<{link: string, isSuspicious: boolean}>}
|
||||
|
|
|
|||
Loading…
Reference in a new issue