diff --git a/index.d.ts b/index.d.ts index f596284..6e62c54 100644 --- a/index.d.ts +++ b/index.d.ts @@ -547,6 +547,8 @@ declare namespace WAWebJS { isStatus: boolean, /** Indicates if the message is a Gif */ isGif: boolean, + /** Indicates if the message will disappear after it expires */ + isEphemeral: boolean, /** ID for the Chat that this message was sent to, except if the message was sent by the current user */ from: string, /** Indicates if the message was sent by the current user */ diff --git a/src/structures/Message.js b/src/structures/Message.js index 0c582cd..d1e0e87 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -185,6 +185,12 @@ class Message extends Base { */ this.isGif = Boolean(data.isGif); + /** + * Indicates if the message will disappear after it expires + * @type {boolean} + */ + this.isEphemeral = data.isEphemeral; + /** Title */ if (data.title) { this.title = data.title; diff --git a/src/util/Injected.js b/src/util/Injected.js index fe0f9c8..f125f83 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -202,6 +202,12 @@ exports.LoadUtils = () => { const extraOptions = options.extraOptions || {}; delete options.extraOptions; + const ephemeralSettings = { + ephemeralDuration: chat.isEphemeralSettingOn() ? chat.getEphemeralSetting() : undefined, + ephemeralSettingTimestamp: chat.getEphemeralSettingTimestamp() || undefined, + disappearingModeInitiator: chat.getDisappearingModeInitiator() || undefined, + }; + const message = { ...options, id: newMsgId, @@ -214,6 +220,7 @@ exports.LoadUtils = () => { t: parseInt(new Date().getTime() / 1000), isNewMsg: true, type: 'chat', + ...ephemeralSettings, ...locationOptions, ...attOptions, ...quotedMsgOptions, @@ -318,6 +325,7 @@ exports.LoadUtils = () => { window.WWebJS.getMessageModel = message => { const msg = message.serialize(); + msg.isEphemeral = message.isEphemeral; msg.isStatusV3 = message.isStatusV3; msg.links = (message.getLinks()).map(link => ({ link: link.href,