mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
158 lines
4.6 KiB
HTML
158 lines
4.6 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta name="generator" content="JSDoc 3.6.6">
|
|
<meta charset="utf-8">
|
|
<title>whatsapp-web.js 1.12.5 » Source: structures/GroupNotification.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">
|
|
<link href="css/baseline.css" rel="stylesheet">
|
|
</head>
|
|
|
|
<body onload="prettyPrint()">
|
|
<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>12.<wbr>5</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div id="jsdoc-body-container">
|
|
<div id="jsdoc-content">
|
|
<div id="jsdoc-content-container">
|
|
<div id="jsdoc-banner" role="banner">
|
|
</div>
|
|
<div id="jsdoc-main" role="main">
|
|
<header class="page-header">
|
|
<h1>Source: structures/GroupNotification.js</h1>
|
|
</header>
|
|
<article>
|
|
<pre class="prettyprint linenums"><code>'use strict';
|
|
|
|
const Base = require('./Base');
|
|
|
|
/**
|
|
* Represents a GroupNotification on WhatsApp
|
|
* @extends {Base}
|
|
*/
|
|
class GroupNotification extends Base {
|
|
constructor(client, data) {
|
|
super(client);
|
|
|
|
if(data) this._patch(data);
|
|
}
|
|
|
|
_patch(data) {
|
|
/**
|
|
* ID that represents the groupNotification
|
|
* @type {object}
|
|
*/
|
|
this.id = data.id;
|
|
|
|
/**
|
|
* Extra content
|
|
* @type {string}
|
|
*/
|
|
this.body = data.body || '';
|
|
|
|
/**
|
|
* GroupNotification type
|
|
* @type {GroupNotificationTypes}
|
|
*/
|
|
this.type = data.subtype;
|
|
|
|
/**
|
|
* Unix timestamp for when the groupNotification was created
|
|
* @type {number}
|
|
*/
|
|
this.timestamp = data.t;
|
|
|
|
/**
|
|
* ID for the Chat that this groupNotification was sent for.
|
|
*
|
|
* @type {string}
|
|
*/
|
|
this.chatId = typeof (data.from) === 'object' ? data.from._serialized : data.from;
|
|
|
|
/**
|
|
* ContactId for the user that produced the GroupNotification.
|
|
* @type {string}
|
|
*/
|
|
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
|
|
|
|
/**
|
|
* Contact IDs for the users that were affected by this GroupNotification.
|
|
* @type {Array&lt;string>}
|
|
*/
|
|
this.recipientIds = [];
|
|
|
|
if (data.recipients) {
|
|
this.recipientIds = data.recipients;
|
|
}
|
|
|
|
return super._patch(data);
|
|
}
|
|
|
|
/**
|
|
* Returns the Chat this groupNotification was sent in
|
|
* @returns {Promise&lt;Chat>}
|
|
*/
|
|
getChat() {
|
|
return this.client.getChatById(this.chatId);
|
|
}
|
|
|
|
/**
|
|
* Returns the Contact this GroupNotification was produced by
|
|
* @returns {Promise&lt;Contact>}
|
|
*/
|
|
getContact() {
|
|
return this.client.getContactById(this.author);
|
|
}
|
|
|
|
/**
|
|
* Returns the Contacts affected by this GroupNotification.
|
|
* @returns {Promise&lt;Array&lt;Contact>>}
|
|
*/
|
|
async getRecipients() {
|
|
return await Promise.all(this.recipientIds.map(async m => await this.client.getContactById(m)));
|
|
}
|
|
|
|
/**
|
|
* Sends a message to the same chat this GroupNotification was produced in.
|
|
*
|
|
* @param {string|MessageMedia|Location} content
|
|
* @param {object} options
|
|
* @returns {Promise&lt;Message>}
|
|
*/
|
|
async reply(content, options={}) {
|
|
return this.client.sendMessage(this.chatId, content, options);
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = GroupNotification;
|
|
</code></pre>
|
|
</article>
|
|
</div>
|
|
</div>
|
|
<nav id="jsdoc-toc-nav" role="navigation"></nav>
|
|
</div>
|
|
</div>
|
|
<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.6 on February 25, 2021.
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
<script src="scripts/jquery.min.js"></script>
|
|
<script src="scripts/tree.jquery.js"></script>
|
|
<script src="scripts/prettify.js"></script>
|
|
<script src="scripts/jsdoc-toc.js"></script>
|
|
<script src="scripts/linenumber.js"></script>
|
|
<script src="scripts/scrollanchor.js"></script>
|
|
</body>
|
|
|
|
</html> |