chore(): generate docs
This commit is contained in:
parent
b296ea8d5a
commit
30b3f5e82e
77 changed files with 1732 additions and 368 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.11">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.31.1-alpha.0 » Source: structures/GroupChat.js</title>
|
||||
<title>whatsapp-web.js 1.32.0 » Source: structures/GroupChat.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>31.<wbr>1-alpha.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>32.<wbr>0</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -113,7 +113,7 @@ class GroupChat extends Chat {
|
|||
|
||||
!Array.isArray(participantIds) &amp;&amp; (participantIds = [participantIds]);
|
||||
const groupWid = window.Store.WidFactory.createWid(groupId);
|
||||
const group = await window.Store.Chat.find(groupWid);
|
||||
const group = window.Store.Chat.get(groupWid) || (await window.Store.Chat.find(groupWid));
|
||||
const participantWids = participantIds.map((p) => window.Store.WidFactory.createWid(p));
|
||||
|
||||
const errorCodes = {
|
||||
|
|
@ -130,8 +130,8 @@ class GroupChat extends Chat {
|
|||
};
|
||||
|
||||
await window.Store.GroupQueryAndUpdate({ id: groupId });
|
||||
const groupMetadata = group.groupMetadata;
|
||||
const groupParticipants = groupMetadata?.participants;
|
||||
|
||||
let groupParticipants = group.groupMetadata?.participants.serialize();
|
||||
|
||||
if (!groupParticipants) {
|
||||
return errorCodes.isGroupEmpty;
|
||||
|
|
@ -141,6 +141,10 @@ class GroupChat extends Chat {
|
|||
return errorCodes.iAmNotAdmin;
|
||||
}
|
||||
|
||||
groupParticipants.map(({ id }) => {
|
||||
return id.server === 'lid' ? window.Store.LidUtils.getPhoneNumber(id) : id;
|
||||
});
|
||||
|
||||
const _getSleepTime = (sleep) => {
|
||||
if (!Array.isArray(sleep) || sleep.length === 2 &amp;&amp; sleep[0] === sleep[1]) {
|
||||
return sleep;
|
||||
|
|
@ -152,16 +156,17 @@ class GroupChat extends Chat {
|
|||
return Math.floor(Math.random() * (sleep[1] - sleep[0] + 1)) + sleep[0];
|
||||
};
|
||||
|
||||
for (const pWid of participantWids) {
|
||||
for (let pWid of participantWids) {
|
||||
const pId = pWid._serialized;
|
||||
|
||||
pWid = pWid.server === 'lid' ? window.Store.LidUtils.getPhoneNumber(pWid) : pWid;
|
||||
|
||||
participantData[pId] = {
|
||||
code: undefined,
|
||||
message: undefined,
|
||||
isInviteV4Sent: false
|
||||
};
|
||||
|
||||
if (groupParticipants.some(p => p.id._serialized === pId)) {
|
||||
if (groupParticipants.some(p => p._serialized === pId)) {
|
||||
participantData[pId].code = 409;
|
||||
participantData[pId].message = errorCodes[409];
|
||||
continue;
|
||||
|
|
@ -174,7 +179,7 @@ class GroupChat extends Chat {
|
|||
}
|
||||
|
||||
const rpcResult =
|
||||
await window.WWebJS.getAddParticipantsRpcResult(groupMetadata, groupWid, pWid);
|
||||
await window.WWebJS.getAddParticipantsRpcResult(groupWid, pWid);
|
||||
const { code: rpcResultCode } = rpcResult;
|
||||
|
||||
participantData[pId].code = rpcResultCode;
|
||||
|
|
@ -186,7 +191,7 @@ class GroupChat extends Chat {
|
|||
window.Store.Contact.gadd(pWid, { silent: true });
|
||||
|
||||
if (rpcResult.name === 'ParticipantRequestCodeCanBeSent' &amp;&amp;
|
||||
(userChat = await window.Store.Chat.find(pWid))) {
|
||||
(userChat = window.Store.Chat.get(pWid) || (await window.Store.Chat.find(pWid)))) {
|
||||
const groupName = group.formattedTitle || group.name;
|
||||
const res = await window.Store.GroupInviteV4.sendGroupInviteMessage(
|
||||
userChat,
|
||||
|
|
@ -197,9 +202,7 @@ class GroupChat extends Chat {
|
|||
comment,
|
||||
await window.WWebJS.getProfilePicThumbToBase64(groupWid)
|
||||
);
|
||||
isInviteV4Sent = window.compareWwebVersions(window.Debug.VERSION, '&lt;', '2.2335.6')
|
||||
? res === 'OK'
|
||||
: res.messageSendResult === 'OK';
|
||||
isInviteV4Sent = res.messageSendResult === 'OK';
|
||||
}
|
||||
|
||||
participantData[pId].isInviteV4Sent = isInviteV4Sent;
|
||||
|
|
@ -224,7 +227,10 @@ class GroupChat extends Chat {
|
|||
return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
|
||||
const chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
const participants = participantIds.map(p => {
|
||||
return chat.groupMetadata.participants.get(p);
|
||||
const wid = window.Store.WidFactory.createWid(p);
|
||||
const lid = wid.server!=='lid' ? window.Store.LidUtils.getCurrentLid(wid) : wid;
|
||||
const phone = wid.server=='lid' ? window.Store.LidUtils.getPhoneNumber(wid) : wid;
|
||||
return chat.groupMetadata.participants.get(lid?._serialized) || chat.groupMetadata.participants.get(phone?._serialized);
|
||||
}).filter(p => Boolean(p));
|
||||
await window.Store.GroupParticipants.removeParticipants(chat, participants);
|
||||
return { status: 200 };
|
||||
|
|
@ -240,7 +246,10 @@ class GroupChat extends Chat {
|
|||
return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
|
||||
const chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
const participants = participantIds.map(p => {
|
||||
return chat.groupMetadata.participants.get(p);
|
||||
const wid = window.Store.WidFactory.createWid(p);
|
||||
const lid = wid.server!=='lid' ? window.Store.LidUtils.getCurrentLid(wid) : wid;
|
||||
const phone = wid.server=='lid' ? window.Store.LidUtils.getPhoneNumber(wid) : wid;
|
||||
return chat.groupMetadata.participants.get(lid?._serialized) || chat.groupMetadata.participants.get(phone?._serialized);
|
||||
}).filter(p => Boolean(p));
|
||||
await window.Store.GroupParticipants.promoteParticipants(chat, participants);
|
||||
return { status: 200 };
|
||||
|
|
@ -256,7 +265,10 @@ class GroupChat extends Chat {
|
|||
return await this.client.pupPage.evaluate(async (chatId, participantIds) => {
|
||||
const chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
const participants = participantIds.map(p => {
|
||||
return chat.groupMetadata.participants.get(p);
|
||||
const wid = window.Store.WidFactory.createWid(p);
|
||||
const lid = wid.server!=='lid' ? window.Store.LidUtils.getCurrentLid(wid) : wid;
|
||||
const phone = wid.server=='lid' ? window.Store.LidUtils.getPhoneNumber(wid) : wid;
|
||||
return chat.groupMetadata.participants.get(lid?._serialized) || chat.groupMetadata.participants.get(phone?._serialized);
|
||||
}).filter(p => Boolean(p));
|
||||
await window.Store.GroupParticipants.demoteParticipants(chat, participants);
|
||||
return { status: 200 };
|
||||
|
|
@ -512,7 +524,7 @@ module.exports = GroupChat;
|
|||
<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.11 on June 30, 2025.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on August 8, 2025.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in a new issue