From 30b3f5e82ec33a0b112df39868a7d69a7260b575 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Fri, 8 Aug 2025 21:39:18 +0000 Subject: [PATCH] chore(): generate docs --- docs/Base.html | 6 +- docs/BaseAuthStrategy.html | 6 +- docs/Broadcast.html | 6 +- docs/BusinessContact.html | 6 +- docs/Buttons.html | 6 +- docs/Call.html | 6 +- docs/Channel.html | 6 +- docs/Chat.html | 22 +- docs/Client.html | 448 ++++++++++++++++++- docs/Client.js.html | 249 ++++++++--- docs/ClientInfo.html | 6 +- docs/Contact.html | 6 +- docs/GroupChat.html | 28 +- docs/GroupNotification.html | 6 +- docs/InterfaceController.html | 6 +- docs/Label.html | 6 +- docs/List.html | 6 +- docs/LocalAuth.html | 6 +- docs/LocalWebCache.html | 6 +- docs/Location.html | 6 +- docs/Message.html | 55 ++- docs/MessageMedia.html | 6 +- docs/NoAuth.html | 6 +- docs/Order.html | 6 +- docs/Poll.html | 6 +- docs/PollVote.html | 6 +- docs/PrivateChat.html | 24 +- docs/PrivateContact.html | 6 +- docs/Product.html | 6 +- docs/Reaction.html | 6 +- docs/RemoteAuth.html | 6 +- docs/RemoteWebCache.html | 6 +- docs/ScheduledEvent.html | 235 ++++++++++ docs/Util.html | 6 +- docs/WebCache.html | 6 +- docs/authStrategies_BaseAuthStrategy.js.html | 6 +- docs/authStrategies_LocalAuth.js.html | 6 +- docs/authStrategies_NoAuth.js.html | 6 +- docs/authStrategies_RemoteAuth.js.html | 6 +- docs/global.html | 205 ++++++++- docs/index.html | 206 ++++++--- docs/scripts/jsdoc-toc.js | 2 +- docs/structures_Base.js.html | 6 +- docs/structures_Broadcast.js.html | 6 +- docs/structures_BusinessContact.js.html | 6 +- docs/structures_Buttons.js.html | 6 +- docs/structures_Call.js.html | 6 +- docs/structures_Channel.js.html | 6 +- docs/structures_Chat.js.html | 14 +- docs/structures_ClientInfo.js.html | 6 +- docs/structures_Contact.js.html | 6 +- docs/structures_GroupChat.js.html | 46 +- docs/structures_GroupNotification.js.html | 6 +- docs/structures_Label.js.html | 6 +- docs/structures_List.js.html | 6 +- docs/structures_Location.js.html | 6 +- docs/structures_Message.js.html | 43 +- docs/structures_MessageMedia.js.html | 6 +- docs/structures_Order.js.html | 6 +- docs/structures_Payment.js.html | 6 +- docs/structures_Poll.js.html | 6 +- docs/structures_PollVote.js.html | 6 +- docs/structures_PrivateChat.js.html | 6 +- docs/structures_PrivateContact.js.html | 6 +- docs/structures_Product.js.html | 6 +- docs/structures_ProductMetadata.js.html | 6 +- docs/structures_Reaction.js.html | 6 +- docs/structures_ScheduledEvent.js.html | 125 ++++++ docs/util_Constants.js.html | 15 +- docs/util_Injected_LegacyStore.js.html | 6 +- docs/util_Injected_Store.js.html | 17 +- docs/util_InterfaceController.js.html | 6 +- docs/util_Puppeteer.js.html | 6 +- docs/util_Util.js.html | 6 +- docs/webCache_LocalWebCache.js.html | 6 +- docs/webCache_RemoteWebCache.js.html | 6 +- docs/webCache_WebCache.js.html | 6 +- 77 files changed, 1732 insertions(+), 368 deletions(-) create mode 100644 docs/ScheduledEvent.html create mode 100644 docs/structures_ScheduledEvent.js.html diff --git a/docs/Base.html b/docs/Base.html index 490887d..6f08936 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Base + whatsapp-web.js 1.32.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index d308829..90ad7a1 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.32.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ diff --git a/docs/Broadcast.html b/docs/Broadcast.html index 284a55d..9598c7a 100644 --- a/docs/Broadcast.html +++ b/docs/Broadcast.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Broadcast + whatsapp-web.js 1.32.0 » Class: Broadcast @@ -15,7 +15,7 @@ @@ -152,7 +152,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 9c57c72..a647978 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: BusinessContact + whatsapp-web.js 1.32.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index 2aff3a8..d13eac6 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Buttons + whatsapp-web.js 1.32.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@ Returns: [{ buttonId:'customId',buttonText:{'displayText':&# diff --git a/docs/Call.html b/docs/Call.html index 8bbdb04..64408b0 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Call + whatsapp-web.js 1.32.0 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@ diff --git a/docs/Channel.html b/docs/Channel.html index d2bb34f..556844f 100644 --- a/docs/Channel.html +++ b/docs/Channel.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Channel + whatsapp-web.js 1.32.0 » Class: Channel @@ -15,7 +15,7 @@ @@ -896,7 +896,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index 4929340..e966f58 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Chat + whatsapp-web.js 1.32.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -117,6 +117,9 @@
getLabels()
+
getPinnedMessages()
+
+
markUnread()
@@ -132,13 +135,13 @@
sendSeen()
-
sendStateRecording()
-
-
+
sendStateRecording()
+
+
sendStateTyping()
@@ -394,6 +397,13 @@
async
+

getPinnedMessages()

+

Gets instances of all pinned messages in a chat

+
+
Returns
+
+
+
async

markUnread()

Mark this chat as unread

@@ -567,7 +577,7 @@
diff --git a/docs/Client.html b/docs/Client.html index 6e3610e..3c344ba 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -3,7 +3,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Client + whatsapp-web.js 1.32.0 » Class: Client @@ -13,7 +13,7 @@ @@ -23,7 +23,7 @@
+
revokeChannelAdminInvite(channelId, userId)
+
+
saveOrEditAddressbookContact(phoneNumber, firstName, lastName[, syncToAddressbook])
@@ -255,6 +264,9 @@
sendPresenceUnavailable()
+
sendResponseToScheduledEvent(response, eventMessageId)
+
+
sendSeen(chatId)
@@ -335,20 +347,23 @@
chat_removed
+
code
+
+
contact_changed
disconnected
-
group_admin_changed
-
-
+
group_admin_changed
+
+
group_join
@@ -373,14 +388,14 @@
message_ack
-
message_ciphertext
-
-
+
message_ciphertext
+
+
message_create
@@ -650,6 +665,36 @@ +

deviceName

+ + +

 

+ + +

 

+ + +

Sets the device name of a current linked device., i.e.: 'TEST'.

+ + + + + +

browserName

+ + +

 

+ + +

 

+ + +

Sets the browser name of a current linked device, i.e.: 'Firefox'.

+ + + + +

proxyAuthentication

@@ -1381,6 +1426,86 @@ Private function

+ + + +
+ +
async

Generates a WhatsApp call link (video call or voice call)

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

startTime

+
+

Date

+
+

 

+
+

The start time of the call

+
+

callType

+
+

string

+
+

 

+
+

The type of a WhatsApp call link to generate, valid values are: video | voice

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing string 

The WhatsApp call link (https://call.whatsapp.com/video/XxXxXxXxXxXxXx) or an empty string if a generation failed.

@@ -2422,6 +2547,71 @@ So for a non-enterprise user with one WaWeb connection it should return "2& +
+ +
async

getContactLidAndPhone(userIds) → Promise containing Array of {lid: string, pn: string}

Get lid and phone number for multiple users

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

userIds

+
+

Array of string

+
+

 

+
+

Array of user IDs

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing Array of {lid: string, pn: string} 

+ + +
async

getContacts() → Promise containing Array of Contact

Get all current contact instances

@@ -2879,6 +3069,71 @@ Will return null if the number is not registered on WhatsApp.

+ + +
async

getPinnedMessages(chatId)

Gets instances of all pinned messages in a chat

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+

The chat ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+
+ + +
async

getProfilePicUrl(contactId) → Promise containing string

Returns the contact ID's profile picture URL, if privacy settings allow it

@@ -3434,7 +3689,7 @@ Private function

-
async

requestPairingCode(phoneNumber, showNotification) → Promise containing string

Request authentication via pairing code instead of QR code

+
async

requestPairingCode(phoneNumber[, showNotification][, intervalMs]) → Promise containing string

Request authentication via pairing code instead of QR code

@@ -3472,7 +3727,7 @@ Private function

boolean

-

 

+

Yes

Show notification to pair on phone number

@@ -3480,6 +3735,22 @@ Private function

+ + +

intervalMs

+ + +

number

+ + +

Yes

+ + +

The interval in milliseconds on how frequent to generate pairing code (WhatsApp default to 3 minutes)

+

Defaults to 180000.

+ + + @@ -4287,6 +4558,86 @@ the lastMessage property of a found channel will be 'null' + + + + + +
async

sendResponseToScheduledEvent(response, eventMessageId) → Promise containing boolean

Sends a response to the scheduled event message, indicating whether a user is going to attend the event or not

+ + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

response

+
+

number

+
+

 

+
+

The response code to the scheduled event message. Valid values are: 0 for NONE response (removes a previous response) | 1 for GOING | 2 for NOT GOING | 3 for MAYBE going

+
+

eventMessageId

+
+

string

+
+

 

+
+

The scheduled event message ID

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

Promise containing boolean 

@@ -5720,6 +6071,71 @@ Note: the user you are transferring the channel ownership to must be a channel a + + + +
+ +

code

Emitted when a pairing code is received

+ + +
+

Parameter

+ + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

code

+
+

string

+
+

 

+
+

Code

+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
Returns
+

string 

Code that was just received

@@ -7383,7 +7799,7 @@ shows a user's current selected option(s) on the poll

diff --git a/docs/Client.js.html b/docs/Client.js.html index 3b7cf43..5c82890 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: Client.js + whatsapp-web.js 1.32.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -46,7 +46,7 @@ const { LoadUtils } = require('./util/Injected/Utils'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); const WebCacheFactory = require('./webCache/WebCacheFactory'); -const { Broadcast, Buttons, Call, ClientInfo, Contact, GroupNotification, Label, List, Location, Message, MessageMedia, Poll, PollVote, Reaction } = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, Poll, PollVote, GroupNotification, Label, Call, Buttons, List, Reaction, Broadcast, ScheduledEvent } = require('./structures'); const NoAuth = require('./authStrategies/NoAuth'); const {exposeFunctionIfAbsent} = require('./util/Puppeteer'); @@ -67,6 +67,8 @@ const {exposeFunctionIfAbsent} = require('./util/Puppeteer'); * @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.ffmpegPath - Ffmpeg path to use when formatting videos to webp while sending stickers * @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy. + * @param {string} options.deviceName - Sets the device name of a current linked device., i.e.: 'TEST'. + * @param {string} options.browserName - Sets the browser name of a current linked device, i.e.: 'Firefox'. * @param {object} options.proxyAuthentication - Proxy Authentication object. * * @fires Client#qr @@ -125,7 +127,8 @@ class Client extends EventEmitter { */ async inject() { await this.pupPage.waitForFunction('window.Debug?.VERSION != undefined', {timeout: this.options.authTimeoutMs}); - + await this.setDeviceName(this.options.deviceName, this.options.browserName); + const pairWithPhoneNumber = this.options.pairWithPhoneNumber; const version = await this.getWWebVersion(); const isCometOrAbove = parseInt(version.split('.')?.[1]) >= 3000; @@ -171,41 +174,55 @@ class Client extends EventEmitter { return; } - // Register qr events - let qrRetries = 0; - await exposeFunctionIfAbsent(this.pupPage, 'onQRChangedEvent', async (qr) => { - /** - * Emitted when a QR code is received - * @event Client#qr - * @param {string} qr QR Code - */ - this.emit(Events.QR_RECEIVED, qr); - if (this.options.qrMaxRetries > 0) { - qrRetries++; - if (qrRetries > this.options.qrMaxRetries) { - this.emit(Events.DISCONNECTED, 'Max qrcode retries reached'); - await this.destroy(); + // Register qr/code events + if (pairWithPhoneNumber.phoneNumber) { + await exposeFunctionIfAbsent(this.pupPage, 'onCodeReceivedEvent', async (code) => { + /** + * Emitted when a pairing code is received + * @event Client#code + * @param {string} code Code + * @returns {string} Code that was just received + */ + this.emit(Events.CODE_RECEIVED, code); + return code; + }); + this.requestPairingCode(pairWithPhoneNumber.phoneNumber, pairWithPhoneNumber.showNotification, pairWithPhoneNumber.intervalMs); + } else { + let qrRetries = 0; + await exposeFunctionIfAbsent(this.pupPage, 'onQRChangedEvent', async (qr) => { + /** + * Emitted when a QR code is received + * @event Client#qr + * @param {string} qr QR Code + */ + this.emit(Events.QR_RECEIVED, qr); + if (this.options.qrMaxRetries > 0) { + qrRetries++; + if (qrRetries > this.options.qrMaxRetries) { + this.emit(Events.DISCONNECTED, 'Max qrcode retries reached'); + await this.destroy(); + } } - } - }); + }); - await this.pupPage.evaluate(async () => { - const registrationInfo = await window.AuthStore.RegistrationUtils.waSignalStore.getRegistrationInfo(); - const noiseKeyPair = await window.AuthStore.RegistrationUtils.waNoiseInfo.get(); - const staticKeyB64 = window.AuthStore.Base64Tools.encodeB64(noiseKeyPair.staticKeyPair.pubKey); - const identityKeyB64 = window.AuthStore.Base64Tools.encodeB64(registrationInfo.identityKeyPair.pubKey); - const advSecretKey = await window.AuthStore.RegistrationUtils.getADVSecretKey(); - const platform = window.AuthStore.RegistrationUtils.DEVICE_PLATFORM; - const getQR = (ref) => ref + ',' + staticKeyB64 + ',' + identityKeyB64 + ',' + advSecretKey + ',' + platform; - - window.onQRChangedEvent(getQR(window.AuthStore.Conn.ref)); // initial qr - window.AuthStore.Conn.on('change:ref', (_, ref) => { window.onQRChangedEvent(getQR(ref)); }); // future QR changes - }); + await this.pupPage.evaluate(async () => { + const registrationInfo = await window.AuthStore.RegistrationUtils.waSignalStore.getRegistrationInfo(); + const noiseKeyPair = await window.AuthStore.RegistrationUtils.waNoiseInfo.get(); + const staticKeyB64 = window.AuthStore.Base64Tools.encodeB64(noiseKeyPair.staticKeyPair.pubKey); + const identityKeyB64 = window.AuthStore.Base64Tools.encodeB64(registrationInfo.identityKeyPair.pubKey); + const advSecretKey = await window.AuthStore.RegistrationUtils.getADVSecretKey(); + const platform = window.AuthStore.RegistrationUtils.DEVICE_PLATFORM; + const getQR = (ref) => ref + ',' + staticKeyB64 + ',' + identityKeyB64 + ',' + advSecretKey + ',' + platform; + + window.onQRChangedEvent(getQR(window.AuthStore.Conn.ref)); // initial qr + window.AuthStore.Conn.on('change:ref', (_, ref) => { window.onQRChangedEvent(getQR(ref)); }); // future QR changes + }); + } } await exposeFunctionIfAbsent(this.pupPage, 'onAuthAppStateChangedEvent', async (state) => { - if (state == 'UNPAIRED_IDLE') { + if (state == 'UNPAIRED_IDLE' && !pairWithPhoneNumber.phoneNumber) { // refresh qr code window.Store.Cmd.refreshQR(); } @@ -374,15 +391,32 @@ class Client extends EventEmitter { /** * Request authentication via pairing code instead of QR code * @param {string} phoneNumber - Phone number in international, symbol-free format (e.g. 12025550108 for US, 551155501234 for Brazil) - * @param {boolean} showNotification - Show notification to pair on phone number + * @param {boolean} [showNotification = true] - Show notification to pair on phone number + * @param {number} [intervalMs = 180000] - The interval in milliseconds on how frequent to generate pairing code (WhatsApp default to 3 minutes) * @returns {Promise<string>} - Returns a pairing code in format "ABCDEFGH" */ - async requestPairingCode(phoneNumber, showNotification = true) { - return await this.pupPage.evaluate(async (phoneNumber, showNotification) => { - window.AuthStore.PairingCodeLinkUtils.setPairingType('ALT_DEVICE_LINKING'); - await window.AuthStore.PairingCodeLinkUtils.initializeAltDeviceLinking(); - return window.AuthStore.PairingCodeLinkUtils.startAltLinkingFlow(phoneNumber, showNotification); - }, phoneNumber, showNotification); + async requestPairingCode(phoneNumber, showNotification = true, intervalMs = 180000) { + return await this.pupPage.evaluate(async (phoneNumber, showNotification, intervalMs) => { + const getCode = async () => { + while (!window.AuthStore.PairingCodeLinkUtils) { + await new Promise(resolve => setTimeout(resolve, 250)); + } + window.AuthStore.PairingCodeLinkUtils.setPairingType('ALT_DEVICE_LINKING'); + await window.AuthStore.PairingCodeLinkUtils.initializeAltDeviceLinking(); + return window.AuthStore.PairingCodeLinkUtils.startAltLinkingFlow(phoneNumber, showNotification); + }; + if (window.codeInterval) { + clearInterval(window.codeInterval); // remove existing interval + } + window.codeInterval = setInterval(async () => { + if (window.AuthStore.AppState.state != 'UNPAIRED' && window.AuthStore.AppState.state != 'UNPAIRED_IDLE') { + clearInterval(window.codeInterval); + return; + } + window.onCodeReceivedEvent(await getCode()); + }, intervalMs); + return window.onCodeReceivedEvent(await getCode()); + }, phoneNumber, showNotification, intervalMs); } /** @@ -844,6 +878,19 @@ class Client extends EventEmitter { }); } + async setDeviceName(deviceName, browserName) { + (deviceName || browserName) && await this.pupPage.evaluate((deviceName, browserName) => { + const func = window.require('WAWebMiscBrowserUtils').info; + window.require('WAWebMiscBrowserUtils').info = () => { + return { + ...func(), + ...(deviceName ? { os: deviceName } : {}), + ...(browserName ? { name: browserName } : {}) + }; + }; + }, deviceName, browserName); + } + /** * Mark as seen for the Chat * @param {string} chatId @@ -954,6 +1001,9 @@ class Client extends EventEmitter { } else if (content instanceof Poll) { internalOptions.poll = content; content = ''; + } else if (content instanceof ScheduledEvent) { + internalOptions.event = content; + content = ''; } else if (content instanceof Contact) { internalOptions.contactCard = content.id._serialized; content = ''; @@ -1158,6 +1208,29 @@ class Client extends EventEmitter { return null; } + /** + * Gets instances of all pinned messages in a chat + * @param {string} chatId The chat ID + * @returns {Promise<[Message]|[]>} + */ + async getPinnedMessages(chatId) { + const pinnedMsgs = await this.pupPage.evaluate(async (chatId) => { + const chatWid = window.Store.WidFactory.createWid(chatId); + const chat = window.Store.Chat.get(chatWid) ?? await window.Store.Chat.find(chatWid); + if (!chat) return []; + + const msgs = await window.Store.PinnedMsgUtils.getTable().equals(['chatId'], chatWid.toString()); + + const pinnedMsgs = msgs.map((msg) => window.Store.Msg.get(msg.parentMsgKey)); + + return !pinnedMsgs.length + ? [] + : pinnedMsgs.map((msg) => window.WWebJS.getMessageModel(msg)); + }, chatId); + + return pinnedMsgs.map((msg) => new Message(this, msg)); + } + /** * Returns an object with information about the invite code's group * @param {string} inviteCode @@ -1559,6 +1632,10 @@ class Client extends EventEmitter { * @property {string|undefined} parentGroupId The ID of a parent community group to link the newly created group with (won't take an effect if the group is been creating with myself only) * @property {boolean} [autoSendInviteV4 = true] If true, the inviteV4 will be sent to those participants who have restricted others from being automatically added to groups, otherwise the inviteV4 won't be sent (true by default) * @property {string} [comment = ''] The comment to be added to an inviteV4 (empty string by default) + * @property {boolean} [memberAddMode = false] If true, only admins can add members to the group (false by default) + * @property {boolean} [membershipApprovalMode = false] If true, group admins will be required to approve anyone who wishes to join the group (false by default) + * @property {boolean} [isRestrict = true] If true, only admins can change group group info (true by default) + * @property {boolean} [isAnnounce = false] If true, only admins can send messages (false by default) */ /** @@ -1573,7 +1650,12 @@ class Client extends EventEmitter { participants.map(p => (p instanceof Contact) ? p.id._serialized : p); return await this.pupPage.evaluate(async (title, participants, options) => { - const { messageTimer = 0, parentGroupId, autoSendInviteV4 = true, comment = '' } = options; + const { + messageTimer = 0, + parentGroupId, + autoSendInviteV4 = true, + comment = '', + } = options; const participantData = {}, participantWids = [], failedParticipants = []; let createGroupResult, parentGroupWid; @@ -1586,7 +1668,9 @@ class Client extends EventEmitter { for (const participant of participants) { const pWid = window.Store.WidFactory.createWid(participant); - if ((await window.Store.QueryExist(pWid))?.wid) participantWids.push(pWid); + if ((await window.Store.QueryExist(pWid))?.wid) { + participantWids.push({ phoneNumber: pWid }); + } else failedParticipants.push(participant); } @@ -1595,14 +1679,13 @@ class Client extends EventEmitter { try { createGroupResult = await window.Store.GroupUtils.createGroup( { - 'memberAddMode': options.memberAddMode === undefined ? true : options.memberAddMode, - 'membershipApprovalMode': options.membershipApprovalMode === undefined ? false : options.membershipApprovalMode, - 'announce': options.announce === undefined ? true : options.announce, + 'addressingModeOverride': 'lid', + 'memberAddMode': options.memberAddMode ?? false, + 'membershipApprovalMode': options.membershipApprovalMode ?? false, + 'announce': options.announce ?? false, + 'restrict': options.isRestrict !== undefined ? !options.isRestrict : false, 'ephemeralDuration': messageTimer, - 'full': undefined, 'parentGroupId': parentGroupWid, - 'restrict': options.restrict === undefined ? true : options.restrict, - 'thumb': undefined, 'title': title, }, participantWids @@ -1613,13 +1696,14 @@ class Client extends EventEmitter { for (const participant of createGroupResult.participants) { let isInviteV4Sent = false; + participant.wid.server == 'lid' && (participant.wid = window.Store.LidUtils.getPhoneNumber(participant.wid)); const participantId = participant.wid._serialized; const statusCode = participant.error || 200; if (autoSendInviteV4 && statusCode === 403) { window.Store.Contact.gadd(participant.wid, { silent: true }); const addParticipantResult = await window.Store.GroupInviteV4.sendGroupInviteMessage( - await window.Store.Chat.find(participant.wid), + window.Store.Chat.get(participant.wid) || await window.Store.Chat.find(participant.wid), createGroupResult.wid._serialized, createGroupResult.subject, participant.invite_code, @@ -1627,9 +1711,7 @@ class Client extends EventEmitter { comment, await window.WWebJS.getProfilePicThumbToBase64(createGroupResult.wid) ); - isInviteV4Sent = window.compareWwebVersions(window.Debug.VERSION, '<', '2.2335.6') - ? addParticipantResult === 'OK' - : addParticipantResult.messageSendResult === 'OK'; + isInviteV4Sent = addParticipantResult.messageSendResult === 'OK'; } participantData[participantId] = { @@ -2179,6 +2261,45 @@ class Client extends EventEmitter { }, chatId); } + /** + * Generates a WhatsApp call link (video call or voice call) + * @param {Date} startTime The start time of the call + * @param {string} callType The type of a WhatsApp call link to generate, valid values are: `video` | `voice` + * @returns {Promise<string>} The WhatsApp call link (https://call.whatsapp.com/video/XxXxXxXxXxXxXx) or an empty string if a generation failed. + */ + async createCallLink(startTime, callType) { + if (!['video', 'voice'].includes(callType)) { + throw new class CreateCallLinkError extends Error { + constructor(m) { super(m); } + }('Invalid \'callType\' parameter value is provided. Valid values are: \'voice\' | \'video\'.'); + } + + startTime = Math.floor(startTime.getTime() / 1000); + + return await this.pupPage.evaluate(async (startTimeTs, callType) => { + const response = await window.Store.ScheduledEventMsgUtils.createEventCallLink(startTimeTs, callType); + return response ?? ''; + }, startTime, callType); + } + + /** + * Sends a response to the scheduled event message, indicating whether a user is going to attend the event or not + * @param {number} response The response code to the scheduled event message. Valid values are: `0` for NONE response (removes a previous response) | `1` for GOING | `2` for NOT GOING | `3` for MAYBE going + * @param {string} eventMessageId The scheduled event message ID + * @returns {Promise<boolean>} + */ + async sendResponseToScheduledEvent(response, eventMessageId) { + if (![0, 1, 2, 3].includes(response)) return false; + + return await this.pupPage.evaluate(async (response, msgId) => { + const eventMsg = window.Store.Msg.get(msgId) || (await window.Store.Msg.getMessagesById([msgId]))?.messages?.[0]; + if (!eventMsg) return false; + + await window.Store.ScheduledEventMsgUtils.sendEventResponseMsg(response, eventMsg); + return true; + }, response, eventMessageId); + } + /** * Save new contact to user's addressbook or edit the existing one * @param {string} phoneNumber The contact's phone number in a format "17182222222", where "1" is a country code @@ -2211,6 +2332,28 @@ class Client extends EventEmitter { return await window.Store.AddressbookContactUtils.deleteContactAction(phoneNumber); }, phoneNumber); } + + /** + * Get lid and phone number for multiple users + * @param {string[]} userIds - Array of user IDs + * @returns {Promise<Array<{ lid: string, pn: string }>>} + */ + async getContactLidAndPhone(userIds) { + return await this.pupPage.evaluate((userIds) => { + !Array.isArray(userIds) && (userIds = [userIds]); + return userIds.map(userId => { + const wid = window.Store.WidFactory.createWid(userId); + const isLid = wid.server === 'lid'; + const lid = isLid ? wid : window.Store.LidUtils.getCurrentLid(wid); + const phone = isLid ? window.Store.LidUtils.getPhoneNumber(wid) : wid; + + return { + lid: lid._serialized, + pn: phone._serialized + }; + }); + }, userIds); + } } module.exports = Client; @@ -2224,7 +2367,7 @@ module.exports = Client;
diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 3b43d44..baa1bd3 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: ClientInfo + whatsapp-web.js 1.32.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@
diff --git a/docs/Contact.html b/docs/Contact.html index be258ba..065b7eb 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Contact + whatsapp-web.js 1.32.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@
diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 525c97d..cd18797 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: GroupChat + whatsapp-web.js 1.32.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -137,14 +137,17 @@
getGroupMembershipRequests()
+
getInviteCode()
+
+
-
getInviteCode()
+
getLabels()
-
getLabels()
+
getPinnedMessages()
leave()
@@ -177,13 +180,13 @@
sendSeen()
+
sendStateRecording()
+
+
-
sendStateRecording()
-
-
sendStateTyping()
@@ -668,6 +671,15 @@
async
+

getPinnedMessages()

+

Gets instances of all pinned messages in a chat

+
+
Inherited from
+
Chat#getPinnedMessages
+
Returns
+
+
+
async

leave() → Promise

Makes the bot leave the group

@@ -1225,7 +1237,7 @@
diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 7ed9f57..3f5e6af 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: GroupNotification + whatsapp-web.js 1.32.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@
diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 85cf053..43d862f 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: InterfaceController + whatsapp-web.js 1.32.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@
diff --git a/docs/Label.html b/docs/Label.html index 9d2d8b6..075bd52 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Label + whatsapp-web.js 1.32.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@
diff --git a/docs/List.html b/docs/List.html index c630409..9ccf2d0 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: List + whatsapp-web.js 1.32.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@ Returns: [{'title':'sectionTitle','rows':[{'r
diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 85d2f77..a1c61bf 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: LocalAuth + whatsapp-web.js 1.32.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -134,7 +134,7 @@
diff --git a/docs/LocalWebCache.html b/docs/LocalWebCache.html index 28e1a8c..505af5b 100644 --- a/docs/LocalWebCache.html +++ b/docs/LocalWebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: LocalWebCache + whatsapp-web.js 1.32.0 » Class: LocalWebCache @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@
diff --git a/docs/Location.html b/docs/Location.html index bb559d7..18a0e41 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Location + whatsapp-web.js 1.32.0 » Class: Location @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@
diff --git a/docs/Message.html b/docs/Message.html index 66c5111..b6df01e 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Message + whatsapp-web.js 1.32.0 » Class: Message @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@
-
pin(duration)
-
-
react(reaction)
@@ -516,6 +519,44 @@
async
+

editScheduledEvent(editedEventObject) → Promise containing nullable Message

+

Edits the current ScheduledEvent message. + Once the scheduled event is canceled, it can not be edited.

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

editedEventObject

+
+

ScheduledEvent

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing nullable Message 

+
+
+
async

forward(chat) → Promise

Forwards this message to another chat (that you chatted before, otherwise it will fail)

@@ -815,7 +856,7 @@
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index b2396e8..5f7fcb0 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: MessageMedia + whatsapp-web.js 1.32.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@
diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 782780f..196342f 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: NoAuth + whatsapp-web.js 1.32.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@
diff --git a/docs/Order.html b/docs/Order.html index d0cd11b..38eacf8 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Order + whatsapp-web.js 1.32.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@
diff --git a/docs/Poll.html b/docs/Poll.html index 133d956..bb1a9d6 100644 --- a/docs/Poll.html +++ b/docs/Poll.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Poll + whatsapp-web.js 1.32.0 » Class: Poll @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@
diff --git a/docs/PollVote.html b/docs/PollVote.html index 4659c1c..6abddcb 100644 --- a/docs/PollVote.html +++ b/docs/PollVote.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: PollVote + whatsapp-web.js 1.32.0 » Class: PollVote @@ -15,7 +15,7 @@ @@ -104,7 +104,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 9d23bc5..c47cf39 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: PrivateChat + whatsapp-web.js 1.32.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -117,6 +117,9 @@
getLabels()
+
getPinnedMessages()
+
+
markUnread()
@@ -132,13 +135,13 @@
sendSeen()
-
sendStateRecording()
-
-
+
sendStateRecording()
+
+
sendStateTyping()
@@ -420,6 +423,15 @@
async
+

getPinnedMessages()

+

Gets instances of all pinned messages in a chat

+
+
Inherited from
+
Chat#getPinnedMessages
+
Returns
+
+
+
async

markUnread()

Mark this chat as unread

@@ -601,7 +613,7 @@
diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 896c048..60f55e3 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: PrivateContact + whatsapp-web.js 1.32.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@
diff --git a/docs/Product.html b/docs/Product.html index 7a42726..aa540ca 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Product + whatsapp-web.js 1.32.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@
diff --git a/docs/Reaction.html b/docs/Reaction.html index d89baad..85baa5a 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Reaction + whatsapp-web.js 1.32.0 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@
diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 99f71aa..27a00ac 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: RemoteAuth + whatsapp-web.js 1.32.0 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -162,7 +162,7 @@
diff --git a/docs/RemoteWebCache.html b/docs/RemoteWebCache.html index 7167aa8..43b3289 100644 --- a/docs/RemoteWebCache.html +++ b/docs/RemoteWebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: RemoteWebCache + whatsapp-web.js 1.32.0 » Class: RemoteWebCache @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@
diff --git a/docs/ScheduledEvent.html b/docs/ScheduledEvent.html new file mode 100644 index 0000000..b103f98 --- /dev/null +++ b/docs/ScheduledEvent.html @@ -0,0 +1,235 @@ + + + + + + + whatsapp-web.js 1.32.0 » Class: ScheduledEvent + + + + + + + + +
+
+
+
+ +
+
+

Properties

+
+
+
+
eventSendOptions
+
+
+
+
+
+
+
name
+
+
+
+
+
+
+
startTimeTs
+
+
+
+
+
+
+
+

Method

+
+ +
+
+
+
+
+
+
+
+

new ScheduledEvent(name, startTime, options)

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

name

+
+

 

+
+

 

+
+
+

startTime

+
+

 

+
+

 

+
+
+

options

+
+

 

+
+

 

+
+
+
+
+
+
+
+

Properties

+
+

eventSendOptions +  Object

+

The send options for the event

+
+
+

name +  string

+

The name of the event

+
+
+

startTimeTs +  number

+

The start time of the event

+
+
+
+

Method

+
+

_validateInputs(propName, propValue) → (string or number)

+

Inner function to validate input values

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

propName

+
+

string

+
+

 

+
+

The property name to validate the value of

+
+

propValue

+
+

(string or number)

+
+

 

+
+

The property value to validate

+
+
+
+
Returns
+
+

(string or number)  +

The property value if a validation succeeded

+

+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/Util.html b/docs/Util.html index 0068ce7..51b2c54 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: Util + whatsapp-web.js 1.32.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@
diff --git a/docs/WebCache.html b/docs/WebCache.html index 42d9cae..17bbcd1 100644 --- a/docs/WebCache.html +++ b/docs/WebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Class: WebCache + whatsapp-web.js 1.32.0 » Class: WebCache @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@
diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index eb102b3..3d9da8d 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.32.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@ module.exports = BaseAuthStrategy;
diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 4a5112e..118aee8 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.32.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -97,7 +97,7 @@ module.exports = LocalAuth;
diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index a25ce7e..5e1e7cb 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.32.0 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@ module.exports = NoAuth;
diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 3b76da9..7a4fe9c 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.32.0 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -249,7 +249,7 @@ module.exports = RemoteAuth;
diff --git a/docs/global.html b/docs/global.html index e5ec9a2..5c58498 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Globals + whatsapp-web.js 1.32.0 » Globals @@ -15,7 +15,7 @@ @@ -170,6 +170,9 @@
ReactionList
+
ScheduledEventSendOptions
+
+
SelectedPollOption
@@ -567,6 +570,19 @@ + + +

CODE_RECEIVED

+ + +

 

+ + +

 

+ + + +

LOADING_SCREEN

@@ -1384,6 +1400,19 @@ + + +

SCHEDULED_EVENT_CREATION

+ + +

 

+ + +

 

+ + + + @@ -2243,6 +2272,66 @@

Defaults to ''.

+ + +

memberAddMode

+ + +

boolean

+ + +

Yes

+ + +

If true, only admins can add members to the group (false by default)

+

Defaults to false.

+ + + + +

membershipApprovalMode

+ + +

boolean

+ + +

Yes

+ + +

If true, group admins will be required to approve anyone who wishes to join the group (false by default)

+

Defaults to false.

+ + + + +

isRestrict

+ + +

boolean

+ + +

Yes

+ + +

If true, only admins can change group group info (true by default)

+

Defaults to true.

+ + + + +

isAnnounce

+ + +

boolean

+ + +

Yes

+ + +

If true, only admins can send messages (false by default)

+

Defaults to false.

+ + @@ -3731,6 +3820,116 @@
+

ScheduledEventSendOptions +  Object

+

ScheduledEvent send options

+
+

Properties

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

description

+
+

string

+
+

 

+
+

The scheduled event description

+

Value can be null.

+
+

endTime

+
+

Date

+
+

 

+
+

The end time of the event

+

Value can be null.

+
+

location

+
+

string

+
+

 

+
+

The location of the event

+

Value can be null.

+
+

callType

+
+

string

+
+

 

+
+

The type of a WhatsApp call link to generate, valid values are: video | voice

+

Value can be null.

+
+

isEventCanceled

+
+

boolean

+
+

Yes

+
+

Indicates if a scheduled event should be sent as an already canceled

+

Defaults to false.

+
+

messageSecret

+
+

Array of number

+
+

 

+
+

The custom message secret, can be used as an event ID. NOTE: it has to be a unique vector with a length of 32

+

Value can be null.

+
+
+
+

SelectedPollOption  Object

Selected poll option structure

@@ -4131,7 +4330,7 @@
diff --git a/docs/index.html b/docs/index.html index 52865b8..7e50feb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Home + whatsapp-web.js 1.32.0 » Home @@ -13,7 +13,7 @@ @@ -26,7 +26,7 @@
@@ -882,7 +882,7 @@ limitations under the License.

- Chat#id + Chat#getPinnedMessages()
@@ -891,6 +891,11 @@ limitations under the License.

+
+ Chat#id +
+
+
Chat#isGroup
@@ -941,16 +946,16 @@ limitations under the License.

-
- Chat#sendMessage(content[, options]) -
-
-
+
+ Chat#sendMessage(content[, options]) +
+
+
Chat#sendSeen()
@@ -1090,6 +1095,11 @@ limitations under the License.

+
+ Client#createCallLink(startTime, callType) +
+
+
Client#createChannel(title, options)
@@ -1155,6 +1165,11 @@ limitations under the License.

+
+ Client#event:code +
+
+
Client#event:contact_changed
@@ -1315,6 +1330,11 @@ limitations under the License.

+
+ Client#getContactLidAndPhone(userIds) +
+
+
Client#getContacts()
@@ -1355,6 +1375,11 @@ limitations under the License.

+
+ Client#getPinnedMessages(chatId) +
+
+
Client#getProfilePicUrl(contactId)
@@ -1431,7 +1456,7 @@ limitations under the License.

- Client#requestPairingCode(phoneNumber, showNotification) + Client#requestPairingCode(phoneNumber[, showNotification][, intervalMs])
@@ -1480,6 +1505,11 @@ limitations under the License.

+
+ Client#sendResponseToScheduledEvent(response, eventMessageId) +
+
+
Client#sendSeen(chatId)
@@ -1786,6 +1816,11 @@ limitations under the License.

+
+ Events.CODE_RECEIVED +
+
+
Events.CONTACT_CHANGED
@@ -1806,16 +1841,16 @@ limitations under the License.

-
- Events.GROUP_LEAVE -
-
-
+
+ Events.GROUP_LEAVE +
+
+
Events.GROUP_MEMBERSHIP_REQUEST
@@ -1861,16 +1896,16 @@ limitations under the License.

-
- Events.MESSAGE_REACTION -
-
-
+
+ Events.MESSAGE_REACTION +
+
+
Events.MESSAGE_RECEIVED
@@ -2023,6 +2058,11 @@ limitations under the License.

+
+ GroupChat#getPinnedMessages() +
+
+
GroupChat#id
@@ -2108,16 +2148,16 @@ limitations under the License.

-
- GroupChat#revokeInvite() -
-
-
+
+ GroupChat#revokeInvite() +
+
+
GroupChat#sendMessage(content[, options])
@@ -2706,6 +2746,11 @@ limitations under the License.

+
+ Message#editScheduledEvent(editedEventObject) +
+
+
Message#forward(chat)
@@ -2736,16 +2781,16 @@ limitations under the License.

-
- Message#getGroupMentions() -
-
-
+
+ Message#getGroupMentions() +
+
+
Message#getInfo()
@@ -2831,16 +2876,16 @@ limitations under the License.

-
- Message#links -
-
-
+
+ Message#links +
+
+
Message#location
@@ -3107,16 +3152,16 @@ limitations under the License.

-
-
- - + +
+
MessageTypes.HSM
@@ -3172,11 +3217,6 @@ limitations under the License.

-
-
- -
-
MessageTypes.PAYMENT
@@ -3187,6 +3227,11 @@ limitations under the License.

+
+
+ +
+
MessageTypes.PRODUCT
@@ -3207,6 +3252,11 @@ limitations under the License.

+
+ MessageTypes.SCHEDULED_EVENT_CREATION +
+
+
MessageTypes.STICKER
@@ -3525,7 +3575,7 @@ limitations under the License.

- PrivateChat#id + PrivateChat#getPinnedMessages()
@@ -3534,6 +3584,11 @@ limitations under the License.

+
+ PrivateChat#id +
+
+
PrivateChat#isGroup
@@ -3584,16 +3639,16 @@ limitations under the License.

-
- PrivateChat#sendMessage(content[, options]) -
-
-
+
+ PrivateChat#sendMessage(content[, options]) +
+
+
PrivateChat#sendSeen()
@@ -4007,6 +4062,53 @@ limitations under the License.

+
+ +

Status

@@ -4242,7 +4344,7 @@ limitations under the License.

diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js index 2943fdc..0d611ba 100644 --- a/docs/scripts/jsdoc-toc.js +++ b/docs/scripts/jsdoc-toc.js @@ -6,7 +6,7 @@ treeNode.tree({ autoEscape: false, closedIcon: '⇢', - data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BaseAuthStrategy","id":"BaseAuthStrategy","children":[]},{"label":"Broadcast","id":"Broadcast","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","children":[]},{"label":"Channel","id":"Channel","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"GroupNotification","id":"GroupNotification","children":[]},{"label":"InterfaceController","id":"InterfaceController","children":[]},{"label":"Label","id":"Label","children":[]},{"label":"List","id":"List","children":[]},{"label":"LocalAuth","id":"LocalAuth","children":[]},{"label":"LocalWebCache","id":"LocalWebCache","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"NoAuth","id":"NoAuth","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PollVote","id":"PollVote","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"RemoteAuth","id":"RemoteAuth","children":[]},{"label":"RemoteWebCache","id":"RemoteWebCache","children":[]},{"label":"Util","id":"Util","children":[]},{"label":"WebCache","id":"WebCache","children":[]}], + data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BaseAuthStrategy","id":"BaseAuthStrategy","children":[]},{"label":"Broadcast","id":"Broadcast","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","children":[]},{"label":"Channel","id":"Channel","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"GroupNotification","id":"GroupNotification","children":[]},{"label":"InterfaceController","id":"InterfaceController","children":[]},{"label":"Label","id":"Label","children":[]},{"label":"List","id":"List","children":[]},{"label":"LocalAuth","id":"LocalAuth","children":[]},{"label":"LocalWebCache","id":"LocalWebCache","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"NoAuth","id":"NoAuth","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PollVote","id":"PollVote","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"RemoteAuth","id":"RemoteAuth","children":[]},{"label":"RemoteWebCache","id":"RemoteWebCache","children":[]},{"label":"ScheduledEvent","id":"ScheduledEvent","children":[]},{"label":"Util","id":"Util","children":[]},{"label":"WebCache","id":"WebCache","children":[]}], openedIcon: ' ⇣', saveState: false, useContextMenu: false diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 2c2c694..05f34e3 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Base.js + whatsapp-web.js 1.32.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@ module.exports = Base;
diff --git a/docs/structures_Broadcast.js.html b/docs/structures_Broadcast.js.html index dc266b9..ea772e7 100644 --- a/docs/structures_Broadcast.js.html +++ b/docs/structures_Broadcast.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Broadcast.js + whatsapp-web.js 1.32.0 » Source: structures/Broadcast.js @@ -15,7 +15,7 @@ @@ -108,7 +108,7 @@ module.exports = Broadcast;
diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 6375d3c..d9a9c48 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.32.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@ module.exports = BusinessContact;
diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 9d4222c..26c66b9 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Buttons.js + whatsapp-web.js 1.32.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@ module.exports = Buttons;
diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 4269fe7..ca47f04 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Call.js + whatsapp-web.js 1.32.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@ module.exports = Call;
diff --git a/docs/structures_Channel.js.html b/docs/structures_Channel.js.html index 601fa71..448c267 100644 --- a/docs/structures_Channel.js.html +++ b/docs/structures_Channel.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Channel.js + whatsapp-web.js 1.32.0 » Source: structures/Channel.js @@ -15,7 +15,7 @@ @@ -421,7 +421,7 @@ module.exports = Channel;
diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index c7699c9..51cbff4 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Chat.js + whatsapp-web.js 1.32.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -310,6 +310,14 @@ class Chat extends Base { return this.client.addOrRemoveLabels(labelIds, [this.id._serialized]); } + /** + * Gets instances of all pinned messages in a chat + * @returns {Promise<[Message]|[]>} + */ + async getPinnedMessages() { + return this.client.getPinnedMessages(this.id._serialized); + } + /** * Sync chat history conversation * @return {Promise<boolean>} True if operation completed successfully, false otherwise. @@ -330,7 +338,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 714484c..fcb8384 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.32.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 6fcd073..017bcde 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Contact.js + whatsapp-web.js 1.32.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -247,7 +247,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 3eedbbf..cd2e950 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.32.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -113,7 +113,7 @@ class GroupChat extends Chat { !Array.isArray(participantIds) && (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 && 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' && - (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, '<', '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;
diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 3a1ace8..7d2ed41 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.32.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@ module.exports = GroupNotification;
diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index cfc45d5..3cea188 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Label.js + whatsapp-web.js 1.32.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@ module.exports = Label;
diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 5ec71bb..b3a425f 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/List.js + whatsapp-web.js 1.32.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = List;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index c951b9f..5132127 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Location.js + whatsapp-web.js 1.32.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -100,7 +100,7 @@ module.exports = Location;
diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index b26e1d9..5ec3f2b 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Message.js + whatsapp-web.js 1.32.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -38,6 +38,7 @@ const Order = require('./Order'); const Payment = require('./Payment'); const Reaction = require('./Reaction'); const Contact = require('./Contact'); +const ScheduledEvent = require('./ScheduledEvent'); // eslint-disable-line no-unused-vars const { MessageTypes } = require('../util/Constants'); /** @@ -82,7 +83,7 @@ class Message extends Base { * Message content * @type {string} */ - this.body = this.hasMedia ? data.caption || '' : data.body || data.pollName || ''; + this.body = this.hasMedia ? data.caption || '' : data.body || data.pollName || data.eventName || ''; /** * Message type @@ -730,6 +731,40 @@ class Message extends Base { } return null; } + + /** + * Edits the current ScheduledEvent message. + * Once the scheduled event is canceled, it can not be edited. + * @param {ScheduledEvent} editedEventObject + * @returns {Promise<?Message>} + */ + async editScheduledEvent(editedEventObject) { + if (!this.fromMe) { + return null; + } + + const edittedEventMsg = await this.client.pupPage.evaluate(async (msgId, editedEventObject) => { + const msg = window.Store.Msg.get(msgId) || (await window.Store.Msg.getMessagesById([msgId]))?.messages?.[0]; + if (!msg) return null; + + const { name, startTimeTs, eventSendOptions } = editedEventObject; + const eventOptions = { + name: name, + description: eventSendOptions.description, + startTime: startTimeTs, + endTime: eventSendOptions.endTimeTs, + location: eventSendOptions.location, + callType: eventSendOptions.callType, + isEventCanceled: eventSendOptions.isEventCanceled, + }; + + await window.Store.ScheduledEventMsgUtils.sendEventEditMessage(eventOptions, msg); + const editedMsg = window.Store.Msg.get(msg.id._serialized); + return editedMsg?.serialize(); + }, this.id._serialized, editedEventObject); + + return edittedEventMsg && new Message(this.client, edittedEventMsg); + } } module.exports = Message; @@ -743,7 +778,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index de303bc..2351d1f 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.32.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 41ca653..813dc8e 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Order.js + whatsapp-web.js 1.32.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@ module.exports = Order;
diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 380347c..f7b7573 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Payment.js + whatsapp-web.js 1.32.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@ module.exports = Payment;
diff --git a/docs/structures_Poll.js.html b/docs/structures_Poll.js.html index 8907f8b..498f123 100644 --- a/docs/structures_Poll.js.html +++ b/docs/structures_Poll.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Poll.js + whatsapp-web.js 1.32.0 » Source: structures/Poll.js @@ -15,7 +15,7 @@ @@ -83,7 +83,7 @@ module.exports = Poll;
diff --git a/docs/structures_PollVote.js.html b/docs/structures_PollVote.js.html index c0f4b67..eec2882 100644 --- a/docs/structures_PollVote.js.html +++ b/docs/structures_PollVote.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/PollVote.js + whatsapp-web.js 1.32.0 » Source: structures/PollVote.js @@ -15,7 +15,7 @@ @@ -100,7 +100,7 @@ module.exports = PollVote;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index ea233e8..decfa45 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.32.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ module.exports = PrivateChat;
diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 2c085ea..57f3f8d 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.32.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ module.exports = PrivateContact;
diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index fdba17c..612192e 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Product.js + whatsapp-web.js 1.32.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@ module.exports = Product;
diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 0c65eba..e7f8d3e 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.32.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@ module.exports = ProductMetadata;
diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 8b06a08..8d34bfe 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: structures/Reaction.js + whatsapp-web.js 1.32.0 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@ module.exports = Reaction;
diff --git a/docs/structures_ScheduledEvent.js.html b/docs/structures_ScheduledEvent.js.html new file mode 100644 index 0000000..e9d462e --- /dev/null +++ b/docs/structures_ScheduledEvent.js.html @@ -0,0 +1,125 @@ + + + + + + + whatsapp-web.js 1.32.0 » Source: structures/ScheduledEvent.js + + + + + + + + +
+
+
+ +
+ +
+
'use strict';
+
+/**
+ * ScheduledEvent send options
+ * @typedef {Object} ScheduledEventSendOptions
+ * @property {?string} description The scheduled event description
+ * @property {?Date} endTime The end time of the event
+ * @property {?string} location The location of the event
+ * @property {?string} callType The type of a WhatsApp call link to generate, valid values are: `video` | `voice`
+ * @property {boolean} [isEventCanceled = false] Indicates if a scheduled event should be sent as an already canceled
+ * @property {?Array<number>} messageSecret The custom message secret, can be used as an event ID. NOTE: it has to be a unique vector with a length of 32
+ */
+
+/** Represents a ScheduledEvent on WhatsApp */
+class ScheduledEvent {
+    /**
+     * @param {string} name
+     * @param {Date} startTime
+     * @param {ScheduledEventSendOptions} options
+     */
+    constructor(name, startTime, options = {}) {
+        /**
+         * The name of the event
+         * @type {string}
+         */
+        this.name = this._validateInputs('name', name).trim();
+
+        /**
+         * The start time of the event
+         * @type {number}
+         */
+        this.startTimeTs = Math.floor(startTime.getTime() / 1000);
+
+        /**
+         * The send options for the event
+         * @type {Object}
+         */
+        this.eventSendOptions = {
+            description: options.description?.trim(),
+            endTimeTs: options.endTime ? Math.floor(options.endTime.getTime() / 1000) : null,
+            location: options.location?.trim(),
+            callType: this._validateInputs('callType', options.callType),
+            isEventCanceled: options.isEventCanceled ?? false,
+            messageSecret: options.messageSecret
+        };
+    }
+
+    /**
+     * Inner function to validate input values
+     * @param {string} propName The property name to validate the value of
+     * @param {string | number} propValue The property value to validate
+     * @returns {string | number} The property value if a validation succeeded
+     */
+    _validateInputs(propName, propValue) {
+        if (propName === 'name' && !propValue) {
+            throw new class CreateScheduledEventError extends Error {
+                constructor(m) { super(m); }
+            }(`Empty '${propName}' parameter value is provided.`);
+        }
+
+        if (propName === 'callType' && propValue && !['video', 'voice'].includes(propValue)) {
+            throw new class CreateScheduledEventError extends Error {
+                constructor(m) { super(m); }
+            }(`Invalid '${propName}' parameter value is provided. Valid values are: 'voice' | 'video'.`);
+        }
+        
+        return propValue;
+    }
+}
+
+module.exports = ScheduledEvent;
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 6a845a6..96cd312 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: util/Constants.js + whatsapp-web.js 1.32.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -49,7 +49,12 @@ exports.DefaultOptions = { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36', ffmpegPath: 'ffmpeg', bypassCSP: false, - proxyAuthentication: undefined + proxyAuthentication: undefined, + pairWithPhoneNumber: { + phoneNumber: '', + showNotification: true, + intervalMs: 180000, + }, }; /** @@ -91,6 +96,7 @@ exports.Events = { GROUP_MEMBERSHIP_REQUEST: 'group_membership_request', GROUP_UPDATE: 'group_update', QR_RECEIVED: 'qr', + CODE_RECEIVED: 'code', LOADING_SCREEN: 'loading_screen', DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', @@ -142,6 +148,7 @@ exports.MessageTypes = { REACTION: 'reaction', TEMPLATE_BUTTON_REPLY: 'template_button_reply', POLL_CREATION: 'poll_creation', + SCHEDULED_EVENT_CREATION: 'scheduled_event_creation', }; /** @@ -215,7 +222,7 @@ exports.MessageAck = {
diff --git a/docs/util_Injected_LegacyStore.js.html b/docs/util_Injected_LegacyStore.js.html index 73e8889..c844df8 100644 --- a/docs/util_Injected_LegacyStore.js.html +++ b/docs/util_Injected_LegacyStore.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: util/Injected/LegacyStore.js + whatsapp-web.js 1.32.0 » Source: util/Injected/LegacyStore.js @@ -15,7 +15,7 @@ @@ -184,7 +184,7 @@ exports.ExposeLegacyStore = () => {
diff --git a/docs/util_Injected_Store.js.html b/docs/util_Injected_Store.js.html index 63f9656..efecf46 100644 --- a/docs/util_Injected_Store.js.html +++ b/docs/util_Injected_Store.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: util/Injected/Store.js + whatsapp-web.js 1.32.0 » Source: util/Injected/Store.js @@ -15,7 +15,7 @@ @@ -119,7 +119,6 @@ exports.ExposeStore = () => { window.Store.WidToJid = window.require('WAWebWidToJid'); window.Store.JidToWid = window.require('WAWebJidToWid'); window.Store.getMsgInfo = window.require('WAWebApiMessageInfoStore').queryMsgInfo; - window.Store.pinUnpinMsg = window.require('WAWebSendPinMessageAction').sendPinInChatMsg; window.Store.QueryExist = window.require('WAWebQueryExistsJob').queryWidExists; window.Store.ReplyUtils = window.require('WAWebMsgReply'); window.Store.BotSecret = window.require('WAWebBotMessageSecret'); @@ -128,8 +127,11 @@ exports.ExposeStore = () => { window.Store.DeviceList = window.require('WAWebApiDeviceList'); window.Store.HistorySync = window.require('WAWebSendNonMessageDataRequest'); window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode; + window.Store.PinnedMsgUtils = window.require('WAWebPinInChatSchema'); window.Store.ChatGetters = window.require('WAWebChatGetters'); + window.Store.PinnedMsgUtils = window.require('WAWebSendPinMessageAction'); window.Store.UploadUtils = window.require('WAWebUploadManager'); + window.Store.WAWebStreamModel = window.require('WAWebStreamModel'); window.Store.Settings = { ...window.require('WAWebUserPrefsGeneral'), @@ -141,7 +143,12 @@ exports.ExposeStore = () => { ...window.require('WAPhoneFindCC') }; window.Store.ForwardUtils = { - ...window.require('WAWebForwardMessagesToChat') + ...window.require('WAWebChatForwardMessage') + }; + window.Store.ScheduledEventMsgUtils = { + ...window.require('WAWebGenerateEventCallLink'), + ...window.require('WAWebSendEventEditMsgAction'), + ...window.require('WAWebSendEventResponseMsgAction') }; window.Store.VCard = { ...window.require('WAWebFrontendVcardUtils'), @@ -254,7 +261,7 @@ exports.ExposeStore = () => {
diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index d9364d8..e97ffb5 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.32.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -165,7 +165,7 @@ module.exports = InterfaceController;
diff --git a/docs/util_Puppeteer.js.html b/docs/util_Puppeteer.js.html index e53a080..47f7aba 100644 --- a/docs/util_Puppeteer.js.html +++ b/docs/util_Puppeteer.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: util/Puppeteer.js + whatsapp-web.js 1.32.0 » Source: util/Puppeteer.js @@ -15,7 +15,7 @@ @@ -62,7 +62,7 @@ module.exports = {exposeFunctionIfAbsent};
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 175ce0b..1c8eb8c 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: util/Util.js + whatsapp-web.js 1.32.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@ module.exports = Util;
diff --git a/docs/webCache_LocalWebCache.js.html b/docs/webCache_LocalWebCache.js.html index ee22706..6fa05c8 100644 --- a/docs/webCache_LocalWebCache.js.html +++ b/docs/webCache_LocalWebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: webCache/LocalWebCache.js + whatsapp-web.js 1.32.0 » Source: webCache/LocalWebCache.js @@ -15,7 +15,7 @@ @@ -79,7 +79,7 @@ module.exports = LocalWebCache;
diff --git a/docs/webCache_RemoteWebCache.js.html b/docs/webCache_RemoteWebCache.js.html index 7baf115..ab98899 100644 --- a/docs/webCache_RemoteWebCache.js.html +++ b/docs/webCache_RemoteWebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: webCache/RemoteWebCache.js + whatsapp-web.js 1.32.0 » Source: webCache/RemoteWebCache.js @@ -15,7 +15,7 @@ @@ -78,7 +78,7 @@ module.exports = RemoteWebCache;
diff --git a/docs/webCache_WebCache.js.html b/docs/webCache_WebCache.js.html index 16d4d2e..c17f465 100644 --- a/docs/webCache_WebCache.js.html +++ b/docs/webCache_WebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.31.1-alpha.0 » Source: webCache/WebCache.js + whatsapp-web.js 1.32.0 » Source: webCache/WebCache.js @@ -15,7 +15,7 @@ @@ -52,7 +52,7 @@ module.exports = {