chore: mark version v1.20.0
This commit is contained in:
parent
2b8eb518ed
commit
915763a8d0
60 changed files with 4356 additions and 3441 deletions
|
|
@ -2,9 +2,9 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.7">
|
||||
<meta name="generator" content="JSDoc 3.6.11">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.19.5 » Source: structures/Message.js</title>
|
||||
<title>whatsapp-web.js 1.20.0 » Source: structures/Message.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>19.<wbr>5</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>20.<wbr>0</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -36,7 +36,8 @@ const MessageMedia = require('./MessageMedia');
|
|||
const Location = require('./Location');
|
||||
const Order = require('./Order');
|
||||
const Payment = require('./Payment');
|
||||
const { MessageTypes } = require('../util/Constants');
|
||||
const Reaction = require('./Reaction');
|
||||
const {MessageTypes} = require('../util/Constants');
|
||||
|
||||
/**
|
||||
* Represents a Message on WhatsApp
|
||||
|
|
@ -119,8 +120,7 @@ class Message extends Base {
|
|||
* String that represents from which device type the message was sent
|
||||
* @type {string}
|
||||
*/
|
||||
this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web';
|
||||
|
||||
this.deviceType = typeof data.id.id === 'string' &amp;&amp; data.id.id.length > 21 ? 'android' : typeof data.id.id === 'string' &amp;&amp; data.id.id.substring(0, 2) === '3A' ? 'ios' : 'web';
|
||||
/**
|
||||
* Indicates if the message was forwarded
|
||||
* @type {boolean}
|
||||
|
|
@ -139,7 +139,7 @@ class Message extends Base {
|
|||
* Indicates if the message is a status update
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isStatus = data.isStatusV3;
|
||||
this.isStatus = data.isStatusV3 || data.id.remote === 'status@broadcast';
|
||||
|
||||
/**
|
||||
* Indicates if the message was starred
|
||||
|
|
@ -165,6 +165,12 @@ class Message extends Base {
|
|||
*/
|
||||
this.hasQuotedMsg = data.quotedMsg ? true : false;
|
||||
|
||||
/**
|
||||
* Indicates whether there are reactions to the message
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.hasReaction = data.hasReaction ? true : false;
|
||||
|
||||
/**
|
||||
* Indicates the duration of the message in seconds
|
||||
* @type {string}
|
||||
|
|
@ -467,15 +473,16 @@ class Message extends Base {
|
|||
* @param {?boolean} everyone If true and the message is sent by the current user or the user is an admin, will delete it for everyone in the chat.
|
||||
*/
|
||||
async delete(everyone) {
|
||||
await this.client.pupPage.evaluate((msgId, everyone) => {
|
||||
await this.client.pupPage.evaluate(async (msgId, everyone) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
let chat = await window.Store.Chat.find(msg.id.remote);
|
||||
|
||||
const canRevoke = window.Store.MsgActionChecks.canSenderRevokeMsg(msg) || window.Store.MsgActionChecks.canAdminRevokeMsg(msg);
|
||||
if (everyone &amp;&amp; canRevoke) {
|
||||
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' });
|
||||
return window.Store.Cmd.sendRevokeMsgs(chat, [msg], { clearMedia: true, type: msg.id.fromMe ? 'Sender' : 'Admin' });
|
||||
}
|
||||
|
||||
return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true);
|
||||
return window.Store.Cmd.sendDeleteMsgs(chat, [msg], true);
|
||||
}, this.id._serialized, everyone);
|
||||
}
|
||||
|
||||
|
|
@ -483,11 +490,12 @@ class Message extends Base {
|
|||
* Stars this message
|
||||
*/
|
||||
async star() {
|
||||
await this.client.pupPage.evaluate((msgId) => {
|
||||
await this.client.pupPage.evaluate(async (msgId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
|
||||
if (window.Store.MsgActionChecks.canStarMsg(msg)) {
|
||||
return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false);
|
||||
let chat = await window.Store.Chat.find(msg.id.remote);
|
||||
return window.Store.Cmd.sendStarMsgs(chat, [msg], false);
|
||||
}
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
|
@ -496,11 +504,12 @@ class Message extends Base {
|
|||
* Unstars this message
|
||||
*/
|
||||
async unstar() {
|
||||
await this.client.pupPage.evaluate((msgId) => {
|
||||
await this.client.pupPage.evaluate(async (msgId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
|
||||
if (window.Store.MsgActionChecks.canStarMsg(msg)) {
|
||||
return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false);
|
||||
let chat = await window.Store.Chat.find(msg.id.remote);
|
||||
return window.Store.Cmd.sendUnstarMsgs(chat, [msg], false);
|
||||
}
|
||||
}, this.id._serialized);
|
||||
}
|
||||
|
|
@ -560,6 +569,44 @@ class Message extends Base {
|
|||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reaction List
|
||||
* @typedef {Object} ReactionList
|
||||
* @property {string} id Original emoji
|
||||
* @property {string} aggregateEmoji aggregate emoji
|
||||
* @property {boolean} hasReactionByMe Flag who sent the reaction
|
||||
* @property {Array&lt;Reaction>} senders Reaction senders, to this message
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the reactions associated with the given message
|
||||
* @return {Promise&lt;ReactionList[]>}
|
||||
*/
|
||||
async getReactions() {
|
||||
if (!this.hasReaction) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const reactions = await this.client.pupPage.evaluate(async (msgId) => {
|
||||
const msgReactions = await window.Store.Reactions.find(msgId);
|
||||
if (!msgReactions || !msgReactions.reactions.length) return null;
|
||||
return msgReactions.reactions.serialize();
|
||||
}, this.id._serialized);
|
||||
|
||||
if (!reactions) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return reactions.map(reaction => {
|
||||
reaction.senders = reaction.senders.map(sender => {
|
||||
sender.timestamp = Math.round(sender.timestamp / 1000);
|
||||
return new Reaction(this.client, sender);
|
||||
});
|
||||
return reaction;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Message;
|
||||
|
|
@ -573,7 +620,7 @@ module.exports = Message;
|
|||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.7 on March 18, 2023.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on May 19, 2023.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in a new issue