mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 04:29:15 +00:00
fix: send messages properly when disappearing mode is on (#1174)
* fix: send messages properly when dissappearing mode is on * add `isEphemeral` to message model
This commit is contained in:
2
index.d.ts
vendored
2
index.d.ts
vendored
@@ -547,6 +547,8 @@ declare namespace WAWebJS {
|
|||||||
isStatus: boolean,
|
isStatus: boolean,
|
||||||
/** Indicates if the message is a Gif */
|
/** Indicates if the message is a Gif */
|
||||||
isGif: boolean,
|
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 */
|
/** ID for the Chat that this message was sent to, except if the message was sent by the current user */
|
||||||
from: string,
|
from: string,
|
||||||
/** Indicates if the message was sent by the current user */
|
/** Indicates if the message was sent by the current user */
|
||||||
|
|||||||
@@ -185,6 +185,12 @@ class Message extends Base {
|
|||||||
*/
|
*/
|
||||||
this.isGif = Boolean(data.isGif);
|
this.isGif = Boolean(data.isGif);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the message will disappear after it expires
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.isEphemeral = data.isEphemeral;
|
||||||
|
|
||||||
/** Title */
|
/** Title */
|
||||||
if (data.title) {
|
if (data.title) {
|
||||||
this.title = data.title;
|
this.title = data.title;
|
||||||
|
|||||||
@@ -202,6 +202,12 @@ exports.LoadUtils = () => {
|
|||||||
const extraOptions = options.extraOptions || {};
|
const extraOptions = options.extraOptions || {};
|
||||||
delete options.extraOptions;
|
delete options.extraOptions;
|
||||||
|
|
||||||
|
const ephemeralSettings = {
|
||||||
|
ephemeralDuration: chat.isEphemeralSettingOn() ? chat.getEphemeralSetting() : undefined,
|
||||||
|
ephemeralSettingTimestamp: chat.getEphemeralSettingTimestamp() || undefined,
|
||||||
|
disappearingModeInitiator: chat.getDisappearingModeInitiator() || undefined,
|
||||||
|
};
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
...options,
|
...options,
|
||||||
id: newMsgId,
|
id: newMsgId,
|
||||||
@@ -214,6 +220,7 @@ exports.LoadUtils = () => {
|
|||||||
t: parseInt(new Date().getTime() / 1000),
|
t: parseInt(new Date().getTime() / 1000),
|
||||||
isNewMsg: true,
|
isNewMsg: true,
|
||||||
type: 'chat',
|
type: 'chat',
|
||||||
|
...ephemeralSettings,
|
||||||
...locationOptions,
|
...locationOptions,
|
||||||
...attOptions,
|
...attOptions,
|
||||||
...quotedMsgOptions,
|
...quotedMsgOptions,
|
||||||
@@ -318,6 +325,7 @@ exports.LoadUtils = () => {
|
|||||||
window.WWebJS.getMessageModel = message => {
|
window.WWebJS.getMessageModel = message => {
|
||||||
const msg = message.serialize();
|
const msg = message.serialize();
|
||||||
|
|
||||||
|
msg.isEphemeral = message.isEphemeral;
|
||||||
msg.isStatusV3 = message.isStatusV3;
|
msg.isStatusV3 = message.isStatusV3;
|
||||||
msg.links = (message.getLinks()).map(link => ({
|
msg.links = (message.getLinks()).map(link => ({
|
||||||
link: link.href,
|
link: link.href,
|
||||||
|
|||||||
Reference in New Issue
Block a user