From 0d55d408850ef5214fde751d8b55af42fd70aef1 Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sun, 27 Feb 2022 14:51:08 -0800 Subject: [PATCH 001/430] feat: Multi-device support (#889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :ambulance: Added ready selector for multi-device * SendMessage fix * File management system and some fixes * cleanup * cleanup again * eslint * critical fix for reloading the same session * Checking for valid folder name (regex) * ESLint hotfix (regex escapes) * Typings cleanup * cleanup listener * Multi-device Branch merge (#888) * Duplicate * qr fix and allow non-beta users to connect * urgent: selector fix * urgent: qr timeout fix * fix * Updated type so no TS error when sending list/buttons * Update index.d.ts * fix QueryExist for Multidevice (#928) * creates isRegisteredUserBeta * fix QueryExist * fix Error: GROUP_JID: invalid jid type: Not an instance of WID issue (#926) * fix Error: GROUP_JID: invalid jid type: Not an instance of WID issue * clean code * Cleanup * Fix for update chrome error * ESLint fix * :red_light: fix for RMDIR * Update README.md * Update README.md * fix: getProfilePicUrl fix by victormga (#941) * fix: MD presence available/unavailable (#942) * delete session when appropriate & fix for SW * ignore QR timeout errors * Presence and ChatState updates working for MD+Non-MD * shell uses new session storage * lint fix * support session.json-based auth for non-md * md fix * md fix * fix shell clientId * remove exclusive mocha test * make linkPreview default to false * remove ignored errors on getQuotedMessage * fix: dont modify existing this.options.puppeteer object * tests work with new dir auth * remove exclusive test * fixes and tests for group creation and participant functions * remove unused function * wip fix group settings functions * isRegisteredUser && getNumberId hotFix (#955) * isRegisteredUser && getNumberId hotFix A fix for client.isRegisteredUser and client.getNumberId. Use for reference or if you are stuck with MD and NEEDS this function. Problably Whatsapp will break this in a couple weeks * fix for non-md Co-authored-by: Rajeh Taher * Fix WA 2.2146.9 MD + victormga branch (#991) * qrcode now uses observers instead of timeout * automatic auth/qrcode detection * Fix WA 2.2146.9 MD Got from github:victormga/whatsapp-web.js#multidevice maybe it's behind pedro branch Co-authored-by: victormga * fix * fix* * getnumberid to multidevice (#1027) * getNumberId to main isRegisteredUser && getNumberId hotFix #955 To main * Update Client.js Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> * Update Client.js * Message.raw() (#1005) * Message.raw() * i just noticed * Update index.d.ts * Update index.d.ts * Update Message.js * Get rid of sharp now!!!!!!!! (#1045) * commit 1 * finally, gotten rid of sharp * pckg.json * service worker fix & disableMessage option * typings * Update example.js * clear session system * Update Client.js * Update Client.js * Fix accepting group private invite (#1094) Co-authored-by: github-actions[bot] * [MD] Add getCommonGroups with specific user. (#1097) * Add getCommonGroups with specific user. * Fix * Fix * Fix Co-authored-by: github-actions[bot] * Fix getCommonGroups. (#1122) * Fix of Unexpected identifier async destroy() (#1123) * Fix of Unexpected identifier async destroy() * Fix made in #1107 * Temporary fix for "Sticker" module * some really quick changes * Update Injected.js * Update Injected.js * Update index.d.ts * fix: getNumberId Solved (#1142) * getNumberId Solved * isRegisteredUser Solved * formmated * Apply suggestions from code review * Update src/util/Injected.js Co-authored-by: Rajeh Taher * Fix: "Chrome user data dir was not found ..." fixes the error caused by puppeteer. * Update Client.js (#1154) * fix: getNumberId and isRegisteredUser (#1159) * fix: getNumberId and isRegisteredUser * Apply suggestions from code review Co-authored-by: Rajeh Taher * Update client.js * Update Injected.js * Update Client.js * Update index.d.ts * Update Client.js * Update Client.js * fix lint indentation * fix auth_failure event for non-md, tests * fix setting group subject * fix finding Label module * set remember-me after clearing localStorage * fix: send messages to groups correctly on MD, use new ID format * fix setting / getting contact status * fix msg.getInfo, add message tests * fix group settings functions * fix set group description, handle errors in setSubject * fix group invite functions * fix leaving group * bring back phone info for non-md users * remove unused option, update typings * add back jsdoc for qr event * fix setting sticker metadata, clean up sticker functions * rawData is a get only property * fix and simplify getNumberId/isRegisteredUser * fix getInviteInfo * setDisplayName returns bool, not yet implemented for md * fix: stream module (#1241) * linkPreview has no effect on MD, return default to true * fix: del linkPreview option on md * cleanup, types and docs updates * update readmes / test notes * remove DS_Store * DS_Store in gitignore * test stability (timeouts/sleeps) Co-authored-by: Rajeh Taher Co-authored-by: Gustavo B <52040719+Gugabit@users.noreply.github.com> Co-authored-by: Maikel Ortega Hernández Co-authored-by: victormga Co-authored-by: Pedro Lopez Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> Co-authored-by: gon <68490103+nekiak@users.noreply.github.com> Co-authored-by: Alon Schwartzblat <63599777+Schwartzblat@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: Šebestíček <44745014+SebestikCZ@users.noreply.github.com> Co-authored-by: Emmanuel Anaya Luna <38712443+KeruMx@users.noreply.github.com> Co-authored-by: L337C0D3R <51872799+L337C0D3R@users.noreply.github.com> Co-authored-by: Reni Delonzek --- .env.example | 5 +- .gitignore | 9 +- example.js | 35 +-- index.d.ts | 77 +++++-- package.json | 6 +- shell.js | 13 +- src/Client.js | 402 +++++++++++++++++++++-------------- src/structures/ClientInfo.js | 13 +- src/structures/Contact.js | 11 +- src/structures/GroupChat.js | 105 +++++---- src/structures/Message.js | 83 +++++--- src/util/Constants.js | 7 +- src/util/Injected.js | 188 +++++++++------- src/util/Util.js | 54 ++--- tests/README.md | 10 +- tests/client.js | 273 +++++++++++++----------- tests/helper.js | 40 +++- tests/structures/chat.js | 15 +- tests/structures/group.js | 227 ++++++++++++++++++++ tests/structures/message.js | 112 ++++++++++ 20 files changed, 1132 insertions(+), 553 deletions(-) create mode 100644 tests/structures/group.js create mode 100644 tests/structures/message.js diff --git a/.env.example b/.env.example index 6cd9eb9a83d..3add97c8b70 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ -WWEBJS_TEST_SESSION_PATH=test_session.json -WWEBJS_TEST_REMOTE_ID=XXXXXXXXXX@c.us \ No newline at end of file +WWEBJS_TEST_REMOTE_ID=XXXXXXXXXX@c.us +WWEBJS_TEST_CLIENT_ID=authenticated +WWEBJS_TEST_MD=1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index f0b9c4ffb28..73c67dca66b 100644 --- a/.gitignore +++ b/.gitignore @@ -64,8 +64,13 @@ typings/ # next.js build output .next -# macOS Thumbnails +# macOS ._* +.DS_Store # Test sessions -*session.json \ No newline at end of file +*session.json + +# user data +WWebJS/ +userDataDir/ \ No newline at end of file diff --git a/example.js b/example.js index 4958e873a45..bc3388e079d 100644 --- a/example.js +++ b/example.js @@ -1,15 +1,9 @@ -const fs = require('fs'); const { Client, Location, List, Buttons } = require('./index'); -const SESSION_FILE_PATH = './session.json'; -let sessionCfg; -if (fs.existsSync(SESSION_FILE_PATH)) { - sessionCfg = require(SESSION_FILE_PATH); -} - -const client = new Client({ puppeteer: { headless: false }, session: sessionCfg }); -// You can use an existing session and avoid scanning a QR code by adding a "session" object to the client options. -// This object must include WABrowserId, WASecretBundle, WAToken1 and WAToken2. +const client = new Client({ + clientId: 'example', + puppeteer: { headless: false } +}); // You also could connect to an existing instance of a browser // { @@ -25,18 +19,12 @@ client.on('qr', (qr) => { console.log('QR RECEIVED', qr); }); -client.on('authenticated', (session) => { - console.log('AUTHENTICATED', session); - sessionCfg=session; - fs.writeFile(SESSION_FILE_PATH, JSON.stringify(session), function (err) { - if (err) { - console.error(err); - } - }); +client.on('authenticated', () => { + console.log('AUTHENTICATED'); }); client.on('auth_failure', msg => { - // Fired if session restore was unsuccessfull + // Fired if session restore was unsuccessful console.error('AUTHENTICATION FAILURE', msg); }); @@ -124,9 +112,8 @@ client.on('message', async msg => { client.sendMessage(msg.from, ` *Connection info* User name: ${info.pushname} - My number: ${info.me.user} + My number: ${info.wid.user} Platform: ${info.platform} - WhatsApp version: ${info.phone.wa_version} `); } else if (msg.body === '!mediainfo' && msg.hasMedia) { const attachmentData = await msg.downloadMedia(); @@ -267,12 +254,6 @@ client.on('group_update', (notification) => { console.log('update', notification); }); -client.on('change_battery', (batteryInfo) => { - // Battery percentage for attached device has changed - const { battery, plugged } = batteryInfo; - console.log(`Battery: ${battery}% - Charging? ${plugged}`); -}); - client.on('change_state', state => { console.log('CHANGE STATE', state ); }); diff --git a/index.d.ts b/index.d.ts index 703975227cc..c3d1ab14fad 100644 --- a/index.d.ts +++ b/index.d.ts @@ -84,6 +84,9 @@ declare namespace WAWebJS { /** Returns the contact ID's profile picture URL, if privacy settings allow it */ getProfilePicUrl(contactId: string): Promise + /** Gets the Contact's common groups with you. Returns empty array if you don't have any common group. */ + getCommonGroups(contactId: string): Promise + /** Gets the current connection state for the client */ getState(): Promise @@ -118,6 +121,9 @@ declare namespace WAWebJS { /** Marks the client as online */ sendPresenceAvailable(): Promise + /** Marks the client as offline */ + sendPresenceUnavailable(): Promise + /** Mark as seen for the Chat */ sendSeen(chatId: string): Promise @@ -134,7 +140,7 @@ declare namespace WAWebJS { * Sets the current user's display name * @param displayName New display name */ - setDisplayName(displayName: string): Promise + setDisplayName(displayName: string): Promise /** Changes and returns the archive state of the Chat */ unarchiveChat(chatId: string): Promise @@ -150,11 +156,17 @@ declare namespace WAWebJS { /** Emitted when authentication is successful */ on(event: 'authenticated', listener: ( - /** Object containing session information. Can be used to restore the session */ - session: ClientSession + /** + * Object containing session information. Can be used to restore the session + * @deprecated + */ + session?: ClientSession ) => void): this - /** Emitted when the battery percentage for the attached device changes */ + /** + * Emitted when the battery percentage for the attached device changes + * @deprecated + */ on(event: 'change_battery', listener: (batteryInfo: BatteryInfo) => void): this /** Emitted when the connection state changes */ @@ -249,14 +261,12 @@ declare namespace WAWebJS { /** Current connection information */ export interface ClientInfo { - /** - * Current user ID - * @deprecated Use .wid instead - */ - me: ContactId /** Current user ID */ wid: ContactId - /** Information about the phone this client is connected to */ + /** + * Information about the phone this client is connected to. Not available in multi-device. + * @deprecated + */ phone: ClientInfoPhone /** Platform the phone is running on */ platform: string @@ -267,7 +277,10 @@ declare namespace WAWebJS { getBatteryStatus: () => Promise } - /** Information about the phone this client is connected to */ + /** + * Information about the phone this client is connected to + * @deprecated + */ export interface ClientInfoPhone { /** WhatsApp Version running on the phone */ wa_version: string @@ -300,8 +313,19 @@ declare namespace WAWebJS { /** Restart client with a new session (i.e. use null 'session' var) if authentication fails * @default false */ restartOnAuthFail?: boolean - /** Whatsapp session to restore. If not set, will start a new session */ + /** + * Enable authentication via a `session` option. + * @deprecated Will be removed in a future release + */ + useDeprecatedSessionAuth?: boolean + /** + * WhatsApp session to restore. If not set, will start a new session + * @deprecated Set `useDeprecatedSessionAuth: true` to enable. This auth method is not supported by MultiDevice and will be removed in a future release. + */ session?: ClientSession + /** Client id to distinguish instances if you are using multiple, otherwise keep empty if you are using only one instance + * @default '' */ + clientId: string /** If another whatsapp web session is detected (another browser), take over the session in the current browser * @default false */ takeoverOnConflict?: boolean, @@ -314,9 +338,15 @@ declare namespace WAWebJS { /** Ffmpeg path to use when formating videos to webp while sending stickers * @default 'ffmpeg' */ ffmpegPath?: string + /** Path to place session objects in + @default './WWebJS' */ + dataPath?: string } - /** Represents a Whatsapp client session */ + /** + * Represents a WhatsApp client session + * @deprecated + */ export interface ClientSession { WABrowserId: string, WASecretBundle: string, @@ -324,6 +354,9 @@ declare namespace WAWebJS { WAToken2: string, } + /** + * @deprecated + */ export interface BatteryInfo { /** The current battery percentage */ battery: number, @@ -608,6 +641,13 @@ declare namespace WAWebJS { selectedButtonId?: string, /** Selected list row ID */ selectedRowId?: string, + /** Returns message in a raw format */ + rawData: object, + /* + * Reloads this Message object's data in-place with the latest values from WhatsApp Web. + * Note that the Message must still be in the web app cache for this to work, otherwise will return null. + */ + reload: () => Promise, /** Accept the Group V4 Invite in message */ acceptGroupV4Invite: () => Promise<{status: number}>, /** Deletes the message from the chat */ @@ -679,7 +719,7 @@ declare namespace WAWebJS { /** Options for sending a message */ export interface MessageSendOptions { - /** Show links preview */ + /** Show links preview. Has no effect on multi-device accounts. */ linkPreview?: boolean /** Send audio as voice message */ sendAudioAsVoice?: boolean @@ -741,7 +781,7 @@ declare namespace WAWebJS { static fromUrl: (url: string, options?: MediaFromURLOptions) => Promise } - export type MessageContent = string | MessageMedia | Location | Contact | Contact[] | List | Buttons + export type MessageContent = string | MessageMedia | Location | Contact | Contact[] | List | Buttons /** * Represents a Contact on WhatsApp @@ -834,6 +874,9 @@ declare namespace WAWebJS { /** Gets the Contact's current "about" info. Returns null if you don't have permission to read their status. */ getAbout: () => Promise, + + /** Gets the Contact's common groups with you. Returns empty array if you don't have any common group. */ + getCommonGroups: () => Promise } @@ -1011,9 +1054,9 @@ declare namespace WAWebJS { /** Demotes participants by IDs to regular users */ demoteParticipants: ChangeParticipantsPermisions; /** Updates the group subject */ - setSubject: (subject: string) => Promise; + setSubject: (subject: string) => Promise; /** Updates the group description */ - setDescription: (description: string) => Promise; + setDescription: (description: string) => Promise; /** Updates the group settings to only allow admins to send messages * @param {boolean} [adminsOnly=true] Enable or disable this option * @returns {Promise} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. diff --git a/package.json b/package.json index 2ed4f904349..093758c352d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "./index.js", "typings": "./index.d.ts", "scripts": { - "test": "mocha tests --recursive", + "test": "mocha tests --recursive --timeout 5000", "test-single": "mocha", "shell": "node --experimental-repl-await ./shell.js", "generate-docs": "node_modules/.bin/jsdoc --configure .jsdoc.json --verbose" @@ -35,12 +35,12 @@ "mime": "^3.0.0", "node-fetch": "^2.6.5", "node-webpmux": "^3.1.0", - "puppeteer": "^13.0.0", - "sharp": "^0.28.3" + "puppeteer": "^13.0.0" }, "devDependencies": { "@types/node-fetch": "^2.5.12", "chai": "^4.3.4", + "chai-as-promised": "^7.1.1", "dotenv": "^16.0.0", "eslint": "^8.4.1", "eslint-plugin-mocha": "^10.0.3", diff --git a/shell.js b/shell.js index 10e44d0c5dc..4f94c35f36a 100644 --- a/shell.js +++ b/shell.js @@ -7,19 +7,12 @@ */ const repl = require('repl'); -const fs = require('fs'); const { Client } = require('./index'); -const SESSION_FILE_PATH = './session.json'; -let sessionCfg; -if (fs.existsSync(SESSION_FILE_PATH)) { - sessionCfg = require(SESSION_FILE_PATH); -} - const client = new Client({ puppeteer: { headless: false }, - session: sessionCfg + clientId: 'shell' }); console.log('Initializing...'); @@ -30,6 +23,10 @@ client.on('qr', () => { console.log('Please scan the QR code on the browser.'); }); +client.on('authenticated', (session) => { + console.log(JSON.stringify(session)); +}); + client.on('ready', () => { const shell = repl.start('wwebjs> '); shell.context.client = client; diff --git a/src/Client.js b/src/Client.js index 27c207904d6..5f908e04325 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1,9 +1,10 @@ 'use strict'; +const path = require('path'); +const fs = require('fs'); const EventEmitter = require('events'); const puppeteer = require('puppeteer'); const moduleRaid = require('@pedroslopez/moduleraid/moduleraid'); -const jsQR = require('jsqr'); const Util = require('./util/Util'); const InterfaceController = require('./util/InterfaceController'); @@ -11,27 +12,24 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./util/Constan const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label, Call, Buttons, List} = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List } = require('./structures'); /** * Starting point for interacting with the WhatsApp Web API * @extends {EventEmitter} * @param {object} options - Client options * @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer * @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ - * @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed) - * @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer * @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up * @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails - * @param {object} options.session - Whatsapp session to restore. If not set, will start a new session - * @param {string} options.session.WABrowserId - * @param {string} options.session.WASecretBundle - * @param {string} options.session.WAToken1 - * @param {string} options.session.WAToken2 + * @param {boolean} options.useDeprecatedSessionAuth - Enable JSON-based authentication. This is deprecated due to not being supported by MultiDevice, and will be removed in a future version. + * @param {object} options.session - This is deprecated due to not being supported by MultiDevice, and will be removed in a future version. * @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser * @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session + * @param {string} options.dataPath - Change the default path for saving session files, default is: "./WWebJS/" * @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers * @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy. + * @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance * * @fires Client#qr * @fires Client#authenticated @@ -48,7 +46,6 @@ const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification * @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state - * @fires Client#change_battery */ class Client extends EventEmitter { constructor(options = {}) { @@ -56,6 +53,19 @@ class Client extends EventEmitter { this.options = Util.mergeDefault(DefaultOptions, options); + this.id = this.options.clientId; + + // eslint-disable-next-line no-useless-escape + const foldernameRegex = /^(?!.{256,})(?!(aux|clock\$|con|nul|prn|com[1-9]|lpt[1-9])(?:$|\.))[^ ][ \.\w-$()+=[\];#@~,&']+[^\. ]$/i; + if (this.id && !foldernameRegex.test(this.id)) throw Error('Invalid client ID. Make sure you abide by the folder naming rules of your operating system.'); + + if (!this.options.useDeprecatedSessionAuth) { + this.dataDir = this.options.puppeteer.userDataDir; + const dirPath = path.join(process.cwd(), this.options.dataPath, this.id ? 'session-' + this.id : 'session'); + if (!this.dataDir) this.dataDir = dirPath; + fs.mkdirSync(this.dataDir, { recursive: true }); + } + this.pupBrowser = null; this.pupPage = null; @@ -67,39 +77,39 @@ class Client extends EventEmitter { */ async initialize() { let [browser, page] = [null, null]; - - if(this.options.puppeteer && this.options.puppeteer.browserWSEndpoint) { - browser = await puppeteer.connect(this.options.puppeteer); + + const puppeteerOpts = { + ...this.options.puppeteer, + userDataDir: this.options.useDeprecatedSessionAuth ? undefined : this.dataDir + }; + if (puppeteerOpts && puppeteerOpts.browserWSEndpoint) { + browser = await puppeteer.connect(puppeteerOpts); page = await browser.newPage(); } else { - browser = await puppeteer.launch(this.options.puppeteer); + browser = await puppeteer.launch(puppeteerOpts); page = (await browser.pages())[0]; } - + await page.setUserAgent(this.options.userAgent); this.pupBrowser = browser; this.pupPage = page; - // remember me - await page.evaluateOnNewDocument(() => { - localStorage.setItem('remember-me', 'true'); - }); + if (this.options.useDeprecatedSessionAuth && this.options.session) { + await page.evaluateOnNewDocument(session => { + if (document.referrer === 'https://whatsapp.com/') { + localStorage.clear(); + localStorage.setItem('WABrowserId', session.WABrowserId); + localStorage.setItem('WASecretBundle', session.WASecretBundle); + localStorage.setItem('WAToken1', session.WAToken1); + localStorage.setItem('WAToken2', session.WAToken2); + } - if (this.options.session) { - await page.evaluateOnNewDocument( - session => { - if(document.referrer === 'https://whatsapp.com/') { - localStorage.clear(); - localStorage.setItem('WABrowserId', session.WABrowserId); - localStorage.setItem('WASecretBundle', session.WASecretBundle); - localStorage.setItem('WAToken1', session.WAToken1); - localStorage.setItem('WAToken2', session.WAToken2); - } - }, this.options.session); + localStorage.setItem('remember-me', 'true'); + }, this.options.session); } - if(this.options.bypassCSP) { + if (this.options.bypassCSP) { await page.setBypassCSP(true); } @@ -109,56 +119,55 @@ class Client extends EventEmitter { referer: 'https://whatsapp.com/' }); - const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-icon="intro-md-beta-logo-dark"], [data-icon="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]'; - - if (this.options.session) { - // Check if session restore was successful - try { - await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs }); - } catch (err) { - if (err.name === 'TimeoutError') { - /** - * Emitted when there has been an error while trying to restore an existing session - * @event Client#auth_failure - * @param {string} message - */ - this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?'); - browser.close(); - if (this.options.restartOnAuthFail) { - // session restore failed so try again but without session to force new authentication - this.options.session = null; - this.initialize(); - } - return; + const INTRO_IMG_SELECTOR = '[data-testid="intro-md-beta-logo-dark"], [data-testid="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]'; + const INTRO_QRCODE_SELECTOR = 'div[data-ref] canvas'; + + // Checks which selector appears first + const needAuthentication = await Promise.race([ + new Promise(resolve => { + page.waitForSelector(INTRO_IMG_SELECTOR, { timeout: this.options.authTimeoutMs }) + .then(() => resolve(false)) + .catch((err) => resolve(err)); + }), + new Promise(resolve => { + page.waitForSelector(INTRO_QRCODE_SELECTOR, { timeout: this.options.authTimeoutMs }) + .then(() => resolve(true)) + .catch((err) => resolve(err)); + }) + ]); + + // Checks if an error ocurred on the first found selector. The second will be discarded and ignored by .race; + if (needAuthentication instanceof Error) throw needAuthentication; + + // Scan-qrcode selector was found. Needs authentication + if (needAuthentication) { + if(this.options.session) { + /** + * Emitted when there has been an error while trying to restore an existing session + * @event Client#auth_failure + * @param {string} message + * @deprecated + */ + this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?'); + await this.destroy(); + if (this.options.restartOnAuthFail) { + // session restore failed so try again but without session to force new authentication + this.options.session = null; + return this.initialize(); } - - throw err; + return; } - } else { + const QR_CONTAINER = 'div[data-ref]'; + const QR_RETRY_BUTTON = 'div[data-ref] > span > button'; let qrRetries = 0; - - const getQrCode = async () => { - // Check if retry button is present - var QR_RETRY_SELECTOR = 'div[data-ref] > span > button'; - var qrRetry = await page.$(QR_RETRY_SELECTOR); - if (qrRetry) { - await qrRetry.click(); - } - - // Wait for QR Code - const QR_CANVAS_SELECTOR = 'canvas'; - await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: this.options.qrTimeoutMs }); - const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0, 0, 264, 264).data)); - const qr = jsQR(qrImgData, 264, 264).data; - + await page.exposeFunction('qrChanged', async (qr) => { /** - * Emitted when the QR code is received + * 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) { @@ -166,15 +175,39 @@ class Client extends EventEmitter { await this.destroy(); } } - }; - getQrCode(); - this._qrRefreshInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs); + }); + + await page.evaluate(function (selectors) { + const qr_container = document.querySelector(selectors.QR_CONTAINER); + window.qrChanged(qr_container.dataset.ref); + + const obs = new MutationObserver((muts) => { + muts.forEach(mut => { + // Listens to qr token change + if (mut.type === 'attributes' && mut.attributeName === 'data-ref') { + window.qrChanged(mut.target.dataset.ref); + } else + // Listens to retry button, when found, click it + if (mut.type === 'childList') { + const retry_button = document.querySelector(selectors.QR_RETRY_BUTTON); + if (retry_button) retry_button.click(); + } + }); + }); + obs.observe(qr_container.parentElement, { + subtree: true, + childList: true, + attributes: true, + attributeFilter: ['data-ref'], + }); + }, { + QR_CONTAINER, + QR_RETRY_BUTTON + }); // Wait for code scan try { - await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 }); - clearInterval(this._qrRefreshInterval); - this._qrRefreshInterval = undefined; + await page.waitForSelector(INTRO_IMG_SELECTOR, { timeout: 0 }); } catch(error) { if ( error.name === 'ProtocolError' && @@ -187,32 +220,30 @@ class Client extends EventEmitter { throw error; } + } await page.evaluate(ExposeStore, moduleRaid.toString()); - - // Get session tokens - const localStorage = JSON.parse(await page.evaluate(() => { - return JSON.stringify(window.localStorage); - })); - - const session = { - WABrowserId: localStorage.WABrowserId, - WASecretBundle: localStorage.WASecretBundle, - WAToken1: localStorage.WAToken1, - WAToken2: localStorage.WAToken2 - }; + let authEventPayload = undefined; + if (this.options.useDeprecatedSessionAuth) { + // Get session tokens + const localStorage = JSON.parse(await page.evaluate(() => { + return JSON.stringify(window.localStorage); + })); + + authEventPayload = { + WABrowserId: localStorage.WABrowserId, + WASecretBundle: localStorage.WASecretBundle, + WAToken1: localStorage.WAToken1, + WAToken2: localStorage.WAToken2 + }; + } /** * Emitted when authentication is successful * @event Client#authenticated - * @param {object} session Object containing session information. Can be used to restore the session. - * @param {string} session.WABrowserId - * @param {string} session.WASecretBundle - * @param {string} session.WAToken1 - * @param {string} session.WAToken2 */ - this.emit(Events.AUTHENTICATED, session); + this.emit(Events.AUTHENTICATED, authEventPayload); // Check window.Store Injection await page.waitForFunction('window.Store != undefined'); @@ -221,8 +252,17 @@ class Client extends EventEmitter { return window.Store.Features.features.MD_BACKEND; }); - if(isMD) { - throw new Error('Multi-device is not yet supported by whatsapp-web.js. Please check out https://github.com/pedroslopez/whatsapp-web.js/pull/889 to follow the progress.'); + await page.evaluate(async () => { + // safely unregister service workers + const registrations = await navigator.serviceWorker.getRegistrations(); + for (let registration of registrations) { + registration.unregister(); + } + + }); + + if (this.options.useDeprecatedSessionAuth && isMD) { + throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.'); } //Load util functions (serializers, helper functions) @@ -234,7 +274,7 @@ class Client extends EventEmitter { * @type {ClientInfo} */ this.info = new ClientInfo(this, await page.evaluate(() => { - return window.Store.Conn.serialize(); + return { ...window.Store.Conn.serialize(), wid: window.Store.User.getMeUser() }; })); // Add InterfaceController @@ -398,11 +438,12 @@ class Client extends EventEmitter { if (battery === undefined) return; /** - * Emitted when the battery percentage for the attached device changes + * Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device. * @event Client#change_battery * @param {object} batteryInfo * @param {number} batteryInfo.battery - The current battery percentage * @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false) + * @deprecated */ this.emit(Events.BATTERY_CHANGED, { battery, plugged }); }); @@ -421,14 +462,14 @@ class Client extends EventEmitter { * @param {boolean} call.webClientShouldHandle - If Waweb should handle * @param {object} call.participants - Participants */ - const cll = new Call(this,call); + const cll = new Call(this, call); this.emit(Events.INCOMING_CALL, cll); }); - + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); - window.Store.Msg.on('change:ack', (msg,ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); }); + window.Store.Msg.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); }); window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); @@ -466,9 +507,6 @@ class Client extends EventEmitter { * Closes the client */ async destroy() { - if (this._qrRefreshInterval) { - clearInterval(this._qrRefreshInterval); - } await this.pupBrowser.close(); } @@ -476,9 +514,13 @@ class Client extends EventEmitter { * Logs out the client, closing the current session */ async logout() { - return await this.pupPage.evaluate(() => { + await this.pupPage.evaluate(() => { return window.Store.AppState.logout(); }); + + if (this.dataDir) { + return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this.dataDir, { recursive: true }); + } } /** @@ -508,7 +550,7 @@ class Client extends EventEmitter { /** * Message options. * @typedef {Object} MessageSendOptions - * @property {boolean} [linkPreview=true] - Show links preview + * @property {boolean} [linkPreview=true] - Show links preview. Has no effect on multi-device accounts. * @property {boolean} [sendAudioAsVoice=false] - Send audio as voice message * @property {boolean} [sendVideoAsGif=false] - Send video as gif * @property {boolean} [sendMediaAsSticker=false] - Send media as a sticker @@ -558,34 +600,36 @@ class Client extends EventEmitter { } else if (content instanceof Location) { internalOptions.location = content; content = ''; - } else if(content instanceof Contact) { + } else if (content instanceof Contact) { internalOptions.contactCard = content.id._serialized; content = ''; - } else if(Array.isArray(content) && content.length > 0 && content[0] instanceof Contact) { + } else if (Array.isArray(content) && content.length > 0 && content[0] instanceof Contact) { internalOptions.contactCardList = content.map(contact => contact.id._serialized); content = ''; - } else if(content instanceof Buttons){ - if(content.type !== 'chat'){internalOptions.attachment = content.body;} + } else if (content instanceof Buttons) { + if (content.type !== 'chat') { internalOptions.attachment = content.body; } internalOptions.buttons = content; content = ''; - } else if(content instanceof List){ + } else if (content instanceof List) { internalOptions.list = content; content = ''; } if (internalOptions.sendMediaAsSticker && internalOptions.attachment) { - internalOptions.attachment = - await Util.formatToWebpSticker(internalOptions.attachment, { + internalOptions.attachment = await Util.formatToWebpSticker( + internalOptions.attachment, { name: options.stickerName, author: options.stickerAuthor, categories: options.stickerCategories - }); + }, this.pupPage + ); } const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => { const chatWid = window.Store.WidFactory.createWid(chatId); const chat = await window.Store.Chat.find(chatWid); + if (sendSeen) { window.WWebJS.sendSeen(chatId); } @@ -672,7 +716,7 @@ class Client extends EventEmitter { */ async getInviteInfo(inviteCode) { return await this.pupPage.evaluate(inviteCode => { - return window.Store.Wap.groupInviteInfo(inviteCode); + return window.Store.InviteInfo.sendQueryGroupInvite(inviteCode); }, inviteCode); } @@ -691,25 +735,25 @@ class Client extends EventEmitter { /** * Accepts a private invitation to join a group - * @param {object} inviteV4 Invite V4 Info + * @param {object} inviteInfo Invite V4 Info * @returns {Promise} */ async acceptGroupV4Invite(inviteInfo) { - if(!inviteInfo.inviteCode) throw 'Invalid invite code, try passing the message.inviteV4 object'; + if (!inviteInfo.inviteCode) throw 'Invalid invite code, try passing the message.inviteV4 object'; if (inviteInfo.inviteCodeExp == 0) throw 'Expired invite code'; - return await this.pupPage.evaluate(async inviteInfo => { - let { groupId, fromId, inviteCode, inviteCodeExp, toId } = inviteInfo; - return await window.Store.Wap.acceptGroupV4Invite(groupId, fromId, inviteCode, String(inviteCodeExp), toId); + return this.pupPage.evaluate(async inviteInfo => { + let { groupId, fromId, inviteCode, inviteCodeExp } = inviteInfo; + return await window.Store.JoinInviteV4.sendJoinGroupViaInviteV4(inviteCode, String(inviteCodeExp), groupId, fromId); }, inviteInfo); } - + /** * Sets the current user's status message * @param {string} status New status message */ async setStatus(status) { await this.pupPage.evaluate(async status => { - return await window.Store.Wap.sendSetStatus(status); + return await window.Store.StatusUtils.setMyStatus(status); }, status); } @@ -717,11 +761,22 @@ class Client extends EventEmitter { * Sets the current user's display name. * This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile. * @param {string} displayName New display name + * @returns {Promise} */ async setDisplayName(displayName) { - await this.pupPage.evaluate(async displayName => { - return await window.Store.Wap.setPushname(displayName); + const couldSet = await this.pupPage.evaluate(async displayName => { + if(!window.Store.Conn.canSetMyPushname()) return false; + + if(window.Store.Features.features.MD_BACKEND) { + // TODO + return false; + } else { + const res = await window.Store.Wap.setPushname(displayName); + return !res.status || res.status === 200; + } }, displayName); + + return couldSet; } /** @@ -740,7 +795,16 @@ class Client extends EventEmitter { */ async sendPresenceAvailable() { return await this.pupPage.evaluate(() => { - return window.Store.Wap.sendPresenceAvailable(); + return window.Store.PresenceUtils.sendPresenceAvailable(); + }); + } + + /** + * Marks the client as unavailable + */ + async sendPresenceUnavailable() { + return await this.pupPage.evaluate(() => { + return window.Store.PresenceUtils.sendPresenceUnavailable(); }); } @@ -847,12 +911,37 @@ class Client extends EventEmitter { */ async getProfilePicUrl(contactId) { const profilePic = await this.pupPage.evaluate((contactId) => { - return window.Store.Wap.profilePicFind(contactId); + const chatWid = window.Store.WidFactory.createWid(contactId); + return window.Store.getProfilePicFull(chatWid); }, contactId); return profilePic ? profilePic.eurl : undefined; } + /** + * Gets the Contact's common groups with you. Returns empty array if you don't have any common group. + * @param {string} contactId the whatsapp user's ID (_serialized format) + * @returns {Promise} + */ + async getCommonGroups(contactId) { + const commonGroups = await this.pupPage.evaluate(async (contactId) => { + const contact = window.Store.Contact.get(contactId); + if (contact.commonGroups) { + return contact.commonGroups.serialize(); + } + const status = await window.Store.findCommonGroups(contact); + if (status) { + return contact.commonGroups.serialize(); + } + return []; + }, contactId); + const chats = []; + for (const group of commonGroups) { + chats.push(group.id); + } + return chats; + } + /** * Force reset of connection state for the client */ @@ -868,10 +957,7 @@ class Client extends EventEmitter { * @returns {Promise} */ async isRegisteredUser(id) { - return await this.pupPage.evaluate(async (id) => { - let result = await window.Store.Wap.queryExist(id); - return result.jid !== undefined; - }, id); + return Boolean(await this.getNumberId(id)); } /** @@ -881,14 +967,15 @@ class Client extends EventEmitter { * @returns {Promise} */ async getNumberId(number) { - if (!number.endsWith('@c.us')) number += '@c.us'; - try { - return await this.pupPage.evaluate(async numberId => { - return window.WWebJS.getNumberId(numberId); - }, number); - } catch(_) { - return null; + if (!number.endsWith('@c.us')) { + number += '@c.us'; } + + return await this.pupPage.evaluate(async number => { + const result = await window.Store.QueryExist(number); + if (!result || result.wid === undefined) return null; + return result.wid; + }, number); } /** @@ -897,14 +984,14 @@ class Client extends EventEmitter { * @returns {Promise} */ async getFormattedNumber(number) { - if(!number.endsWith('@s.whatsapp.net')) number = number.replace('c.us', 's.whatsapp.net'); - if(!number.includes('@s.whatsapp.net')) number = `${number}@s.whatsapp.net`; - + if (!number.endsWith('@s.whatsapp.net')) number = number.replace('c.us', 's.whatsapp.net'); + if (!number.includes('@s.whatsapp.net')) number = `${number}@s.whatsapp.net`; + return await this.pupPage.evaluate(async numberId => { return window.Store.NumberInfo.formattedPhoneNumber(numberId); }, number); } - + /** * Get the country code of a WhatsApp ID. * @param {string} number Number or ID @@ -917,7 +1004,7 @@ class Client extends EventEmitter { return window.Store.NumberInfo.findCC(numberId); }, number); } - + /** * Create a new group * @param {string} name group title @@ -936,12 +1023,9 @@ class Client extends EventEmitter { } const createRes = await this.pupPage.evaluate(async (name, participantIds) => { - const res = await window.Store.Wap.createGroup(name, participantIds); - console.log(res); - if (!res.status === 200) { - throw 'An error occurred while creating the group!'; - } - + const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p)); + const id = window.Store.genId(); + const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id); return res; }, name, participants); @@ -962,9 +1046,9 @@ class Client extends EventEmitter { async getLabels() { const labels = await this.pupPage.evaluate(async () => { return window.WWebJS.getLabels(); - }); + }); - return labels.map(data => new Label(this , data)); + return labels.map(data => new Label(this, data)); } /** @@ -975,7 +1059,7 @@ class Client extends EventEmitter { async getLabelById(labelId) { const label = await this.pupPage.evaluate(async (labelId) => { return window.WWebJS.getLabel(labelId); - }, labelId); + }, labelId); return new Label(this, label); } @@ -985,12 +1069,12 @@ class Client extends EventEmitter { * @param {string} chatId * @returns {Promise>} */ - async getChatLabels(chatId){ + async getChatLabels(chatId) { const labels = await this.pupPage.evaluate(async (chatId) => { return window.WWebJS.getChatLabels(chatId); }, chatId); - return labels.map(data => new Label(this, data)); + return labels.map(data => new Label(this, data)); } /** @@ -998,16 +1082,16 @@ class Client extends EventEmitter { * @param {string} labelId * @returns {Promise>} */ - async getChatsByLabelId(labelId){ + async getChatsByLabelId(labelId) { const chatIds = await this.pupPage.evaluate(async (labelId) => { const label = window.Store.Label.get(labelId); const labelItems = label.labelItemCollection.models; return labelItems.reduce((result, item) => { - if(item.parentType === 'Chat'){ + if (item.parentType === 'Chat') { result.push(item.parentId); } return result; - },[]); + }, []); }, labelId); return Promise.all(chatIds.map(id => this.getChatById(id))); @@ -1020,7 +1104,7 @@ class Client extends EventEmitter { async getBlockedContacts() { const blockedContacts = await this.pupPage.evaluate(() => { let chatIds = window.Store.Blocklist.models.map(a => a.id._serialized); - return Promise.all(chatIds.map(id => window.WWebJS.getContact(id))); + return Promise.all(chatIds.map(id => window.WWebJS.getContact(id))); }); return blockedContacts.map(contact => ContactFactory.create(this.client, contact)); diff --git a/src/structures/ClientInfo.js b/src/structures/ClientInfo.js index 4dcd00e212e..b6cb2d6475d 100644 --- a/src/structures/ClientInfo.js +++ b/src/structures/ClientInfo.js @@ -20,12 +20,6 @@ class ClientInfo extends Base { */ this.pushname = data.pushname; - /** - * @type {object} - * @deprecated Use .wid instead - */ - this.me = data.wid; - /** * Current user ID * @type {object} @@ -33,18 +27,19 @@ class ClientInfo extends Base { this.wid = data.wid; /** - * Information about the phone this client is connected to + * Information about the phone this client is connected to. Not available in multi-device. * @type {object} * @property {string} wa_version WhatsApp Version running on the phone * @property {string} os_version OS Version running on the phone (iOS or Android version) * @property {string} device_manufacturer Device manufacturer * @property {string} device_model Device model * @property {string} os_build_number OS build number + * @deprecated */ this.phone = data.phone; /** - * Platform the phone is running on + * Platform WhatsApp is running on * @type {string} */ this.platform = data.platform; @@ -57,6 +52,7 @@ class ClientInfo extends Base { * @returns {object} batteryStatus * @returns {number} batteryStatus.battery - The current battery percentage * @returns {boolean} batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false) + * @deprecated */ async getBatteryStatus() { return await this.client.pupPage.evaluate(() => { @@ -64,7 +60,6 @@ class ClientInfo extends Base { return { battery, plugged }; }); } - } module.exports = ClientInfo; \ No newline at end of file diff --git a/src/structures/Contact.js b/src/structures/Contact.js index 844484098dd..7c20012c3f0 100644 --- a/src/structures/Contact.js +++ b/src/structures/Contact.js @@ -183,7 +183,8 @@ class Contact extends Base { */ async getAbout() { const about = await this.client.pupPage.evaluate(async (contactId) => { - return window.Store.Wap.statusFind(contactId); + const wid = window.Store.WidFactory.createWid(contactId); + return window.Store.StatusUtils.getStatus(wid); }, this.id._serialized); if (typeof about.status !== 'string') @@ -191,6 +192,14 @@ class Contact extends Base { return about.status; } + + /** + * Gets the Contact's common groups with you. Returns empty array if you don't have any common group. + * @returns {Promise} + */ + async getCommonGroups() { + return await this.client.getCommonGroups(this.id._serialized); + } } diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 76ff151f3dd..fc837a221c9 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -60,7 +60,9 @@ class GroupChat extends Chat { */ async addParticipants(participantIds) { return await this.client.pupPage.evaluate((chatId, participantIds) => { - return window.Store.Wap.addParticipants(chatId, participantIds); + const chatWid = window.Store.WidFactory.createWid(chatId); + const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); + return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids); }, this.id._serialized, participantIds); } @@ -71,7 +73,9 @@ class GroupChat extends Chat { */ async removeParticipants(participantIds) { return await this.client.pupPage.evaluate((chatId, participantIds) => { - return window.Store.Wap.removeParticipants(chatId, participantIds); + const chatWid = window.Store.WidFactory.createWid(chatId); + const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); + return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids); }, this.id._serialized, participantIds); } @@ -82,7 +86,9 @@ class GroupChat extends Chat { */ async promoteParticipants(participantIds) { return await this.client.pupPage.evaluate((chatId, participantIds) => { - return window.Store.Wap.promoteParticipants(chatId, participantIds); + const chatWid = window.Store.WidFactory.createWid(chatId); + const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); + return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids); }, this.id._serialized, participantIds); } @@ -93,39 +99,53 @@ class GroupChat extends Chat { */ async demoteParticipants(participantIds) { return await this.client.pupPage.evaluate((chatId, participantIds) => { - return window.Store.Wap.demoteParticipants(chatId, participantIds); + const chatWid = window.Store.WidFactory.createWid(chatId); + const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); + return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids); }, this.id._serialized, participantIds); } /** * Updates the group subject * @param {string} subject - * @returns {Promise} + * @returns {Promise} Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions. */ async setSubject(subject) { - let res = await this.client.pupPage.evaluate((chatId, subject) => { - return window.Store.Wap.changeSubject(chatId, subject); + const success = await this.client.pupPage.evaluate(async (chatId, subject) => { + const chatWid = window.Store.WidFactory.createWid(chatId); + try { + return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject); + } catch (err) { + if(err.name === 'ServerStatusCodeError') return false; + throw err; + } }, this.id._serialized, subject); - if(res.status == 200) { - this.name = subject; - } + if(!success) return false; + this.name = subject; + return true; } /** * Updates the group description * @param {string} description - * @returns {Promise} + * @returns {Promise} Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions. */ async setDescription(description) { - let res = await this.client.pupPage.evaluate((chatId, description) => { - let descId = window.Store.GroupMetadata.get(chatId).descId; - return window.Store.Wap.setGroupDescription(chatId, description, window.Store.genId(), descId); + const success = await this.client.pupPage.evaluate(async (chatId, description) => { + const chatWid = window.Store.WidFactory.createWid(chatId); + let descId = window.Store.GroupMetadata.get(chatWid).descId; + try { + return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.genId(), descId); + } catch (err) { + if(err.name === 'ServerStatusCodeError') return false; + throw err; + } }, this.id._serialized, description); - if (res.status == 200) { - this.groupMetadata.desc = description; - } + if(!success) return false; + this.groupMetadata.desc = description; + return true; } /** @@ -134,12 +154,18 @@ class GroupChat extends Chat { * @returns {Promise} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. */ async setMessagesAdminsOnly(adminsOnly=true) { - let res = await this.client.pupPage.evaluate((chatId, value) => { - return window.Store.Wap.setGroupProperty(chatId, 'announcement', value); + const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { + const chatWid = window.Store.WidFactory.createWid(chatId); + try { + return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + } catch (err) { + if(err.name === 'ServerStatusCodeError') return false; + throw err; + } }, this.id._serialized, adminsOnly); - if (res.status !== 200) return false; - + if(!success) return false; + this.groupMetadata.announce = adminsOnly; return true; } @@ -150,11 +176,17 @@ class GroupChat extends Chat { * @returns {Promise} Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions. */ async setInfoAdminsOnly(adminsOnly=true) { - let res = await this.client.pupPage.evaluate((chatId, value) => { - return window.Store.Wap.setGroupProperty(chatId, 'restrict', value); + const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { + const chatWid = window.Store.WidFactory.createWid(chatId); + try { + return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + } catch (err) { + if(err.name === 'ServerStatusCodeError') return false; + throw err; + } }, this.id._serialized, adminsOnly); - if (res.status !== 200) return false; + if(!success) return false; this.groupMetadata.restrict = adminsOnly; return true; @@ -165,25 +197,25 @@ class GroupChat extends Chat { * @returns {Promise} Group's invite code */ async getInviteCode() { - let res = await this.client.pupPage.evaluate(chatId => { - return window.Store.Wap.groupInviteCode(chatId); + const code = await this.client.pupPage.evaluate(async chatId => { + const chatWid = window.Store.WidFactory.createWid(chatId); + return window.Store.Invite.sendQueryGroupInviteCode(chatWid); }, this.id._serialized); - if (res.status == 200) { - return res.code; - } - - throw new Error('Not authorized'); + return code; } /** * Invalidates the current group invite code and generates a new one - * @returns {Promise} + * @returns {Promise} New invite code */ async revokeInvite() { - return await this.client.pupPage.evaluate(chatId => { - return window.Store.Wap.revokeGroupInvite(chatId); + const code = await this.client.pupPage.evaluate(chatId => { + const chatWid = window.Store.WidFactory.createWid(chatId); + return window.Store.Invite.sendRevokeGroupInviteCode(chatWid); }, this.id._serialized); + + return code; } /** @@ -191,8 +223,9 @@ class GroupChat extends Chat { * @returns {Promise} */ async leave() { - return await this.client.pupPage.evaluate(chatId => { - return window.Store.Wap.leaveGroup(chatId); + await this.client.pupPage.evaluate(chatId => { + const chatWid = window.Store.WidFactory.createWid(chatId); + return window.Store.GroupUtils.sendExitGroup(chatWid); }, this.id._serialized); } diff --git a/src/structures/Message.js b/src/structures/Message.js index 5f6e4f07a31..6a326b937b8 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -19,13 +19,14 @@ class Message extends Base { } _patch(data) { + this._data = data; + /** * MediaKey that represents the sticker 'ID' * @type {string} */ this.mediaKey = data.mediaKey; - - + /** * ID that represents the message * @type {object} @@ -50,7 +51,7 @@ class Message extends Base { */ this.body = this.hasMedia ? data.caption || '' : data.body || ''; - /** + /** * Message type * @type {MessageTypes} */ @@ -70,9 +71,9 @@ class Message extends Base { /** * ID for who this message is for. - * + * * If the message is sent by the current user, it will be the Chat to which the message is being sent. - * If the message is sent by another user, it will be the ID for the current user. + * If the message is sent by another user, it will be the ID for the current user. * @type {string} */ this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to; @@ -87,8 +88,8 @@ 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 = data.id.id.length > 21 ? 'android' : data.id.id.substring(0, 2) == '3A' ? 'ios' : 'web'; + /** * Indicates if the message was forwarded * @type {boolean} @@ -114,14 +115,14 @@ class Message extends Base { * @type {boolean} */ this.isStarred = data.star; - + /** * Indicates if the message was a broadcast * @type {boolean} */ this.broadcast = data.broadcast; - /** + /** * Indicates if the message was sent by the current user * @type {boolean} */ @@ -157,7 +158,7 @@ class Message extends Base { fromId: data.from._serialized, toId: data.to._serialized } : undefined; - + /** * Indicates the mentions in the message body. * @type {Array} @@ -214,7 +215,7 @@ class Message extends Base { /** * Links included in the message. * @type {Array<{link: string, isSuspicious: boolean}>} - * + * */ this.links = data.links; @@ -222,7 +223,7 @@ class Message extends Base { if (data.dynamicReplyButtons) { this.dynamicReplyButtons = data.dynamicReplyButtons; } - + /** Selected Button Id **/ if (data.selectedButtonId) { this.selectedButtonId = data.selectedButtonId; @@ -232,7 +233,7 @@ class Message extends Base { if (data.listResponse && data.listResponse.singleSelectReply.selectedRowId) { this.selectedRowId = data.listResponse.singleSelectReply.selectedRowId; } - + return super._patch(data); } @@ -240,6 +241,32 @@ class Message extends Base { return this.fromMe ? this.to : this.from; } + /** + * Reloads this Message object's data in-place with the latest values from WhatsApp Web. + * Note that the Message must still be in the web app cache for this to work, otherwise will return null. + * @returns {Promise} + */ + async reload() { + const newData = await this.client.pupPage.evaluate((msgId) => { + const msg = window.Store.Msg.get(msgId); + if(!msg) return null; + return window.WWebJS.getMessageModel(msg); + }, this.id._serialized); + + if(!newData) return null; + + this._patch(newData); + return this; + } + + /** + * Returns message in a raw format + * @type {Object} + */ + get rawData() { + return this._data; + } + /** * Returns the Chat this message was sent in * @returns {Promise} @@ -280,12 +307,12 @@ class Message extends Base { } /** - * Sends a message as a reply to this message. If chatId is specified, it will be sent - * through the specified Chat. If not, it will send the message + * Sends a message as a reply to this message. If chatId is specified, it will be sent + * through the specified Chat. If not, it will send the message * in the same Chat as the original message was sent. - * - * @param {string|MessageMedia|Location} content - * @param {string} [chatId] + * + * @param {string|MessageMedia|Location} content + * @param {string} [chatId] * @param {MessageSendOptions} [options] * @returns {Promise} */ @@ -309,10 +336,10 @@ class Message extends Base { async acceptGroupV4Invite() { return await this.client.acceptGroupV4Invite(this.inviteV4); } - + /** * Forwards this message to another chat - * + * * @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded * @returns {Promise} */ @@ -342,7 +369,7 @@ class Message extends Base { if (msg.mediaData.mediaStage != 'RESOLVED') { // try to resolve media await msg.downloadMedia({ - downloadEvenIfExpensive: true, + downloadEvenIfExpensive: true, rmrReason: 1 }); } @@ -362,9 +389,9 @@ class Message extends Base { type: msg.type, signal: (new AbortController).signal }); - + const data = window.WWebJS.arrayBufferToBase64(decryptedMedia); - + return { data, mimetype: msg.mimetype, @@ -440,14 +467,10 @@ class Message extends Base { async getInfo() { const info = await this.client.pupPage.evaluate(async (msgId) => { const msg = window.Store.Msg.get(msgId); - if(!msg) return null; - - return await window.Store.Wap.queryMsgInfo(msg.id); - }, this.id._serialized); + if (!msg) return null; - if(info.status) { - return null; - } + return await window.Store.MessageInfo.sendQueryMsgInfo(msg.id); + }, this.id._serialized); return info; } diff --git a/src/util/Constants.js b/src/util/Constants.js index b95ccd17634..1b27ca5d0b0 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -7,10 +7,9 @@ exports.DefaultOptions = { headless: true, defaultViewport: null }, - session: false, - qrTimeoutMs: 45000, - qrRefreshIntervalMs: 20000, - authTimeoutMs: 45000, + dataPath: './WWebJS/', + useDeprecatedSessionAuth: false, + authTimeoutMs: 0, qrMaxRetries: 0, takeoverOnConflict: false, takeoverTimeoutMs: 0, diff --git a/src/util/Injected.js b/src/util/Injected.js index 60317520986..0169494c080 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -8,36 +8,59 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store = Object.assign({}, window.mR.findModule(m => m.default && m.default.Chat)[0].default); window.Store.AppState = window.mR.findModule('Socket')[0].Socket; window.Store.Conn = window.mR.findModule('Conn')[0].Conn; - window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default; - window.Store.SendSeen = window.mR.findModule('sendSeen')[0]; - window.Store.SendClear = window.mR.findModule('sendClear')[0]; - window.Store.SendDelete = window.mR.findModule('sendDelete')[0]; - window.Store.genId = window.mR.findModule('randomId')[0].randomId; - window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0]; - window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; + window.Store.BlockContact = window.mR.findModule('blockContact')[0]; + window.Store.Call = window.mR.findModule('CallCollection')[0].CallCollection; + window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd; + window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; + window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; + window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK; + window.Store.genId = window.mR.findModule('newTag')[0].newTag; + window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; - window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default; + window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0]; + window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection; window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0]; window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0]; - window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0]; window.Store.NumberInfo = window.mR.findModule('formattedPhoneNumber')[0]; - window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd; window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0]; - window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0]; + window.Store.MediaUpload = window.mR.findModule('uploadMedia')[0]; + window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; + window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0]; + window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default; + window.Store.QueryExist = window.mR.findModule(module => typeof module.default === 'function' && module.default.toString().includes('Should not reach queryExists MD'))[0].default; + window.Store.QueryProduct = window.mR.findModule('queryProduct')[0]; + window.Store.QueryOrder = window.mR.findModule('queryOrder')[0]; + window.Store.SendClear = window.mR.findModule('sendClear')[0]; + window.Store.SendDelete = window.mR.findModule('sendDelete')[0]; + window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0]; + window.Store.SendSeen = window.mR.findModule('sendSeen')[0]; + window.Store.Sticker = window.mR.findModule('Sticker')[0].Sticker; + window.Store.User = window.mR.findModule('getMaybeMeUser')[0]; + window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default; window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default; window.Store.Validators = window.mR.findModule('findLinks')[0]; + window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0]; + window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default; window.Store.WidFactory = window.mR.findModule('createWid')[0]; - window.Store.BlockContact = window.mR.findModule('blockContact')[0]; - window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default; - window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default; - window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection; - window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK; - window.Store.QueryOrder = window.mR.findModule('queryOrder')[0]; - window.Store.QueryProduct = window.mR.findModule('queryProduct')[0]; - window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; - window.Store.Call = window.mR.findModule('CallCollection')[0].CallCollection; + window.Store.getProfilePicFull = window.mR.findModule('getProfilePicFull')[0].getProfilePicFull; + window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0]; + window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0]; + window.Store.GroupParticipants = window.mR.findModule('sendPromoteParticipants')[0]; + window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0]; + window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups; + window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0]; + window.Store.StickerTools = { + ...window.mR.findModule('toWebpSticker')[0], + ...window.mR.findModule('addWebpMetadata')[0] + }; + + window.Store.GroupUtils = { + ...window.mR.findModule('sendCreateGroup')[0], + ...window.mR.findModule('sendSetGroupSubject')[0], + ...window.mR.findModule('markExited')[0] + }; - if(!window.Store.Chat._find) { + if (!window.Store.Chat._find) { window.Store.Chat._find = e => { const target = window.Store.Chat.get(e); return target ? Promise.resolve(target) : Promise.resolve({ @@ -50,14 +73,6 @@ exports.ExposeStore = (moduleRaidStr) => { exports.LoadUtils = () => { window.WWebJS = {}; - window.WWebJS.getNumberId = async (id) => { - - let result = await window.Store.Wap.queryExist(id); - if (result.jid === undefined) - throw 'The number provided is not a registered whatsapp user'; - return result.jid; - }; - window.WWebJS.sendSeen = async (chatId) => { let chat = window.Store.Chat.get(chatId); if (chat !== undefined) { @@ -67,14 +82,14 @@ exports.LoadUtils = () => { return false; }; - + window.WWebJS.sendMessage = async (chat, content, options = {}) => { let attOptions = {}; if (options.attachment) { - attOptions = options.sendMediaAsSticker + attOptions = options.sendMediaAsSticker ? await window.WWebJS.processStickerData(options.attachment) : await window.WWebJS.processMediaData(options.attachment, { - forceVoice: options.sendAudioAsVoice, + forceVoice: options.sendAudioAsVoice, forceDocument: options.sendMediaAsDocument, forceGif: options.sendVideoAsGif }); @@ -144,22 +159,26 @@ exports.LoadUtils = () => { if (options.linkPreview) { delete options.linkPreview; - const link = window.Store.Validators.findLink(content); - if (link) { - const preview = await window.Store.Wap.queryLinkPreview(link.url); - preview.preview = true; - preview.subtype = 'url'; - options = { ...options, ...preview }; + + // Not supported yet by WhatsApp Web on MD + if(!window.Store.Features.features.MD_BACKEND) { + const link = window.Store.Validators.findLink(content); + if (link) { + const preview = await window.Store.Wap.queryLinkPreview(link.url); + preview.preview = true; + preview.subtype = 'url'; + options = { ...options, ...preview }; + } } } let buttonOptions = {}; if(options.buttons){ let caption; - if(options.buttons.type === 'chat') { + if (options.buttons.type === 'chat') { content = options.buttons.body; caption = content; - }else{ + } else { caption = options.caption ? options.caption : ' '; //Caption can't be empty } buttonOptions = { @@ -192,11 +211,16 @@ exports.LoadUtils = () => { delete options.list; delete listOptions.list.footer; } - + + const meUser = window.Store.User.getMaybeMeUser(); + const isMD = window.Store.Features.features.MD_BACKEND; + const newMsgId = new window.Store.MsgKey({ - fromMe: true, - remote: chat.id, + from: meUser, + to: chat.id, id: window.Store.genId(), + participant: isMD && chat.id.isGroup() ? meUser : undefined, + selfDir: 'out', }); const extraOptions = options.extraOptions || {}; @@ -213,7 +237,7 @@ exports.LoadUtils = () => { id: newMsgId, ack: 0, body: content, - from: window.Store.Conn.wid, + from: meUser, to: chat.id, local: true, self: 'out', @@ -234,11 +258,25 @@ exports.LoadUtils = () => { return window.Store.Msg.get(newMsgId._serialized); }; + window.WWebJS.toStickerData = async (mediaInfo) => { + if (mediaInfo.mimetype == 'image/webp') return mediaInfo; + + const file = window.WWebJS.mediaInfoToFile(mediaInfo); + const webpSticker = await window.Store.StickerTools.toWebpSticker(file); + const webpBuffer = await webpSticker.arrayBuffer(); + const data = window.WWebJS.arrayBufferToBase64(webpBuffer); + + return { + mimetype: 'image/webp', + data + }; + }; + window.WWebJS.processStickerData = async (mediaInfo) => { if (mediaInfo.mimetype !== 'image/webp') throw new Error('Invalid media type'); const file = window.WWebJS.mediaInfoToFile(mediaInfo); - let filehash = await window.WWebJS.getFileHash(file); + let filehash = await window.WWebJS.getFileHash(file); let mediaKey = await window.WWebJS.generateHash(32); const controller = new AbortController(); @@ -324,11 +362,11 @@ exports.LoadUtils = () => { window.WWebJS.getMessageModel = message => { const msg = message.serialize(); - + msg.isEphemeral = message.isEphemeral; msg.isStatusV3 = message.isStatusV3; - msg.links = (message.getLinks()).map(link => ({ - link: link.href, + msg.links = (message.getLinks()).map(link => ({ + link: link.href, isSuspicious: Boolean(link.suspiciousCharacters && link.suspiciousCharacters.size) })); @@ -338,28 +376,30 @@ exports.LoadUtils = () => { if (msg.dynamicReplyButtons) { msg.dynamicReplyButtons = JSON.parse(JSON.stringify(msg.dynamicReplyButtons)); } - if(msg.replyButtons) { + if (msg.replyButtons) { msg.replyButtons = JSON.parse(JSON.stringify(msg.replyButtons)); } - if(typeof msg.id.remote === 'object') { - msg.id = Object.assign({}, msg.id, {remote: msg.id.remote._serialized}); + if (typeof msg.id.remote === 'object') { + msg.id = Object.assign({}, msg.id, { remote: msg.id.remote._serialized }); } - + delete msg.pendingAckUpdate; - + return msg; }; window.WWebJS.getChatModel = async chat => { + let res = chat.serialize(); res.isGroup = chat.isGroup; res.formattedTitle = chat.formattedTitle; res.isMuted = chat.mute && chat.mute.isMuted; if (chat.groupMetadata) { - await window.Store.GroupMetadata.update(chat.id._serialized); + const chatWid = window.Store.WidFactory.createWid((chat.id._serialized)); + await window.Store.GroupMetadata.update(chatWid); res.groupMetadata = chat.groupMetadata.serialize(); } @@ -414,7 +454,7 @@ exports.LoadUtils = () => { }; window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => { - const binaryData = atob(data); + const binaryData = window.atob(data); const buffer = new ArrayBuffer(binaryData.length); const view = new Uint8Array(buffer); @@ -431,15 +471,15 @@ exports.LoadUtils = () => { window.WWebJS.arrayBufferToBase64 = (arrayBuffer) => { let binary = ''; - const bytes = new Uint8Array( arrayBuffer ); + const bytes = new Uint8Array(arrayBuffer); const len = bytes.byteLength; for (let i = 0; i < len; i++) { - binary += String.fromCharCode( bytes[ i ] ); + binary += String.fromCharCode(bytes[i]); } - return window.btoa( binary ); + return window.btoa(binary); }; - window.WWebJS.getFileHash = async (data) => { + window.WWebJS.getFileHash = async (data) => { let buffer = await data.arrayBuffer(); const hashBuffer = await crypto.subtle.digest('SHA-256', buffer); return btoa(String.fromCharCode(...new Uint8Array(hashBuffer))); @@ -449,7 +489,7 @@ exports.LoadUtils = () => { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; - for ( var i = 0; i < length; i++ ) { + for (var i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; @@ -474,15 +514,18 @@ exports.LoadUtils = () => { }; window.WWebJS.sendChatstate = async (state, chatId) => { + if (window.Store.Features.features.MD_BACKEND) { + chatId = window.Store.WidFactory.createWid(chatId); + } switch (state) { case 'typing': - await window.Store.Wap.sendChatstateComposing(chatId); + await window.Store.ChatState.sendChatStateComposing(chatId); break; case 'recording': - await window.Store.Wap.sendChatstateRecording(chatId); + await window.Store.ChatState.sendChatStateRecording(chatId); break; case 'stop': - await window.Store.Wap.sendChatstatePaused(chatId); + await window.Store.ChatState.sendChatStatePaused(chatId); break; default: throw 'Invalid chatstate'; @@ -494,7 +537,7 @@ exports.LoadUtils = () => { window.WWebJS.getLabelModel = label => { let res = label.serialize(); res.hexColor = label.hexColor; - + return res; }; @@ -527,20 +570,3 @@ exports.LoadUtils = () => { return undefined; }; }; - -exports.MarkAllRead = () => { - let Chats = window.Store.Chat.models; - - for (let chatIndex in Chats) { - if (isNaN(chatIndex)) { - continue; - } - - let chat = Chats[chatIndex]; - - if (chat.unreadCount > 0) { - chat.markSeen(); - window.Store.Wap.sendConversationSeen(chat.id, chat.getLastMsgKeyForAction(), chat.unreadCount - chat.pendingSeenCount); - } - } -}; diff --git a/src/util/Util.js b/src/util/Util.js index 4bfc378e8f0..a3a6bb94c00 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -1,6 +1,5 @@ 'use strict'; -const sharp = require('sharp'); const path = require('path'); const Crypto = require('crypto'); const { tmpdir } = require('os'); @@ -14,7 +13,6 @@ const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); * Utility methods */ class Util { - constructor() { throw new Error(`The ${this.constructor.name} class may not be instantiated.`); } @@ -23,7 +21,7 @@ class Util { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; - for ( var i = 0; i < length; i++ ) { + for (var i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; @@ -55,33 +53,19 @@ class Util { * * @returns {Promise} media in webp format */ - static async formatImageToWebpSticker(media) { + static async formatImageToWebpSticker(media, pupPage) { if (!media.mimetype.includes('image')) throw new Error('media is not a image'); - + if (media.mimetype.includes('webp')) { return media; } - - const buff = Buffer.from(media.data, 'base64'); - - let sharpImg = sharp(buff); - sharpImg = sharpImg.webp(); - - sharpImg = sharpImg.resize(512, 512, { - fit: 'contain', - background: { r: 0, g: 0, b: 0, alpha: 0 }, - }); - - let webpBase64 = (await sharpImg.toBuffer()).toString('base64'); - - return { - mimetype: 'image/webp', - data: webpBase64, - filename: media.filename, - }; + + return pupPage.evaluate((media) => { + return window.WWebJS.toStickerData(media); + }, media); } - + /** * Formats a video to webp * @param {MessageMedia} media @@ -91,14 +75,14 @@ class Util { static async formatVideoToWebpSticker(media) { if (!media.mimetype.includes('video')) throw new Error('media is not a video'); - + const videoType = media.mimetype.split('/')[1]; const tempFile = path.join( tmpdir(), `${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp` ); - + const stream = new (require('stream').Readable)(); const buffer = Buffer.from( media.data.replace(`data:${media.mimetype};base64,`, ''), @@ -135,17 +119,17 @@ class Util { .toFormat('webp') .save(tempFile); }); - + const data = await fs.readFile(tempFile, 'base64'); await fs.unlink(tempFile); - - return { + + return { mimetype: 'image/webp', data: data, filename: media.filename, }; } - + /** * Sticker metadata. * @typedef {Object} StickerMetadata @@ -161,14 +145,14 @@ class Util { * * @returns {Promise} media in webp format */ - static async formatToWebpSticker(media, metadata) { + static async formatToWebpSticker(media, metadata, pupPage) { let webpMedia; - if (media.mimetype.includes('image')) - webpMedia = await this.formatImageToWebpSticker(media); - else if (media.mimetype.includes('video')) + if (media.mimetype.includes('image')) + webpMedia = await this.formatImageToWebpSticker(media, pupPage); + else if (media.mimetype.includes('video')) webpMedia = await this.formatVideoToWebpSticker(media); - else + else throw new Error('Invalid media format'); if (metadata.name || metadata.author) { diff --git a/tests/README.md b/tests/README.md index e1c9544f55b..4b98aa8b9f5 100644 --- a/tests/README.md +++ b/tests/README.md @@ -3,8 +3,12 @@ These tests require an authenticated WhatsApp Web session, as well as an additional phone that you can send messages to. This can be configured using the following environment variables: -- `WWEBJS_TEST_SESSION`: A JSON-formatted string with the session details. Must include `WABrowserId`, `WASecretBundle`, `WAToken1` and `WAToken2`. -- `WWEBJS_TEST_SESSION_PATH`: Path to a JSON file that contains the session details. Must include `WABrowserId`, `WASecretBundle`, `WAToken1` and `WAToken2`. +- `WWEBJS_TEST_SESSION`: A JSON-formatted string with legacy auth session details. Must include `WABrowserId`, `WASecretBundle`, `WAToken1` and `WAToken2`. +- `WWEBJS_TEST_SESSION_PATH`: Path to a JSON file that contains the legacy auth session details. Must include `WABrowserId`, `WASecretBundle`, `WAToken1` and `WAToken2`. +- `WWEBJS_TEST_CLIENT_ID`: `clientId` to use for local file based authentication. - `WWEBJS_TEST_REMOTE_ID`: A valid WhatsApp ID that you can send messages to, e.g. `123456789@c.us`. It should be different from the ID used by the provided session. -You *must* set `WWEBJS_TEST_REMOTE_ID` **and** either `WWEBJS_TEST_SESSION` or `WWEBJS_TEST_SESSION_PATH` for the tests to run properly. +You *must* set `WWEBJS_TEST_REMOTE_ID` **and** either `WWEBJS_TEST_SESSION`, `WWEBJS_TEST_SESSION_PATH` or `WWEBJS_TEST_CLIENT_ID` for the tests to run properly. + +### Multidevice +Some of the tested functionality depends on whether the account has multidevice enabled or not. If you are using multidevice, you should set `WWEBJS_TEST_MD=1`. \ No newline at end of file diff --git a/tests/client.js b/tests/client.js index 49c69ec3214..c99d6729222 100644 --- a/tests/client.js +++ b/tests/client.js @@ -1,4 +1,5 @@ -const {expect} = require('chai'); +const chai = require('chai'); +const chaiAsPromised = require('chai-as-promised'); const sinon = require('sinon'); const helper = require('./helper'); @@ -9,7 +10,11 @@ const MessageMedia = require('../src/structures/MessageMedia'); const Location = require('../src/structures/Location'); const { MessageTypes, WAState } = require('../src/util/Constants'); +const expect = chai.expect; +chai.use(chaiAsPromised); + const remoteId = helper.remoteId; +const isMD = helper.isMD(); describe('Client', function() { describe('Authentication', function() { @@ -47,84 +52,17 @@ describe('Client', function() { expect(disconnectedCallback.calledOnceWith('Max qrcode retries reached')).to.eql(true); }); - it('should fail auth if session is invalid', async function() { + it('should authenticate with existing session', async function() { this.timeout(40000); - const authFailCallback = sinon.spy(); + const authenticatedCallback = sinon.spy(); const qrCallback = sinon.spy(); const readyCallback = sinon.spy(); const client = helper.createClient({ - options: { - session: { - WABrowserId: 'invalid', - WASecretBundle: 'invalid', - WAToken1: 'invalid', - WAToken2: 'invalid' - }, - authTimeoutMs: 10000, - restartOnAuthFail: false - } + authenticated: true, }); - client.on('qr', qrCallback); - client.on('auth_failure', authFailCallback); - client.on('ready', readyCallback); - - client.initialize(); - - await helper.sleep(25000); - - expect(authFailCallback.called).to.equal(true); - expect(authFailCallback.args[0][0]).to.equal('Unable to log in. Are the session details valid?'); - - expect(readyCallback.called).to.equal(false); - expect(qrCallback.called).to.equal(false); - - await client.destroy(); - }); - - it('can restart without a session if session was invalid and restartOnAuthFail=true', async function() { - this.timeout(40000); - - const authFailCallback = sinon.spy(); - const qrCallback = sinon.spy(); - - const client = helper.createClient({ - options:{ - session: { - WABrowserId: 'invalid', - WASecretBundle: 'invalid', - WAToken1: 'invalid', - WAToken2: 'invalid' - }, - authTimeoutMs: 10000, - restartOnAuthFail: true - } - }); - - client.on('auth_failure', authFailCallback); - client.on('qr', qrCallback); - - client.initialize(); - - await helper.sleep(35000); - - expect(authFailCallback.called).to.equal(true); - expect(qrCallback.called).to.equal(true); - expect(qrCallback.args[0][0]).to.have.lengthOf(152); - - await client.destroy(); - }); - - it('should authenticate with existing session', async function() { - this.timeout(40000); - - const authenticatedCallback = sinon.spy(); - const qrCallback = sinon.spy(); - const readyCallback = sinon.spy(); - - const client = helper.createClient({withSession: true}); client.on('qr', qrCallback); client.on('authenticated', authenticatedCallback); client.on('ready', readyCallback); @@ -132,59 +70,137 @@ describe('Client', function() { await client.initialize(); expect(authenticatedCallback.called).to.equal(true); - const newSession = authenticatedCallback.args[0][0]; - expect(newSession).to.have.key([ - 'WABrowserId', - 'WASecretBundle', - 'WAToken1', - 'WAToken2' - ]); - expect(authenticatedCallback.called).to.equal(true); + + if(helper.isUsingDeprecatedSession()) { + const newSession = authenticatedCallback.args[0][0]; + expect(newSession).to.have.key([ + 'WABrowserId', + 'WASecretBundle', + 'WAToken1', + 'WAToken2' + ]); + } + expect(readyCallback.called).to.equal(true); expect(qrCallback.called).to.equal(false); await client.destroy(); - }); - - it('can take over if client was logged in somewhere else with takeoverOnConflict=true', async function() { - this.timeout(40000); - - const readyCallback1 = sinon.spy(); - const readyCallback2 = sinon.spy(); - const disconnectedCallback1 = sinon.spy(); - const disconnectedCallback2 = sinon.spy(); - - const client1 = helper.createClient({ - withSession: true, - options: { takeoverOnConflict: true, takeoverTimeoutMs: 5000 } - }); - const client2 = helper.createClient({withSession: true}); - - client1.on('ready', readyCallback1); - client2.on('ready', readyCallback2); - client1.on('disconnected', disconnectedCallback1); - client2.on('disconnected', disconnectedCallback2); - - await client1.initialize(); - expect(readyCallback1.called).to.equal(true); - expect(readyCallback2.called).to.equal(false); - expect(disconnectedCallback1.called).to.equal(false); - expect(disconnectedCallback2.called).to.equal(false); - - await client2.initialize(); - expect(readyCallback2.called).to.equal(true); - expect(disconnectedCallback1.called).to.equal(false); - expect(disconnectedCallback2.called).to.equal(false); - - // wait for takeoverTimeoutMs to kick in - await helper.sleep(5200); - expect(disconnectedCallback1.called).to.equal(false); - expect(disconnectedCallback2.called).to.equal(true); - expect(disconnectedCallback2.calledWith(WAState.CONFLICT)).to.equal(true); + }); - await client1.destroy(); + describe('Non-MD only', function () { + if(!isMD) { + it('can take over if client was logged in somewhere else with takeoverOnConflict=true', async function() { + this.timeout(40000); + + const readyCallback1 = sinon.spy(); + const readyCallback2 = sinon.spy(); + const disconnectedCallback1 = sinon.spy(); + const disconnectedCallback2 = sinon.spy(); + + const client1 = helper.createClient({ + authenticated: true, + options: { takeoverOnConflict: true, takeoverTimeoutMs: 5000 } + }); + const client2 = helper.createClient({authenticated: true}); + + client1.on('ready', readyCallback1); + client2.on('ready', readyCallback2); + client1.on('disconnected', disconnectedCallback1); + client2.on('disconnected', disconnectedCallback2); + + await client1.initialize(); + expect(readyCallback1.called).to.equal(true); + expect(readyCallback2.called).to.equal(false); + expect(disconnectedCallback1.called).to.equal(false); + expect(disconnectedCallback2.called).to.equal(false); + + await client2.initialize(); + expect(readyCallback2.called).to.equal(true); + expect(disconnectedCallback1.called).to.equal(false); + expect(disconnectedCallback2.called).to.equal(false); + + // wait for takeoverTimeoutMs to kick in + await helper.sleep(5200); + expect(disconnectedCallback1.called).to.equal(false); + expect(disconnectedCallback2.called).to.equal(true); + expect(disconnectedCallback2.calledWith(WAState.CONFLICT)).to.equal(true); + + await client1.destroy(); + }); - }); + it('should fail auth if session is invalid', async function() { + this.timeout(40000); + + const authFailCallback = sinon.spy(); + const qrCallback = sinon.spy(); + const readyCallback = sinon.spy(); + + const client = helper.createClient({ + options: { + session: { + WABrowserId: 'invalid', + WASecretBundle: 'invalid', + WAToken1: 'invalid', + WAToken2: 'invalid' + }, + authTimeoutMs: 10000, + restartOnAuthFail: false, + useDeprecatedSessionAuth: true + } + }); + + client.on('qr', qrCallback); + client.on('auth_failure', authFailCallback); + client.on('ready', readyCallback); + + client.initialize(); + + await helper.sleep(25000); + + expect(authFailCallback.called).to.equal(true); + expect(authFailCallback.args[0][0]).to.equal('Unable to log in. Are the session details valid?'); + + expect(readyCallback.called).to.equal(false); + expect(qrCallback.called).to.equal(false); + + await client.destroy(); + }); + + it('can restart without a session if session was invalid and restartOnAuthFail=true', async function() { + this.timeout(40000); + + const authFailCallback = sinon.spy(); + const qrCallback = sinon.spy(); + + const client = helper.createClient({ + options:{ + session: { + WABrowserId: 'invalid', + WASecretBundle: 'invalid', + WAToken1: 'invalid', + WAToken2: 'invalid' + }, + authTimeoutMs: 10000, + restartOnAuthFail: true, + useDeprecatedSessionAuth: true + } + }); + + client.on('auth_failure', authFailCallback); + client.on('qr', qrCallback); + + client.initialize(); + + await helper.sleep(35000); + + expect(authFailCallback.called).to.equal(true); + expect(qrCallback.called).to.equal(true); + expect(qrCallback.args[0][0]).to.have.lengthOf(152); + + await client.destroy(); + }); + } + }); }); describe('Authenticated', function() { @@ -192,7 +208,7 @@ describe('Client', function() { before(async function() { this.timeout(35000); - client = helper.createClient({withSession: true}); + client = helper.createClient({authenticated: true}); await client.initialize(); }); @@ -221,27 +237,38 @@ describe('Client', function() { 'BlockContact', 'Call', 'Chat', + 'ChatState', 'Cmd', 'Conn', 'Contact', 'DownloadManager', 'Features', 'GroupMetadata', + 'GroupParticipants', + 'GroupUtils', 'Invite', + 'InviteInfo', + 'JoinInviteV4', 'Label', 'MediaObject', 'MediaPrep', 'MediaTypes', 'MediaUpload', + 'MessageInfo', 'Msg', 'MsgKey', 'OpaqueData', 'QueryOrder', 'QueryProduct', + 'PresenceUtils', + 'QueryExist', + 'QueryProduct', + 'QueryOrder', 'SendClear', 'SendDelete', 'SendMessage', 'SendSeen', + 'StatusUtils', 'Sticker', 'UploadUtils', 'UserConstructor', @@ -249,7 +276,9 @@ describe('Client', function() { 'Validators', 'Wap', 'WidFactory', - 'genId' + 'findCommonGroups', + 'genId', + 'getProfilePicFull', ]; const loadedModules = await client.pupPage.evaluate((expectedModules) => { @@ -535,8 +564,6 @@ END:VCARD`; describe('Search messages', function () { it('can search for messages', async function () { - this.timeout(5000); - const m1 = await client.sendMessage(remoteId, 'I\'m searching for Super Mario Brothers'); const m2 = await client.sendMessage(remoteId, 'This also contains Mario'); const m3 = await client.sendMessage(remoteId, 'Nothing of interest here, just Luigi'); @@ -581,4 +608,4 @@ END:VCARD`; }); }); }); -}); \ No newline at end of file +}); diff --git a/tests/helper.js b/tests/helper.js index febda54465f..bcd22a35d81 100644 --- a/tests/helper.js +++ b/tests/helper.js @@ -1,13 +1,25 @@ const path = require('path'); +const crypto = require('crypto'); const Client = require('../src/Client'); -const Util = require('../src/util/Util'); require('dotenv').config(); const remoteId = process.env.WWEBJS_TEST_REMOTE_ID; if(!remoteId) throw new Error('The WWEBJS_TEST_REMOTE_ID environment variable has not been set.'); +function isUsingDeprecatedSession() { + return Boolean(process.env.WWEBJS_TEST_SESSION || process.env.WWEBJS_TEST_SESSION_PATH); +} + +function isMD() { + return Boolean(process.env.WWEBJS_TEST_MD); +} + +if(isUsingDeprecatedSession() && isMD()) throw 'Cannot use deprecated sessions with WWEBJS_TEST_MD=true'; + function getSessionFromEnv() { + if (!isUsingDeprecatedSession()) return null; + const envSession = process.env.WWEBJS_TEST_SESSION; if(envSession) return JSON.parse(envSession); @@ -16,17 +28,27 @@ function getSessionFromEnv() { const absPath = path.resolve(process.cwd(), envSessionPath); return require(absPath); } - - throw new Error('No session found in environment.'); } -function createClient({withSession, options: additionalOpts}={}) { +function createClient({authenticated, options: additionalOpts}={}) { const options = {}; - if(withSession) { - options.session = getSessionFromEnv(); + + if(authenticated) { + const deprecatedSession = getSessionFromEnv(); + if(deprecatedSession) { + options.session = deprecatedSession; + options.useDeprecatedSessionAuth = true; + } else { + const clientId = process.env.WWEBJS_TEST_CLIENT_ID; + if(!clientId) throw new Error('No session found in environment.'); + options.clientId = clientId; + } + } else { + options.clientId = crypto.randomBytes(5).toString('hex'); } - return new Client(Util.mergeDefault(options, additionalOpts || {})); + const allOpts = {...options, ...(additionalOpts || {})}; + return new Client(allOpts); } function sleep(ms) { @@ -36,5 +58,7 @@ function sleep(ms) { module.exports = { sleep, createClient, - remoteId + isUsingDeprecatedSession, + isMD, + remoteId, }; \ No newline at end of file diff --git a/tests/structures/chat.js b/tests/structures/chat.js index 144aa5d4bf9..6148485a02d 100644 --- a/tests/structures/chat.js +++ b/tests/structures/chat.js @@ -13,7 +13,7 @@ describe('Chat', function () { before(async function() { this.timeout(35000); - client = helper.createClient({ withSession: true }); + client = helper.createClient({ authenticated: true }); await client.initialize(); chat = await client.getChatById(remoteId); }); @@ -32,9 +32,9 @@ describe('Chat', function () { }); it('can fetch messages sent in a chat', async function () { - this.timeout(5000); await helper.sleep(1000); const msg = await chat.sendMessage('another message'); + await helper.sleep(500); const messages = await chat.fetchMessages(); expect(messages.length).to.be.greaterThanOrEqual(2); @@ -49,6 +49,7 @@ describe('Chat', function () { it('can use a limit when fetching messages sent in a chat', async function () { await helper.sleep(1000); const msg = await chat.sendMessage('yet another message'); + await helper.sleep(500); const messages = await chat.fetchMessages({limit: 1}); expect(messages).to.have.lengthOf(1); @@ -80,6 +81,8 @@ describe('Chat', function () { const res = await chat.sendSeen(); expect(res).to.equal(true); + await helper.sleep(1000); + // refresh chat chat = await client.getChatById(remoteId); expect(chat.unreadCount).to.equal(0); @@ -137,6 +140,8 @@ describe('Chat', function () { it('can mute a chat forever', async function() { await chat.mute(); + await helper.sleep(1000); + // refresh chat chat = await client.getChatById(remoteId); expect(chat.isMuted).to.equal(true); @@ -147,6 +152,8 @@ describe('Chat', function () { const unmuteDate = new Date(new Date().getTime() + (1000*60*60)); await chat.mute(unmuteDate); + await helper.sleep(1000); + // refresh chat chat = await client.getChatById(remoteId); expect(chat.isMuted).to.equal(true); @@ -168,9 +175,7 @@ describe('Chat', function () { // eslint-disable-next-line mocha/no-skipped-tests describe.skip('Destructive operations', function () { - it('can clear all messages from chat', async function () { - this.timeout(5000); - + it('can clear all messages from chat', async function () { const res = await chat.clearMessages(); expect(res).to.equal(true); diff --git a/tests/structures/group.js b/tests/structures/group.js new file mode 100644 index 00000000000..6c47dd57e1f --- /dev/null +++ b/tests/structures/group.js @@ -0,0 +1,227 @@ +const { expect } = require('chai'); +const helper = require('../helper'); + +const remoteId = helper.remoteId; + +describe('Group', function() { + let client; + let group; + + before(async function() { + this.timeout(35000); + client = helper.createClient({ + authenticated: true, + }); + await client.initialize(); + + const createRes = await client.createGroup('My Awesome Group', [remoteId]); + expect(createRes.gid).to.exist; + await helper.sleep(500); + group = await client.getChatById(createRes.gid._serialized); + expect(group).to.exist; + }); + + beforeEach(async function () { + await helper.sleep(500); + }); + + describe('Settings', function () { + it('can change the group subject', async function () { + expect(group.name).to.equal('My Awesome Group'); + const res = await group.setSubject('My Amazing Group'); + expect(res).to.equal(true); + + await helper.sleep(1000); + + // reload + group = await client.getChatById(group.id._serialized); + expect(group.name).to.equal('My Amazing Group'); + }); + + it('can change the group description', async function () { + expect(group.description).to.equal(undefined); + const res = await group.setDescription('some description'); + expect(res).to.equal(true); + expect(group.description).to.equal('some description'); + + await helper.sleep(1000); + + // reload + group = await client.getChatById(group.id._serialized); + expect(group.description).to.equal('some description'); + }); + + it('can set only admins able to send messages', async function () { + expect(group.groupMetadata.announce).to.equal(false); + const res = await group.setMessagesAdminsOnly(); + expect(res).to.equal(true); + expect(group.groupMetadata.announce).to.equal(true); + + await helper.sleep(1000); + + // reload + group = await client.getChatById(group.id._serialized); + expect(group.groupMetadata.announce).to.equal(true); + }); + + it('can set all participants able to send messages', async function () { + expect(group.groupMetadata.announce).to.equal(true); + const res = await group.setMessagesAdminsOnly(false); + expect(res).to.equal(true); + expect(group.groupMetadata.announce).to.equal(false); + + await helper.sleep(1000); + + // reload + group = await client.getChatById(group.id._serialized); + expect(group.groupMetadata.announce).to.equal(false); + }); + + it('can set only admins able to set group info', async function () { + expect(group.groupMetadata.restrict).to.equal(false); + const res = await group.setInfoAdminsOnly(); + expect(res).to.equal(true); + expect(group.groupMetadata.restrict).to.equal(true); + + await helper.sleep(1000); + + // reload + group = await client.getChatById(group.id._serialized); + expect(group.groupMetadata.restrict).to.equal(true); + }); + + it('can set all participants able to set group info', async function () { + expect(group.groupMetadata.restrict).to.equal(true); + const res = await group.setInfoAdminsOnly(false); + expect(res).to.equal(true); + expect(group.groupMetadata.restrict).to.equal(false); + + await helper.sleep(1000); + + // reload + group = await client.getChatById(group.id._serialized); + expect(group.groupMetadata.restrict).to.equal(false); + }); + }); + + describe('Invites', function () { + it('can get the invite code', async function () { + const code = await group.getInviteCode(); + expect(typeof code).to.equal('string'); + }); + + it('can get invite info', async function () { + const code = await group.getInviteCode(); + const info = await client.getInviteInfo(code); + expect(info.id._serialized).to.equal(group.id._serialized); + expect(info.participants.length).to.equal(2); + }); + + it('can revoke the invite code', async function () { + const code = await group.getInviteCode(); + const newCode = await group.revokeInvite(); + expect(typeof newCode).to.equal('string'); + expect(newCode).to.not.equal(code); + }); + }); + + describe('Participants', function () { + it('can promote a user to admin', async function () { + let participant = group.participants.find(p => p.id._serialized === remoteId); + expect(participant).to.exist; + expect(participant.isAdmin).to.equal(false); + + const res = await group.promoteParticipants([remoteId]); + expect(res.status).to.be.greaterThanOrEqual(200); + + await helper.sleep(1000); + + // reload and check + group = await client.getChatById(group.id._serialized); + participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.exist; + expect(participant.isAdmin).to.equal(true); + }); + + it('can demote a user', async function () { + let participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.exist; + expect(participant.isAdmin).to.equal(true); + + const res = await group.demoteParticipants([remoteId]); + expect(res.status).to.be.greaterThanOrEqual(200); + + await helper.sleep(1000); + + // reload and check + group = await client.getChatById(group.id._serialized); + participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.exist; + expect(participant.isAdmin).to.equal(false); + }); + + it('can remove a user from the group', async function () { + let participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.exist; + + const res = await group.removeParticipants([remoteId]); + expect(res.status).to.be.greaterThanOrEqual(200); + + await helper.sleep(1000); + + // reload and check + group = await client.getChatById(group.id._serialized); + participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.not.exist; + }); + + it('can add back a user to the group', async function () { + let participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.not.exist; + + const res = await group.addParticipants([remoteId]); + expect(res.status).to.be.greaterThanOrEqual(200); + + await helper.sleep(1000); + + // reload and check + group = await client.getChatById(group.id._serialized); + participant = group.participants.find(p => p.id._serialized=== remoteId); + expect(participant).to.exist; + }); + }); + + describe('Leave / re-join', function () { + let code; + before(async function () { + code = await group.getInviteCode(); + }); + + it('can leave the group', async function () { + expect(group.isReadOnly).to.equal(false); + await group.leave(); + + await helper.sleep(1000); + + // reload and check + group = await client.getChatById(group.id._serialized); + expect(group.isReadOnly).to.equal(true); + }); + + it('can join a group via invite code', async function () { + const chatId = await client.acceptInvite(code); + expect(chatId).to.equal(group.id._serialized); + + await helper.sleep(1000); + + // reload and check + group = await client.getChatById(group.id._serialized); + expect(group.isReadOnly).to.equal(false); + }); + }); + + after(async function () { + await client.destroy(); + }); + +}); diff --git a/tests/structures/message.js b/tests/structures/message.js new file mode 100644 index 00000000000..7a9749d358f --- /dev/null +++ b/tests/structures/message.js @@ -0,0 +1,112 @@ +const { expect } = require('chai'); +const sinon = require('sinon'); + +const helper = require('../helper'); +const { Contact, Chat } = require('../../src/structures'); + +const remoteId = helper.remoteId; + +describe('Message', function () { + let client; + let chat; + let message; + + before(async function() { + this.timeout(35000); + client = helper.createClient({ authenticated: true }); + await client.initialize(); + + chat = await client.getChatById(remoteId); + message = await chat.sendMessage('this is only a test'); + + // wait for message to be sent + await helper.sleep(1000); + }); + + after(async function () { + await client.destroy(); + }); + + it('can get the related chat', async function () { + const chat = await message.getChat(); + expect(chat).to.be.instanceOf(Chat); + expect(chat.id._serialized).to.equal(remoteId); + }); + + it('can get the related contact', async function () { + const contact = await message.getContact(); + expect(contact).to.be.instanceOf(Contact); + expect(contact.id._serialized).to.equal(client.info.wid._serialized); + }); + + it('can get message info', async function () { + const info = await message.getInfo(); + expect(typeof info).to.equal('object'); + expect(Array.isArray(info.played)).to.equal(true); + expect(Array.isArray(info.read)).to.equal(true); + expect(Array.isArray(info.delivery)).to.equal(true); + }); + + describe('Replies', function () { + let replyMsg; + + it('can reply to a message', async function () { + replyMsg = await message.reply('this is my reply'); + expect(replyMsg.hasQuotedMsg).to.equal(true); + }); + + it('can get the quoted message', async function () { + const quotedMsg = await replyMsg.getQuotedMessage(); + expect(quotedMsg.id._serialized).to.equal(message.id._serialized); + }); + }); + + describe('Star', function () { + it('can star a message', async function () { + expect(message.isStarred).to.equal(false); + await message.star(); + + // reload and check + await message.reload(); + expect(message.isStarred).to.equal(true); + }); + + it('can un-star a message', async function () { + expect(message.isStarred).to.equal(true); + await message.unstar(); + + // reload and check + await message.reload(); + expect(message.isStarred).to.equal(false); + }); + }); + + describe('Delete', function () { + it('can delete a message for me', async function () { + await message.delete(); + + await helper.sleep(1000); + expect(await message.reload()).to.equal(null); + }); + + it('can delete a message for everyone', async function () { + message = await chat.sendMessage('sneaky message'); + await helper.sleep(1000); + + const callback = sinon.spy(); + client.once('message_revoke_everyone', callback); + + await message.delete(true); + await helper.sleep(1000); + + expect(await message.reload()).to.equal(null); + expect(callback.called).to.equal(true); + const [ revokeMsg, originalMsg ] = callback.args[0]; + expect(revokeMsg.id._serialized).to.equal(originalMsg.id._serialized); + expect(originalMsg.body).to.equal('sneaky message'); + expect(originalMsg.type).to.equal('chat'); + expect(revokeMsg.body).to.equal(''); + expect(revokeMsg.type).to.equal('revoked'); + }); + }); +}); \ No newline at end of file From f6de161c7d6a8870c3bcf75683df94e1c574c363 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 27 Feb 2022 22:02:49 -0400 Subject: [PATCH 002/430] Auth Strategies (#1257) * auth strategies * default to no auth * rename base auth strategy * rename base strategy cont. * refactor auth strategy methods and LocalAuth * activate old session options even if is falsy value * move restartOnAuthFail to LegacyAuthStrategy option * add link to guide item * update example/shell * types --- .gitignore | 5 +- .npmignore | 2 + example.js | 13 +-- index.d.ts | 78 +++++++++++------ index.js | 6 ++ shell.js | 6 +- src/Client.js | 108 ++++++++---------------- src/authStrategies/BaseAuthStrategy.js | 24 ++++++ src/authStrategies/LegacySessionAuth.js | 72 ++++++++++++++++ src/authStrategies/LocalAuth.js | 54 ++++++++++++ src/authStrategies/NoAuth.js | 12 +++ src/util/Constants.js | 2 - 12 files changed, 266 insertions(+), 116 deletions(-) create mode 100644 src/authStrategies/BaseAuthStrategy.js create mode 100644 src/authStrategies/LegacySessionAuth.js create mode 100644 src/authStrategies/LocalAuth.js create mode 100644 src/authStrategies/NoAuth.js diff --git a/.gitignore b/.gitignore index 73c67dca66b..79f64679f2d 100644 --- a/.gitignore +++ b/.gitignore @@ -70,7 +70,4 @@ typings/ # Test sessions *session.json - -# user data -WWebJS/ -userDataDir/ \ No newline at end of file +.wwebjs_auth/ \ No newline at end of file diff --git a/.npmignore b/.npmignore index c68d77aaf29..a5131c9d9ba 100644 --- a/.npmignore +++ b/.npmignore @@ -12,6 +12,8 @@ yarn-debug.log* yarn-error.log* *session.json +.wwebjs_auth/ + .env tools/ tests/ diff --git a/example.js b/example.js index bc3388e079d..021efb3b48f 100644 --- a/example.js +++ b/example.js @@ -1,17 +1,10 @@ -const { Client, Location, List, Buttons } = require('./index'); +const { Client, Location, List, Buttons, LocalAuth } = require('./index'); -const client = new Client({ - clientId: 'example', +const client = new Client({ + authStrategy: new LocalAuth(), puppeteer: { headless: false } }); -// You also could connect to an existing instance of a browser -// { -// puppeteer: { -// browserWSEndpoint: `ws://localhost:3000` -// } -// } - client.initialize(); client.on('qr', (qr) => { diff --git a/index.d.ts b/index.d.ts index c3d1ab14fad..bdd7f5407c7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -157,8 +157,7 @@ declare namespace WAWebJS { /** Emitted when authentication is successful */ on(event: 'authenticated', listener: ( /** - * Object containing session information. Can be used to restore the session - * @deprecated + * Object containing session information, when using LegacySessionAuth. Can be used to restore the session */ session?: ClientSession ) => void): this @@ -297,35 +296,23 @@ declare namespace WAWebJS { /** Options for initializing the whatsapp client */ export interface ClientOptions { /** Timeout for authentication selector in puppeteer - * @default 45000 */ + * @default 0 */ authTimeoutMs?: number, /** Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ */ puppeteer?: puppeteer.LaunchOptions & puppeteer.BrowserLaunchArgumentOptions & puppeteer.BrowserConnectOptions - /** Refresh interval for qr code (how much time to wait before checking if the qr code has changed) - * @default 20000 */ - qrRefreshIntervalMs?: number - /** Timeout for qr code selector in puppeteer - * @default 45000 */ - qrTimeoutMs?: number, - /** How many times should the qrcode be refreshed before giving up + /** Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. */ + authStrategy?: AuthStrategy, + /** How many times should the qrcode be refreshed before giving up * @default 0 (disabled) */ qrMaxRetries?: number, - /** Restart client with a new session (i.e. use null 'session' var) if authentication fails - * @default false */ - restartOnAuthFail?: boolean - /** - * Enable authentication via a `session` option. - * @deprecated Will be removed in a future release + /** + * @deprecated This option should be set directly on the LegacySessionAuth */ - useDeprecatedSessionAuth?: boolean + restartOnAuthFail?: boolean /** - * WhatsApp session to restore. If not set, will start a new session - * @deprecated Set `useDeprecatedSessionAuth: true` to enable. This auth method is not supported by MultiDevice and will be removed in a future release. + * @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly. */ session?: ClientSession - /** Client id to distinguish instances if you are using multiple, otherwise keep empty if you are using only one instance - * @default '' */ - clientId: string /** If another whatsapp web session is detected (another browser), take over the session in the current browser * @default false */ takeoverOnConflict?: boolean, @@ -338,14 +325,53 @@ declare namespace WAWebJS { /** Ffmpeg path to use when formating videos to webp while sending stickers * @default 'ffmpeg' */ ffmpegPath?: string - /** Path to place session objects in - @default './WWebJS' */ - dataPath?: string + } + + /** + * Base class which all authentication strategies extend + */ + export abstract class AuthStrategy { + setup: (client: Client) => void; + beforeBrowserInitialized: () => Promise; + afterBrowserInitialized: () => Promise; + onAuthenticationNeeded: () => Promise<{ + failed?: boolean; + restart?: boolean; + failureEventPayload?: any + }>; + getAuthEventPayload: () => Promise; + logout: () => Promise; + } + + /** + * No session restoring functionality + * Will need to authenticate via QR code every time + */ + export class NoAuth extends AuthStrategy {} + + /** + * Local directory-based authentication + */ + export class LocalAuth extends AuthStrategy { + constructor(options?: { + clientId?: string, + dataPath?: string + }) + } + + /** + * Legacy session auth strategy + * Not compatible with multi-device accounts. + */ + export class LegacySessionAuth extends AuthStrategy { + constructor(options?: { + session?: ClientSession, + restartOnAuth?: boolean, + }) } /** * Represents a WhatsApp client session - * @deprecated */ export interface ClientSession { WABrowserId: string, diff --git a/index.js b/index.js index 3d2b64f8bd9..5a149e4588f 100644 --- a/index.js +++ b/index.js @@ -21,5 +21,11 @@ module.exports = { ProductMetadata: require('./src/structures/ProductMetadata'), List: require('./src/structures/List'), Buttons: require('./src/structures/Buttons'), + + // Auth Strategies + NoAuth: require('./src/authStrategies/NoAuth'), + LocalAuth: require('./src/authStrategies/LocalAuth'), + LegacySessionAuth: require('./src/authStrategies/LegacySessionAuth'), + ...Constants }; diff --git a/shell.js b/shell.js index 4f94c35f36a..fd593a1d6ad 100644 --- a/shell.js +++ b/shell.js @@ -2,17 +2,17 @@ * ==== wwebjs-shell ==== * Used for quickly testing library features * - * Running `npm run shell` will start WhatsApp Web in headless mode + * Running `npm run shell` will start WhatsApp Web with headless=false * and then drop you into Node REPL with `client` in its context. */ const repl = require('repl'); -const { Client } = require('./index'); +const { Client, LocalAuth } = require('./index'); const client = new Client({ puppeteer: { headless: false }, - clientId: 'shell' + authStrategy: new LocalAuth() }); console.log('Initializing...'); diff --git a/src/Client.js b/src/Client.js index 5f908e04325..30d9ea38ee1 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1,7 +1,5 @@ 'use strict'; -const path = require('path'); -const fs = require('fs'); const EventEmitter = require('events'); const puppeteer = require('puppeteer'); const moduleRaid = require('@pedroslopez/moduleraid/moduleraid'); @@ -13,23 +11,24 @@ const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List } = require('./structures'); +const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); +const NoAuth = require('./authStrategies/NoAuth'); + /** * Starting point for interacting with the WhatsApp Web API * @extends {EventEmitter} * @param {object} options - Client options + * @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. * @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer * @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ * @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up - * @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails - * @param {boolean} options.useDeprecatedSessionAuth - Enable JSON-based authentication. This is deprecated due to not being supported by MultiDevice, and will be removed in a future version. - * @param {object} options.session - This is deprecated due to not being supported by MultiDevice, and will be removed in a future version. + * @param {string} options.restartOnAuthFail - @deprecated This option should be set directly on the LegacySessionAuth. + * @param {object} options.session - @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly. * @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser * @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session - * @param {string} options.dataPath - Change the default path for saving session files, default is: "./WWebJS/" * @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers * @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy. - * @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance * * @fires Client#qr * @fires Client#authenticated @@ -52,20 +51,28 @@ class Client extends EventEmitter { super(); this.options = Util.mergeDefault(DefaultOptions, options); - - this.id = this.options.clientId; - - // eslint-disable-next-line no-useless-escape - const foldernameRegex = /^(?!.{256,})(?!(aux|clock\$|con|nul|prn|com[1-9]|lpt[1-9])(?:$|\.))[^ ][ \.\w-$()+=[\];#@~,&']+[^\. ]$/i; - if (this.id && !foldernameRegex.test(this.id)) throw Error('Invalid client ID. Make sure you abide by the folder naming rules of your operating system.'); - - if (!this.options.useDeprecatedSessionAuth) { - this.dataDir = this.options.puppeteer.userDataDir; - const dirPath = path.join(process.cwd(), this.options.dataPath, this.id ? 'session-' + this.id : 'session'); - if (!this.dataDir) this.dataDir = dirPath; - fs.mkdirSync(this.dataDir, { recursive: true }); + + if(!this.options.authStrategy) { + if(Object.prototype.hasOwnProperty.call(this.options, 'session')) { + process.emitWarning( + 'options.session is deprecated and will be removed in a future release due to incompatibility with multi-device. ' + + 'Use the LocalAuth authStrategy, don\'t pass in a session as an option, or suppress this warning by using the LegacySessionAuth strategy explicitly (see https://wwebjs.dev/guide/authentication.html#legacysessionauth-strategy).', + 'DeprecationWarning' + ); + + this.authStrategy = new LegacySessionAuth({ + session: this.options.session, + restartOnAuthFail: this.options.restartOnAuthFail + }); + } else { + this.authStrategy = new NoAuth(); + } + } else { + this.authStrategy = this.options.authStrategy; } + this.authStrategy.setup(this); + this.pupBrowser = null; this.pupPage = null; @@ -78,10 +85,9 @@ class Client extends EventEmitter { async initialize() { let [browser, page] = [null, null]; - const puppeteerOpts = { - ...this.options.puppeteer, - userDataDir: this.options.useDeprecatedSessionAuth ? undefined : this.dataDir - }; + await this.authStrategy.beforeBrowserInitialized(); + + const puppeteerOpts = this.options.puppeteer; if (puppeteerOpts && puppeteerOpts.browserWSEndpoint) { browser = await puppeteer.connect(puppeteerOpts); page = await browser.newPage(); @@ -91,27 +97,12 @@ class Client extends EventEmitter { } await page.setUserAgent(this.options.userAgent); + if (this.options.bypassCSP) await page.setBypassCSP(true); this.pupBrowser = browser; this.pupPage = page; - if (this.options.useDeprecatedSessionAuth && this.options.session) { - await page.evaluateOnNewDocument(session => { - if (document.referrer === 'https://whatsapp.com/') { - localStorage.clear(); - localStorage.setItem('WABrowserId', session.WABrowserId); - localStorage.setItem('WASecretBundle', session.WASecretBundle); - localStorage.setItem('WAToken1', session.WAToken1); - localStorage.setItem('WAToken2', session.WAToken2); - } - - localStorage.setItem('remember-me', 'true'); - }, this.options.session); - } - - if (this.options.bypassCSP) { - await page.setBypassCSP(true); - } + await this.authStrategy.afterBrowserInitialized(); await page.goto(WhatsWebURL, { waitUntil: 'load', @@ -141,18 +132,17 @@ class Client extends EventEmitter { // Scan-qrcode selector was found. Needs authentication if (needAuthentication) { - if(this.options.session) { + const { failed, failureEventPayload, restart } = await this.authStrategy.onAuthenticationNeeded(); + if(failed) { /** * Emitted when there has been an error while trying to restore an existing session * @event Client#auth_failure * @param {string} message - * @deprecated */ - this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?'); + this.emit(Events.AUTHENTICATION_FAILURE, failureEventPayload); await this.destroy(); - if (this.options.restartOnAuthFail) { + if (restart) { // session restore failed so try again but without session to force new authentication - this.options.session = null; return this.initialize(); } return; @@ -224,20 +214,7 @@ class Client extends EventEmitter { } await page.evaluate(ExposeStore, moduleRaid.toString()); - let authEventPayload = undefined; - if (this.options.useDeprecatedSessionAuth) { - // Get session tokens - const localStorage = JSON.parse(await page.evaluate(() => { - return JSON.stringify(window.localStorage); - })); - - authEventPayload = { - WABrowserId: localStorage.WABrowserId, - WASecretBundle: localStorage.WASecretBundle, - WAToken1: localStorage.WAToken1, - WAToken2: localStorage.WAToken2 - }; - } + const authEventPayload = await this.authStrategy.getAuthEventPayload(); /** * Emitted when authentication is successful @@ -248,23 +225,14 @@ class Client extends EventEmitter { // Check window.Store Injection await page.waitForFunction('window.Store != undefined'); - const isMD = await page.evaluate(() => { - return window.Store.Features.features.MD_BACKEND; - }); - await page.evaluate(async () => { // safely unregister service workers const registrations = await navigator.serviceWorker.getRegistrations(); for (let registration of registrations) { registration.unregister(); } - }); - if (this.options.useDeprecatedSessionAuth && isMD) { - throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.'); - } - //Load util functions (serializers, helper functions) await page.evaluate(LoadUtils); @@ -518,9 +486,7 @@ class Client extends EventEmitter { return window.Store.AppState.logout(); }); - if (this.dataDir) { - return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this.dataDir, { recursive: true }); - } + await this.authStrategy.logout(); } /** diff --git a/src/authStrategies/BaseAuthStrategy.js b/src/authStrategies/BaseAuthStrategy.js new file mode 100644 index 00000000000..0c7a7c9d0b0 --- /dev/null +++ b/src/authStrategies/BaseAuthStrategy.js @@ -0,0 +1,24 @@ +'use strict'; + +/** + * Base class which all authentication strategies extend + */ +class BaseAuthStrategy { + constructor() {} + setup(client) { + this.client = client; + } + async beforeBrowserInitialized() {} + async afterBrowserInitialized() {} + async onAuthenticationNeeded() { + return { + failed: false, + restart: false, + failureEventPayload: undefined + }; + } + async getAuthEventPayload() {} + async logout() {} +} + +module.exports = BaseAuthStrategy; \ No newline at end of file diff --git a/src/authStrategies/LegacySessionAuth.js b/src/authStrategies/LegacySessionAuth.js new file mode 100644 index 00000000000..58332ac97a5 --- /dev/null +++ b/src/authStrategies/LegacySessionAuth.js @@ -0,0 +1,72 @@ +'use strict'; + +const BaseAuthStrategy = require('./BaseAuthStrategy'); + +/** + * Legacy session auth strategy + * Not compatible with multi-device accounts. + * @param {object} options - options + * @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails + * @param {object} options.session - Whatsapp session to restore. If not set, will start a new session + * @param {string} options.session.WABrowserId + * @param {string} options.session.WASecretBundle + * @param {string} options.session.WAToken1 + * @param {string} options.session.WAToken2 + */ +class LegacySessionAuth extends BaseAuthStrategy { + constructor({ session, restartOnAuthFail }) { + super(); + this.session = session; + this.restartOnAuthFail = restartOnAuthFail; + } + + async afterBrowserInitialized() { + if(this.session) { + await this.client.pupPage.evaluateOnNewDocument(session => { + if (document.referrer === 'https://whatsapp.com/') { + localStorage.clear(); + localStorage.setItem('WABrowserId', session.WABrowserId); + localStorage.setItem('WASecretBundle', session.WASecretBundle); + localStorage.setItem('WAToken1', session.WAToken1); + localStorage.setItem('WAToken2', session.WAToken2); + } + + localStorage.setItem('remember-me', 'true'); + }, this.session); + } + } + + async onAuthenticationNeeded() { + if(this.session) { + this.session = null; + return { + failed: true, + restart: this.restartOnAuthFail, + failureEventPayload: 'Unable to log in. Are the session details valid?' + }; + } + + return { failed: false }; + } + + async getAuthEventPayload() { + const isMD = await this.client.pupPage.evaluate(() => { + return window.Store.Features.features.MD_BACKEND; + }); + + if(isMD) throw new Error('Authenticating via JSON session is not supported for MultiDevice-enabled WhatsApp accounts.'); + + const localStorage = JSON.parse(await this.client.pupPage.evaluate(() => { + return JSON.stringify(window.localStorage); + })); + + return { + WABrowserId: localStorage.WABrowserId, + WASecretBundle: localStorage.WASecretBundle, + WAToken1: localStorage.WAToken1, + WAToken2: localStorage.WAToken2 + }; + } +} + +module.exports = LegacySessionAuth; \ No newline at end of file diff --git a/src/authStrategies/LocalAuth.js b/src/authStrategies/LocalAuth.js new file mode 100644 index 00000000000..1f9770d64ba --- /dev/null +++ b/src/authStrategies/LocalAuth.js @@ -0,0 +1,54 @@ +'use strict'; + +const path = require('path'); +const fs = require('fs'); +const BaseAuthStrategy = require('./BaseAuthStrategy'); + +/** + * Local directory-based authentication + * @param {object} options - options + * @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance + * @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/" +*/ +class LocalAuth extends BaseAuthStrategy { + constructor({ clientId, dataPath }={}) { + super(); + + const idRegex = /^[-_\w]+$/i; + if(clientId && !idRegex.test(clientId)) { + throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.'); + } + + this.dataPath = path.resolve(dataPath || './.wwebjs_auth/'); + this.clientId = clientId; + } + + async beforeBrowserInitialized() { + const puppeteerOpts = this.client.options.puppeteer; + + if(puppeteerOpts.userDataDir) { + throw new Error('LocalAuth is not compatible with a user-supplied userDataDir.'); + } + + const sessionDirName = this.clientId ? `session-${this.clientId}` : 'session'; + const dirPath = path.join(this.dataPath, sessionDirName); + + fs.mkdirSync(dirPath, { recursive: true }); + + this.client.options.puppeteer = { + ...puppeteerOpts, + userDataDir: dirPath + }; + + this.userDataDir = dirPath; + } + + async logout() { + if (this.userDataDir) { + return (fs.rmSync ? fs.rmSync : fs.rmdirSync).call(this.userDataDir, { recursive: true }); + } + } + +} + +module.exports = LocalAuth; \ No newline at end of file diff --git a/src/authStrategies/NoAuth.js b/src/authStrategies/NoAuth.js new file mode 100644 index 00000000000..1e11a2cf30a --- /dev/null +++ b/src/authStrategies/NoAuth.js @@ -0,0 +1,12 @@ +'use strict'; + +const BaseAuthStrategy = require('./BaseAuthStrategy'); + +/** + * No session restoring functionality + * Will need to authenticate via QR code every time +*/ +class NoAuth extends BaseAuthStrategy { } + + +module.exports = NoAuth; \ No newline at end of file diff --git a/src/util/Constants.js b/src/util/Constants.js index 1b27ca5d0b0..83a030fd887 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -7,8 +7,6 @@ exports.DefaultOptions = { headless: true, defaultViewport: null }, - dataPath: './WWebJS/', - useDeprecatedSessionAuth: false, authTimeoutMs: 0, qrMaxRetries: 0, takeoverOnConflict: false, From 9fe91692cf409cf8ac8e2393f09b6d3cb6570830 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 27 Feb 2022 22:18:54 -0400 Subject: [PATCH 003/430] update tests to work with authStrategies --- tests/client.js | 149 ++++++++++++++++++++++++------------------------ tests/helper.js | 26 ++++----- 2 files changed, 89 insertions(+), 86 deletions(-) diff --git a/tests/client.js b/tests/client.js index c99d6729222..7bfcc1b159b 100644 --- a/tests/client.js +++ b/tests/client.js @@ -9,6 +9,7 @@ const Message = require('../src/structures/Message'); const MessageMedia = require('../src/structures/MessageMedia'); const Location = require('../src/structures/Location'); const { MessageTypes, WAState } = require('../src/util/Constants'); +const { LegacySessionAuth } = require('../src/authStrategies/LegacySessionAuth'); const expect = chai.expect; chai.use(chaiAsPromised); @@ -71,7 +72,7 @@ describe('Client', function() { expect(authenticatedCallback.called).to.equal(true); - if(helper.isUsingDeprecatedSession()) { + if(helper.isUsingLegacySession()) { const newSession = authenticatedCallback.args[0][0]; expect(newSession).to.have.key([ 'WABrowserId', @@ -87,6 +88,80 @@ describe('Client', function() { await client.destroy(); }); + describe('LegacySessionAuth', function () { + it('should fail auth if session is invalid', async function() { + this.timeout(40000); + + const authFailCallback = sinon.spy(); + const qrCallback = sinon.spy(); + const readyCallback = sinon.spy(); + + const client = helper.createClient({ + options: { + authStrategy: new LegacySessionAuth({ + session: { + WABrowserId: 'invalid', + WASecretBundle: 'invalid', + WAToken1: 'invalid', + WAToken2: 'invalid' + }, + restartOnAuthFail: false, + }), + } + }); + + client.on('qr', qrCallback); + client.on('auth_failure', authFailCallback); + client.on('ready', readyCallback); + + client.initialize(); + + await helper.sleep(25000); + + expect(authFailCallback.called).to.equal(true); + expect(authFailCallback.args[0][0]).to.equal('Unable to log in. Are the session details valid?'); + + expect(readyCallback.called).to.equal(false); + expect(qrCallback.called).to.equal(false); + + await client.destroy(); + }); + + it('can restart without a session if session was invalid and restartOnAuthFail=true', async function() { + this.timeout(40000); + + const authFailCallback = sinon.spy(); + const qrCallback = sinon.spy(); + + const client = helper.createClient({ + options: { + authStrategy: new LegacySessionAuth({ + session: { + WABrowserId: 'invalid', + WASecretBundle: 'invalid', + WAToken1: 'invalid', + WAToken2: 'invalid' + }, + restartOnAuthFail: true, + }), + } + }); + + client.on('auth_failure', authFailCallback); + client.on('qr', qrCallback); + + client.initialize(); + + await helper.sleep(35000); + + expect(authFailCallback.called).to.equal(true); + expect(qrCallback.called).to.equal(true); + expect(qrCallback.args[0][0]).to.have.lengthOf(152); + + await client.destroy(); + }); + }); + describe('Non-MD only', function () { if(!isMD) { it('can take over if client was logged in somewhere else with takeoverOnConflict=true', async function() { @@ -127,78 +202,6 @@ describe('Client', function() { await client1.destroy(); }); - - it('should fail auth if session is invalid', async function() { - this.timeout(40000); - - const authFailCallback = sinon.spy(); - const qrCallback = sinon.spy(); - const readyCallback = sinon.spy(); - - const client = helper.createClient({ - options: { - session: { - WABrowserId: 'invalid', - WASecretBundle: 'invalid', - WAToken1: 'invalid', - WAToken2: 'invalid' - }, - authTimeoutMs: 10000, - restartOnAuthFail: false, - useDeprecatedSessionAuth: true - } - }); - - client.on('qr', qrCallback); - client.on('auth_failure', authFailCallback); - client.on('ready', readyCallback); - - client.initialize(); - - await helper.sleep(25000); - - expect(authFailCallback.called).to.equal(true); - expect(authFailCallback.args[0][0]).to.equal('Unable to log in. Are the session details valid?'); - - expect(readyCallback.called).to.equal(false); - expect(qrCallback.called).to.equal(false); - - await client.destroy(); - }); - - it('can restart without a session if session was invalid and restartOnAuthFail=true', async function() { - this.timeout(40000); - - const authFailCallback = sinon.spy(); - const qrCallback = sinon.spy(); - - const client = helper.createClient({ - options:{ - session: { - WABrowserId: 'invalid', - WASecretBundle: 'invalid', - WAToken1: 'invalid', - WAToken2: 'invalid' - }, - authTimeoutMs: 10000, - restartOnAuthFail: true, - useDeprecatedSessionAuth: true - } - }); - - client.on('auth_failure', authFailCallback); - client.on('qr', qrCallback); - - client.initialize(); - - await helper.sleep(35000); - - expect(authFailCallback.called).to.equal(true); - expect(qrCallback.called).to.equal(true); - expect(qrCallback.args[0][0]).to.have.lengthOf(152); - - await client.destroy(); - }); } }); }); diff --git a/tests/helper.js b/tests/helper.js index bcd22a35d81..fc9ddae5568 100644 --- a/tests/helper.js +++ b/tests/helper.js @@ -1,13 +1,12 @@ const path = require('path'); -const crypto = require('crypto'); -const Client = require('../src/Client'); +const { Client, LegacySessionAuth, LocalAuth } = require('..'); require('dotenv').config(); const remoteId = process.env.WWEBJS_TEST_REMOTE_ID; if(!remoteId) throw new Error('The WWEBJS_TEST_REMOTE_ID environment variable has not been set.'); -function isUsingDeprecatedSession() { +function isUsingLegacySession() { return Boolean(process.env.WWEBJS_TEST_SESSION || process.env.WWEBJS_TEST_SESSION_PATH); } @@ -15,10 +14,10 @@ function isMD() { return Boolean(process.env.WWEBJS_TEST_MD); } -if(isUsingDeprecatedSession() && isMD()) throw 'Cannot use deprecated sessions with WWEBJS_TEST_MD=true'; +if(isUsingLegacySession() && isMD()) throw 'Cannot use legacy sessions with WWEBJS_TEST_MD=true'; function getSessionFromEnv() { - if (!isUsingDeprecatedSession()) return null; + if (!isUsingLegacySession()) return null; const envSession = process.env.WWEBJS_TEST_SESSION; if(envSession) return JSON.parse(envSession); @@ -34,17 +33,18 @@ function createClient({authenticated, options: additionalOpts}={}) { const options = {}; if(authenticated) { - const deprecatedSession = getSessionFromEnv(); - if(deprecatedSession) { - options.session = deprecatedSession; - options.useDeprecatedSessionAuth = true; + const legacySession = getSessionFromEnv(); + if(legacySession) { + options.authStrategy = new LegacySessionAuth({ + session: legacySession + }); } else { const clientId = process.env.WWEBJS_TEST_CLIENT_ID; if(!clientId) throw new Error('No session found in environment.'); - options.clientId = clientId; + options.authStrategy = new LocalAuth({ + clientId + }); } - } else { - options.clientId = crypto.randomBytes(5).toString('hex'); } const allOpts = {...options, ...(additionalOpts || {})}; @@ -58,7 +58,7 @@ function sleep(ms) { module.exports = { sleep, createClient, - isUsingDeprecatedSession, + isUsingLegacySession, isMD, remoteId, }; \ No newline at end of file From 52c8336236d7df476320f57532b4ba37803b4df7 Mon Sep 17 00:00:00 2001 From: YaronD <47784310+Yarondr@users.noreply.github.com> Date: Mon, 28 Feb 2022 04:30:47 +0200 Subject: [PATCH 004/430] Added message duration in seconds (#1230) Co-authored-by: Pedro S. Lopez --- index.d.ts | 2 ++ src/structures/Message.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/index.d.ts b/index.d.ts index bdd7f5407c7..70e7d992487 100644 --- a/index.d.ts +++ b/index.d.ts @@ -615,6 +615,8 @@ declare namespace WAWebJS { hasMedia: boolean, /** Indicates if the message was sent as a reply to another message */ hasQuotedMsg: boolean, + /** Indicates the duration of the message in seconds */ + duration: string, /** ID that represents the message */ id: MessageId, /** Indicates if the message was forwarded */ diff --git a/src/structures/Message.js b/src/structures/Message.js index 6a326b937b8..ea541fa072f 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -134,6 +134,12 @@ class Message extends Base { */ this.hasQuotedMsg = data.quotedMsg ? true : false; + /** + * Indicates the duration of the message in seconds + * @type {string} + */ + this.duration = data.duration ? data.duration : undefined; + /** * Location information contained in the message, if the message is type "location" * @type {Location} From ab5167c4ade7365a92292aac00f02e27e60fd97b Mon Sep 17 00:00:00 2001 From: SuperChang Date: Mon, 28 Feb 2022 10:34:12 +0800 Subject: [PATCH 005/430] fix: `ChangeParticipantsPermissions` typo in index.d.ts (#1206) Co-authored-by: Pedro S. Lopez --- index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 70e7d992487..b39151542cd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1048,7 +1048,7 @@ declare namespace WAWebJS { } /** Promotes or demotes participants by IDs to regular users or admins */ - export type ChangeParticipantsPermisions = + export type ChangeParticipantsPermissions = (participantIds: Array) => Promise<{ status: number }> /** Adds or removes a list of participants by ID to the group */ @@ -1078,9 +1078,9 @@ declare namespace WAWebJS { /** Removes a list of participants by ID to the group */ removeParticipants: ChangeGroupParticipants; /** Promotes participants by IDs to admins */ - promoteParticipants: ChangeParticipantsPermisions; + promoteParticipants: ChangeParticipantsPermissions; /** Demotes participants by IDs to regular users */ - demoteParticipants: ChangeParticipantsPermisions; + demoteParticipants: ChangeParticipantsPermissions; /** Updates the group subject */ setSubject: (subject: string) => Promise; /** Updates the group description */ From 12d9735b73a2f26bd69d3d0d81f2b944bb849711 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 27 Feb 2022 22:58:39 -0400 Subject: [PATCH 006/430] Update README.md --- README.md | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 30580482d3a..2beef9aa444 100644 --- a/README.md +++ b/README.md @@ -47,43 +47,14 @@ client.initialize(); Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/master/example.js) for another example with more use cases. -## Remote Access +For more information on saving and restoring sessions, check out the available [Authentication Strategies](https://wwebjs.dev/guide/authentication.html). -You could also connect to any previously existing browser instance: - -```js -const client = new Client({ - puppeteer: { - browserWSEndpoint: `ws://localhost:3000` - } -}); -``` - -### Docker - -1) Installing a browser using browserless: - -``` -docker run \ - --rm \ - -p 3000:3000 \ - -e "MAX_CONCURRENT_SESSIONS=1" \ - browserless/chrome:latest -``` - -Reference: https://docs.browserless.io/docs/docker-quickstart.html - -### Remote Debugging - -2) Running a browser with websocket remote debugging enabled: -> chrome.exe --remote-debugging-port=9222 - -After that check the following webpage and check http://127.0.0.1:9220/json and get the **webSocketDebuggerUrl** ## Supported features | Feature | Status | | ------------- | ------------- | +| Multi Device | ✅ | | Send messages | ✅ | | Receive messages | ✅ | | Send media (images/audio/documents) | ✅ | @@ -116,11 +87,13 @@ Something missing? Make an issue and let us know! Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first. -## Donating +## Supporting the project -You can support the maintainer of this project through the link below +You can support the maintainer of this project through the links below -[![Support via PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.me/psla/) +- [Support via GitHub Sponsors](https://github.com/sponsors/pedroslopez) +- [Support via PayPal](https://www.paypal.me/psla/) +- [Sign up for DigitalOcean](https://m.do.co/c/73f906a36ed4) and get $100 in credit when you sign up (Referral) ## Disclaimer From 6691d25282a94376da533e93f25b865a890c1716 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 27 Feb 2022 23:28:57 -0400 Subject: [PATCH 007/430] fix: message.getInfo() works for both MD and non-MD --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index ea541fa072f..d8ea5baf1aa 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -475,7 +475,7 @@ class Message extends Base { const msg = window.Store.Msg.get(msgId); if (!msg) return null; - return await window.Store.MessageInfo.sendQueryMsgInfo(msg.id); + return await window.Store.MessageInfo.sendQueryMsgInfo(msg); }, this.id._serialized); return info; From 1f4328c7a3751b69ed5894e14e78e6160390cc8f Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 27 Feb 2022 23:29:09 -0400 Subject: [PATCH 008/430] fix tests --- tests/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client.js b/tests/client.js index 7bfcc1b159b..f01412f090a 100644 --- a/tests/client.js +++ b/tests/client.js @@ -8,8 +8,8 @@ const Contact = require('../src/structures/Contact'); const Message = require('../src/structures/Message'); const MessageMedia = require('../src/structures/MessageMedia'); const Location = require('../src/structures/Location'); +const LegacySessionAuth = require('../src/authStrategies/LegacySessionAuth'); const { MessageTypes, WAState } = require('../src/util/Constants'); -const { LegacySessionAuth } = require('../src/authStrategies/LegacySessionAuth'); const expect = chai.expect; chai.use(chaiAsPromised); From 979e97ea425b87a8aea7269519f99b7126aac573 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 27 Feb 2022 23:30:03 -0400 Subject: [PATCH 009/430] chore: mark version v1.16.0 --- docs/Base.html | 6 +- docs/BaseAuthStrategy.html | 65 +++ docs/BusinessContact.html | 24 +- docs/Buttons.html | 6 +- docs/Call.html | 6 +- docs/Chat.html | 6 +- docs/Client.html | 264 ++++-------- docs/Client.js.html | 394 ++++++++++-------- docs/ClientInfo.html | 33 +- docs/Contact.html | 24 +- docs/GroupChat.html | 24 +- docs/GroupNotification.html | 6 +- docs/InterfaceController.html | 6 +- docs/Label.html | 6 +- docs/LegacySessionAuth.html | 188 +++++++++ docs/List.html | 6 +- docs/LocalAuth.html | 135 ++++++ docs/Location.html | 6 +- docs/Message.html | 41 +- docs/MessageMedia.html | 6 +- docs/NoAuth.html | 66 +++ docs/Order.html | 6 +- docs/PrivateChat.html | 6 +- docs/PrivateContact.html | 24 +- docs/Product.html | 6 +- docs/Util.html | 8 +- docs/authStrategies_BaseAuthStrategy.js.html | 77 ++++ docs/authStrategies_LegacySessionAuth.js.html | 125 ++++++ docs/authStrategies_LocalAuth.js.html | 107 +++++ docs/authStrategies_NoAuth.js.html | 65 +++ docs/global.html | 8 +- docs/index.html | 255 ++++++++---- docs/scripts/jsdoc-toc.js | 2 +- docs/structures_Base.js.html | 6 +- docs/structures_BusinessContact.js.html | 6 +- docs/structures_Buttons.js.html | 6 +- docs/structures_Call.js.html | 6 +- docs/structures_Chat.js.html | 6 +- docs/structures_ClientInfo.js.html | 19 +- docs/structures_Contact.js.html | 17 +- docs/structures_GroupChat.js.html | 111 +++-- 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 | 95 +++-- docs/structures_MessageMedia.js.html | 6 +- docs/structures_Order.js.html | 6 +- docs/structures_Payment.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/util_Constants.js.html | 11 +- docs/util_InterfaceController.js.html | 6 +- docs/util_Util.js.html | 60 +-- package.json | 2 +- 57 files changed, 1710 insertions(+), 714 deletions(-) create mode 100644 docs/BaseAuthStrategy.html create mode 100644 docs/LegacySessionAuth.html create mode 100644 docs/LocalAuth.html create mode 100644 docs/NoAuth.html create mode 100644 docs/authStrategies_BaseAuthStrategy.js.html create mode 100644 docs/authStrategies_LegacySessionAuth.js.html create mode 100644 docs/authStrategies_LocalAuth.js.html create mode 100644 docs/authStrategies_NoAuth.js.html diff --git a/docs/Base.html b/docs/Base.html index 9e3376a587a..8d543df1809 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Base + whatsapp-web.js 1.16.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html new file mode 100644 index 00000000000..44b1f1a40e1 --- /dev/null +++ b/docs/BaseAuthStrategy.html @@ -0,0 +1,65 @@ + + + + + + + whatsapp-web.js 1.16.0 » Class: BaseAuthStrategy + + + + + + + + +
+
+
+
+ +
+
+
+

new BaseAuthStrategy()

+
+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 2a3b10cd5de..81ec1f656ab 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: BusinessContact + whatsapp-web.js 1.16.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -111,19 +111,22 @@

Methods

+
getProfilePicUrl()
+
+
unblock()
@@ -269,6 +272,15 @@

getChat

async
+

getCommonGroups() → Promise containing Array of WAWebJS.ChatId

+

Gets the Contact's common groups with you. Returns empty array if you don't have any common group.

+
+
Inherited from
+
Contact#getCommonGroups
+
Returns
+
+
+
async

getCountryCode() → Promise containing string

Returns the contact's countrycode, (1541859685@c.us) => (1)

@@ -314,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index 642cdc37edb..f03eac7ca46 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Buttons + whatsapp-web.js 1.16.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index de50a16f245..432b0cd3098 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Call + whatsapp-web.js 1.16.0 » Class: Call @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index 1a9cd4b0e2d..c2afeea32ae 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Chat + whatsapp-web.js 1.16.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -483,7 +483,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 0d30a80732a..dac8f527884 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Client + whatsapp-web.js 1.16.0 » Class: Client @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@

async
+

getCommonGroups(contactId) → Promise containing Array of WAWebJS.ChatId

+

Gets the Contact's common groups with you. Returns empty array if you don't have any common group.

+
+

Parameter

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

contactId

+
+

string

+
+

 

+
+

the whatsapp user's ID (_serialized format)

+
+
+
+
Returns
+
+

Promise containing Array of WAWebJS.ChatId 

+
+
+
async

getContactById(contactId) → Promise containing Contact

Get contact instance by ID

@@ -1452,6 +1429,11 @@

sendPresenceAvailable
async
+

sendPresenceUnavailable()

+

Marks the client as unavailable

+
+
+
async

sendSeen(chatId) → Promise containing boolean

Mark as seen for the Chat

@@ -1491,7 +1473,7 @@

Parameter

async
-

setDisplayName(displayName)

+

setDisplayName(displayName) → Promise containing Boolean

Sets the current user's display name. This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile.

@@ -1524,6 +1506,10 @@

Parameter

+
Returns
+
+

Promise containing Boolean 

+
async

setStatus(status)

@@ -1650,104 +1636,10 @@

Parameter

authenticated

Emitted when authentication is successful

-
-

Parameters

- - - - - - - - - - - - - - - - - -
NameTypeOptionalDescription
-

session

-
-

object

-
-

 

-
-

Object containing session information. Can be used to restore the session.

-

Values in session have the following properties:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeOptionalDescription
-

WABrowserId

-
-

string

-
-

 

-
-
-

WASecretBundle

-
-

string

-
-

 

-
-
-

WAToken1

-
-

string

-
-

 

-
-
-

WAToken2

-
-

string

-
-

 

-
-
-
-

change_battery

-

Emitted when the battery percentage for the attached device changes

+

Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device.

Parameters

@@ -1818,6 +1710,8 @@

Parameters

+
Deprecated
+

change_state

Emitted when the connection state changes

@@ -2370,7 +2264,7 @@

Parameter

qr

-

Emitted when the QR code is received

+

Emitted when a QR code is received

Parameter

@@ -2416,7 +2310,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 74260b754e6..929584be132 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Source: Client.js + whatsapp-web.js 1.16.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -34,7 +34,6 @@

Source: Client.js

const EventEmitter = require('events'); const puppeteer = require('puppeteer'); const moduleRaid = require('@pedroslopez/moduleraid/moduleraid'); -const jsQR = require('jsqr'); const Util = require('./util/Util'); const InterfaceController = require('./util/InterfaceController'); @@ -42,22 +41,20 @@

Source: Client.js

const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification , Label, Call, Buttons, List} = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List } = require('./structures'); +const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); +const NoAuth = require('./authStrategies/NoAuth'); + /** * Starting point for interacting with the WhatsApp Web API * @extends {EventEmitter} * @param {object} options - Client options + * @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. * @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer * @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ - * @param {number} options.qrRefreshIntervalMs - Refresh interval for qr code (how much time to wait before checking if the qr code has changed) - * @param {number} options.qrTimeoutMs - Timeout for qr code selector in puppeteer * @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up - * @param {string} options.restartOnAuthFail - Restart client with a new session (i.e. use null 'session' var) if authentication fails - * @param {object} options.session - Whatsapp session to restore. If not set, will start a new session - * @param {string} options.session.WABrowserId - * @param {string} options.session.WASecretBundle - * @param {string} options.session.WAToken1 - * @param {string} options.session.WAToken2 + * @param {string} options.restartOnAuthFail - @deprecated This option should be set directly on the LegacySessionAuth. + * @param {object} options.session - @deprecated Only here for backwards-compatibility. You should move to using LocalAuth, or set the authStrategy to LegacySessionAuth explicitly. * @param {number} options.takeoverOnConflict - If another whatsapp web session is detected (another browser), take over the session in the current browser * @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session * @param {string} options.userAgent - User agent to use in puppeteer @@ -79,13 +76,33 @@

Source: Client.js

* @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state - * @fires Client#change_battery */ class Client extends EventEmitter { constructor(options = {}) { super(); this.options = Util.mergeDefault(DefaultOptions, options); + + if(!this.options.authStrategy) { + if(Object.prototype.hasOwnProperty.call(this.options, 'session')) { + process.emitWarning( + 'options.session is deprecated and will be removed in a future release due to incompatibility with multi-device. ' + + 'Use the LocalAuth authStrategy, don\'t pass in a session as an option, or suppress this warning by using the LegacySessionAuth strategy explicitly (see https://wwebjs.dev/guide/authentication.html#legacysessionauth-strategy).', + 'DeprecationWarning' + ); + + this.authStrategy = new LegacySessionAuth({ + session: this.options.session, + restartOnAuthFail: this.options.restartOnAuthFail + }); + } else { + this.authStrategy = new NoAuth(); + } + } else { + this.authStrategy = this.options.authStrategy; + } + + this.authStrategy.setup(this); this.pupBrowser = null; this.pupPage = null; @@ -98,41 +115,25 @@

Source: Client.js

*/ async initialize() { let [browser, page] = [null, null]; - - if(this.options.puppeteer &amp;&amp; this.options.puppeteer.browserWSEndpoint) { - browser = await puppeteer.connect(this.options.puppeteer); + + await this.authStrategy.beforeBrowserInitialized(); + + const puppeteerOpts = this.options.puppeteer; + if (puppeteerOpts &amp;&amp; puppeteerOpts.browserWSEndpoint) { + browser = await puppeteer.connect(puppeteerOpts); page = await browser.newPage(); } else { - browser = await puppeteer.launch(this.options.puppeteer); + browser = await puppeteer.launch(puppeteerOpts); page = (await browser.pages())[0]; } - + await page.setUserAgent(this.options.userAgent); + if (this.options.bypassCSP) await page.setBypassCSP(true); this.pupBrowser = browser; this.pupPage = page; - // remember me - await page.evaluateOnNewDocument(() => { - localStorage.setItem('remember-me', 'true'); - }); - - if (this.options.session) { - await page.evaluateOnNewDocument( - session => { - if(document.referrer === 'https://whatsapp.com/') { - localStorage.clear(); - localStorage.setItem('WABrowserId', session.WABrowserId); - localStorage.setItem('WASecretBundle', session.WASecretBundle); - localStorage.setItem('WAToken1', session.WAToken1); - localStorage.setItem('WAToken2', session.WAToken2); - } - }, this.options.session); - } - - if(this.options.bypassCSP) { - await page.setBypassCSP(true); - } + await this.authStrategy.afterBrowserInitialized(); await page.goto(WhatsWebURL, { waitUntil: 'load', @@ -140,56 +141,54 @@

Source: Client.js

referer: 'https://whatsapp.com/' }); - const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-icon="intro-md-beta-logo-dark"], [data-icon="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]'; - - if (this.options.session) { - // Check if session restore was successful - try { - await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs }); - } catch (err) { - if (err.name === 'TimeoutError') { - /** - * Emitted when there has been an error while trying to restore an existing session - * @event Client#auth_failure - * @param {string} message - */ - this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?'); - browser.close(); - if (this.options.restartOnAuthFail) { - // session restore failed so try again but without session to force new authentication - this.options.session = null; - this.initialize(); - } - return; + const INTRO_IMG_SELECTOR = '[data-testid="intro-md-beta-logo-dark"], [data-testid="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]'; + const INTRO_QRCODE_SELECTOR = 'div[data-ref] canvas'; + + // Checks which selector appears first + const needAuthentication = await Promise.race([ + new Promise(resolve => { + page.waitForSelector(INTRO_IMG_SELECTOR, { timeout: this.options.authTimeoutMs }) + .then(() => resolve(false)) + .catch((err) => resolve(err)); + }), + new Promise(resolve => { + page.waitForSelector(INTRO_QRCODE_SELECTOR, { timeout: this.options.authTimeoutMs }) + .then(() => resolve(true)) + .catch((err) => resolve(err)); + }) + ]); + + // Checks if an error ocurred on the first found selector. The second will be discarded and ignored by .race; + if (needAuthentication instanceof Error) throw needAuthentication; + + // Scan-qrcode selector was found. Needs authentication + if (needAuthentication) { + const { failed, failureEventPayload, restart } = await this.authStrategy.onAuthenticationNeeded(); + if(failed) { + /** + * Emitted when there has been an error while trying to restore an existing session + * @event Client#auth_failure + * @param {string} message + */ + this.emit(Events.AUTHENTICATION_FAILURE, failureEventPayload); + await this.destroy(); + if (restart) { + // session restore failed so try again but without session to force new authentication + return this.initialize(); } - - throw err; + return; } - } else { + const QR_CONTAINER = 'div[data-ref]'; + const QR_RETRY_BUTTON = 'div[data-ref] > span > button'; let qrRetries = 0; - - const getQrCode = async () => { - // Check if retry button is present - var QR_RETRY_SELECTOR = 'div[data-ref] > span > button'; - var qrRetry = await page.$(QR_RETRY_SELECTOR); - if (qrRetry) { - await qrRetry.click(); - } - - // Wait for QR Code - const QR_CANVAS_SELECTOR = 'canvas'; - await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: this.options.qrTimeoutMs }); - const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0, 0, 264, 264).data)); - const qr = jsQR(qrImgData, 264, 264).data; - + await page.exposeFunction('qrChanged', async (qr) => { /** - * Emitted when the QR code is received + * 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) { @@ -197,15 +196,39 @@

Source: Client.js

await this.destroy(); } } - }; - getQrCode(); - this._qrRefreshInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs); + }); + + await page.evaluate(function (selectors) { + const qr_container = document.querySelector(selectors.QR_CONTAINER); + window.qrChanged(qr_container.dataset.ref); + + const obs = new MutationObserver((muts) => { + muts.forEach(mut => { + // Listens to qr token change + if (mut.type === 'attributes' &amp;&amp; mut.attributeName === 'data-ref') { + window.qrChanged(mut.target.dataset.ref); + } else + // Listens to retry button, when found, click it + if (mut.type === 'childList') { + const retry_button = document.querySelector(selectors.QR_RETRY_BUTTON); + if (retry_button) retry_button.click(); + } + }); + }); + obs.observe(qr_container.parentElement, { + subtree: true, + childList: true, + attributes: true, + attributeFilter: ['data-ref'], + }); + }, { + QR_CONTAINER, + QR_RETRY_BUTTON + }); // Wait for code scan try { - await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 }); - clearInterval(this._qrRefreshInterval); - this._qrRefreshInterval = undefined; + await page.waitForSelector(INTRO_IMG_SELECTOR, { timeout: 0 }); } catch(error) { if ( error.name === 'ProtocolError' &amp;&amp; @@ -218,44 +241,29 @@

Source: Client.js

throw error; } + } await page.evaluate(ExposeStore, moduleRaid.toString()); - - // Get session tokens - const localStorage = JSON.parse(await page.evaluate(() => { - return JSON.stringify(window.localStorage); - })); - - const session = { - WABrowserId: localStorage.WABrowserId, - WASecretBundle: localStorage.WASecretBundle, - WAToken1: localStorage.WAToken1, - WAToken2: localStorage.WAToken2 - }; + const authEventPayload = await this.authStrategy.getAuthEventPayload(); /** * Emitted when authentication is successful * @event Client#authenticated - * @param {object} session Object containing session information. Can be used to restore the session. - * @param {string} session.WABrowserId - * @param {string} session.WASecretBundle - * @param {string} session.WAToken1 - * @param {string} session.WAToken2 */ - this.emit(Events.AUTHENTICATED, session); + this.emit(Events.AUTHENTICATED, authEventPayload); // Check window.Store Injection await page.waitForFunction('window.Store != undefined'); - const isMD = await page.evaluate(() => { - return window.Store.Features.features.MD_BACKEND; + await page.evaluate(async () => { + // safely unregister service workers + const registrations = await navigator.serviceWorker.getRegistrations(); + for (let registration of registrations) { + registration.unregister(); + } }); - if(isMD) { - throw new Error('Multi-device is not yet supported by whatsapp-web.js. Please check out https://github.com/pedroslopez/whatsapp-web.js/pull/889 to follow the progress.'); - } - //Load util functions (serializers, helper functions) await page.evaluate(LoadUtils); @@ -265,7 +273,7 @@

Source: Client.js

* @type {ClientInfo} */ this.info = new ClientInfo(this, await page.evaluate(() => { - return window.Store.Conn.serialize(); + return { ...window.Store.Conn.serialize(), wid: window.Store.User.getMeUser() }; })); // Add InterfaceController @@ -429,11 +437,12 @@

Source: Client.js

if (battery === undefined) return; /** - * Emitted when the battery percentage for the attached device changes + * Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device. * @event Client#change_battery * @param {object} batteryInfo * @param {number} batteryInfo.battery - The current battery percentage * @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false) + * @deprecated */ this.emit(Events.BATTERY_CHANGED, { battery, plugged }); }); @@ -452,14 +461,14 @@

Source: Client.js

* @param {boolean} call.webClientShouldHandle - If Waweb should handle * @param {object} call.participants - Participants */ - const cll = new Call(this,call); + const cll = new Call(this, call); this.emit(Events.INCOMING_CALL, cll); }); - + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); - window.Store.Msg.on('change:ack', (msg,ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); }); + window.Store.Msg.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); }); window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe &amp;&amp; !unsent) window.onMessageMediaUploadedEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); @@ -497,9 +506,6 @@

Source: Client.js

* Closes the client */ async destroy() { - if (this._qrRefreshInterval) { - clearInterval(this._qrRefreshInterval); - } await this.pupBrowser.close(); } @@ -507,9 +513,11 @@

Source: Client.js

* Logs out the client, closing the current session */ async logout() { - return await this.pupPage.evaluate(() => { + await this.pupPage.evaluate(() => { return window.Store.AppState.logout(); }); + + await this.authStrategy.logout(); } /** @@ -539,7 +547,7 @@

Source: Client.js

/** * Message options. * @typedef {Object} MessageSendOptions - * @property {boolean} [linkPreview=true] - Show links preview + * @property {boolean} [linkPreview=true] - Show links preview. Has no effect on multi-device accounts. * @property {boolean} [sendAudioAsVoice=false] - Send audio as voice message * @property {boolean} [sendVideoAsGif=false] - Send video as gif * @property {boolean} [sendMediaAsSticker=false] - Send media as a sticker @@ -589,34 +597,36 @@

Source: Client.js

} else if (content instanceof Location) { internalOptions.location = content; content = ''; - } else if(content instanceof Contact) { + } else if (content instanceof Contact) { internalOptions.contactCard = content.id._serialized; content = ''; - } else if(Array.isArray(content) &amp;&amp; content.length > 0 &amp;&amp; content[0] instanceof Contact) { + } else if (Array.isArray(content) &amp;&amp; content.length > 0 &amp;&amp; content[0] instanceof Contact) { internalOptions.contactCardList = content.map(contact => contact.id._serialized); content = ''; - } else if(content instanceof Buttons){ - if(content.type !== 'chat'){internalOptions.attachment = content.body;} + } else if (content instanceof Buttons) { + if (content.type !== 'chat') { internalOptions.attachment = content.body; } internalOptions.buttons = content; content = ''; - } else if(content instanceof List){ + } else if (content instanceof List) { internalOptions.list = content; content = ''; } if (internalOptions.sendMediaAsSticker &amp;&amp; internalOptions.attachment) { - internalOptions.attachment = - await Util.formatToWebpSticker(internalOptions.attachment, { + internalOptions.attachment = await Util.formatToWebpSticker( + internalOptions.attachment, { name: options.stickerName, author: options.stickerAuthor, categories: options.stickerCategories - }); + }, this.pupPage + ); } const newMessage = await this.pupPage.evaluate(async (chatId, message, options, sendSeen) => { const chatWid = window.Store.WidFactory.createWid(chatId); const chat = await window.Store.Chat.find(chatWid); + if (sendSeen) { window.WWebJS.sendSeen(chatId); } @@ -703,7 +713,7 @@

Source: Client.js

*/ async getInviteInfo(inviteCode) { return await this.pupPage.evaluate(inviteCode => { - return window.Store.Wap.groupInviteInfo(inviteCode); + return window.Store.InviteInfo.sendQueryGroupInvite(inviteCode); }, inviteCode); } @@ -722,25 +732,25 @@

Source: Client.js

/** * Accepts a private invitation to join a group - * @param {object} inviteV4 Invite V4 Info + * @param {object} inviteInfo Invite V4 Info * @returns {Promise&lt;Object>} */ async acceptGroupV4Invite(inviteInfo) { - if(!inviteInfo.inviteCode) throw 'Invalid invite code, try passing the message.inviteV4 object'; + if (!inviteInfo.inviteCode) throw 'Invalid invite code, try passing the message.inviteV4 object'; if (inviteInfo.inviteCodeExp == 0) throw 'Expired invite code'; - return await this.pupPage.evaluate(async inviteInfo => { - let { groupId, fromId, inviteCode, inviteCodeExp, toId } = inviteInfo; - return await window.Store.Wap.acceptGroupV4Invite(groupId, fromId, inviteCode, String(inviteCodeExp), toId); + return this.pupPage.evaluate(async inviteInfo => { + let { groupId, fromId, inviteCode, inviteCodeExp } = inviteInfo; + return await window.Store.JoinInviteV4.sendJoinGroupViaInviteV4(inviteCode, String(inviteCodeExp), groupId, fromId); }, inviteInfo); } - + /** * Sets the current user's status message * @param {string} status New status message */ async setStatus(status) { await this.pupPage.evaluate(async status => { - return await window.Store.Wap.sendSetStatus(status); + return await window.Store.StatusUtils.setMyStatus(status); }, status); } @@ -748,11 +758,22 @@

Source: Client.js

* Sets the current user's display name. * This is the name shown to WhatsApp users that have not added you as a contact beside your number in groups and in your profile. * @param {string} displayName New display name + * @returns {Promise&lt;Boolean>} */ async setDisplayName(displayName) { - await this.pupPage.evaluate(async displayName => { - return await window.Store.Wap.setPushname(displayName); + const couldSet = await this.pupPage.evaluate(async displayName => { + if(!window.Store.Conn.canSetMyPushname()) return false; + + if(window.Store.Features.features.MD_BACKEND) { + // TODO + return false; + } else { + const res = await window.Store.Wap.setPushname(displayName); + return !res.status || res.status === 200; + } }, displayName); + + return couldSet; } /** @@ -771,7 +792,16 @@

Source: Client.js

*/ async sendPresenceAvailable() { return await this.pupPage.evaluate(() => { - return window.Store.Wap.sendPresenceAvailable(); + return window.Store.PresenceUtils.sendPresenceAvailable(); + }); + } + + /** + * Marks the client as unavailable + */ + async sendPresenceUnavailable() { + return await this.pupPage.evaluate(() => { + return window.Store.PresenceUtils.sendPresenceUnavailable(); }); } @@ -878,12 +908,37 @@

Source: Client.js

*/ async getProfilePicUrl(contactId) { const profilePic = await this.pupPage.evaluate((contactId) => { - return window.Store.Wap.profilePicFind(contactId); + const chatWid = window.Store.WidFactory.createWid(contactId); + return window.Store.getProfilePicFull(chatWid); }, contactId); return profilePic ? profilePic.eurl : undefined; } + /** + * Gets the Contact's common groups with you. Returns empty array if you don't have any common group. + * @param {string} contactId the whatsapp user's ID (_serialized format) + * @returns {Promise&lt;WAWebJS.ChatId[]>} + */ + async getCommonGroups(contactId) { + const commonGroups = await this.pupPage.evaluate(async (contactId) => { + const contact = window.Store.Contact.get(contactId); + if (contact.commonGroups) { + return contact.commonGroups.serialize(); + } + const status = await window.Store.findCommonGroups(contact); + if (status) { + return contact.commonGroups.serialize(); + } + return []; + }, contactId); + const chats = []; + for (const group of commonGroups) { + chats.push(group.id); + } + return chats; + } + /** * Force reset of connection state for the client */ @@ -899,10 +954,7 @@

Source: Client.js

* @returns {Promise&lt;Boolean>} */ async isRegisteredUser(id) { - return await this.pupPage.evaluate(async (id) => { - let result = await window.Store.Wap.queryExist(id); - return result.jid !== undefined; - }, id); + return Boolean(await this.getNumberId(id)); } /** @@ -912,14 +964,15 @@

Source: Client.js

* @returns {Promise&lt;Object|null>} */ async getNumberId(number) { - if (!number.endsWith('@c.us')) number += '@c.us'; - try { - return await this.pupPage.evaluate(async numberId => { - return window.WWebJS.getNumberId(numberId); - }, number); - } catch(_) { - return null; + if (!number.endsWith('@c.us')) { + number += '@c.us'; } + + return await this.pupPage.evaluate(async number => { + const result = await window.Store.QueryExist(number); + if (!result || result.wid === undefined) return null; + return result.wid; + }, number); } /** @@ -928,14 +981,14 @@

Source: Client.js

* @returns {Promise&lt;string>} */ async getFormattedNumber(number) { - if(!number.endsWith('@s.whatsapp.net')) number = number.replace('c.us', 's.whatsapp.net'); - if(!number.includes('@s.whatsapp.net')) number = `${number}@s.whatsapp.net`; - + if (!number.endsWith('@s.whatsapp.net')) number = number.replace('c.us', 's.whatsapp.net'); + if (!number.includes('@s.whatsapp.net')) number = `${number}@s.whatsapp.net`; + return await this.pupPage.evaluate(async numberId => { return window.Store.NumberInfo.formattedPhoneNumber(numberId); }, number); } - + /** * Get the country code of a WhatsApp ID. * @param {string} number Number or ID @@ -948,7 +1001,7 @@

Source: Client.js

return window.Store.NumberInfo.findCC(numberId); }, number); } - + /** * Create a new group * @param {string} name group title @@ -967,12 +1020,9 @@

Source: Client.js

} const createRes = await this.pupPage.evaluate(async (name, participantIds) => { - const res = await window.Store.Wap.createGroup(name, participantIds); - console.log(res); - if (!res.status === 200) { - throw 'An error occurred while creating the group!'; - } - + const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p)); + const id = window.Store.genId(); + const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id); return res; }, name, participants); @@ -993,9 +1043,9 @@

Source: Client.js

async getLabels() { const labels = await this.pupPage.evaluate(async () => { return window.WWebJS.getLabels(); - }); + }); - return labels.map(data => new Label(this , data)); + return labels.map(data => new Label(this, data)); } /** @@ -1006,7 +1056,7 @@

Source: Client.js

async getLabelById(labelId) { const label = await this.pupPage.evaluate(async (labelId) => { return window.WWebJS.getLabel(labelId); - }, labelId); + }, labelId); return new Label(this, label); } @@ -1016,12 +1066,12 @@

Source: Client.js

* @param {string} chatId * @returns {Promise&lt;Array&lt;Label>>} */ - async getChatLabels(chatId){ + async getChatLabels(chatId) { const labels = await this.pupPage.evaluate(async (chatId) => { return window.WWebJS.getChatLabels(chatId); }, chatId); - return labels.map(data => new Label(this, data)); + return labels.map(data => new Label(this, data)); } /** @@ -1029,16 +1079,16 @@

Source: Client.js

* @param {string} labelId * @returns {Promise&lt;Array&lt;Chat>>} */ - async getChatsByLabelId(labelId){ + async getChatsByLabelId(labelId) { const chatIds = await this.pupPage.evaluate(async (labelId) => { const label = window.Store.Label.get(labelId); const labelItems = label.labelItemCollection.models; return labelItems.reduce((result, item) => { - if(item.parentType === 'Chat'){ + if (item.parentType === 'Chat') { result.push(item.parentId); } return result; - },[]); + }, []); }, labelId); return Promise.all(chatIds.map(id => this.getChatById(id))); @@ -1051,7 +1101,7 @@

Source: Client.js

async getBlockedContacts() { const blockedContacts = await this.pupPage.evaluate(() => { let chatIds = window.Store.Blocklist.models.map(a => a.id._serialized); - return Promise.all(chatIds.map(id => window.WWebJS.getContact(id))); + return Promise.all(chatIds.map(id => window.WWebJS.getContact(id))); }); return blockedContacts.map(contact => ContactFactory.create(this.client, contact)); @@ -1069,7 +1119,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 15bb01e05d8..5e1933f9ab2 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: ClientInfo + whatsapp-web.js 1.16.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -39,31 +39,26 @@

Properties

-
platform
-
-
pushname
-
-
-
-
wid
+
+
@@ -93,15 +88,9 @@

new ClientInfo

Properties

-

me -  object

-
-
Deprecated
-
Use .wid instead
-

phone  object

-

Information about the phone this client is connected to

+

Information about the phone this client is connected to. Not available in multi-device.

Properties

@@ -188,10 +177,12 @@

Properties

+
Deprecated
+

platform  string

-

Platform the phone is running on

+

Platform WhatsApp is running on

pushname @@ -211,6 +202,8 @@

Method

getBatteryStatus() → (object, number, or boolean)

Get current battery percentage and charging status for the attached device

+
Deprecated
+
Returns

object  @@ -238,7 +231,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index d726f3091a4..30e50f3c53b 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Contact + whatsapp-web.js 1.16.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -108,19 +108,22 @@

Methods

+
getProfilePicUrl()
+
+
unblock()
@@ -236,6 +239,15 @@

getChat

async
+

getCommonGroups() → Promise containing Array of WAWebJS.ChatId

+

Gets the Contact's common groups with you. Returns empty array if you don't have any common group.

+
+
Returns
+
+

Promise containing Array of WAWebJS.ChatId 

+
+
+
async

getCountryCode() → Promise containing string

Returns the contact's countrycode, (1541859685@c.us) => (1)

@@ -281,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 9918ae87cf7..62302fe5eec 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: GroupChat + whatsapp-web.js 1.16.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -645,12 +645,14 @@

Parameter

async
-

revokeInvite() → Promise

+

revokeInvite() → Promise containing string

Invalidates the current group invite code and generates a new one

Returns
-

Promise 

+

Promise containing string  +

New invite code

+

async
@@ -731,7 +733,7 @@

sendStateTypingChat#sendStateTyping
async
-

setDescription(description) → Promise

+

setDescription(description) → Promise containing boolean

Updates the group description

Parameter

@@ -764,7 +766,9 @@

Parameter

Returns
-

Promise 

+

Promise containing boolean  +

Returns true if the description was properly updated. This can return false if the user does not have the necessary permissions.

+

async
@@ -850,7 +854,7 @@

Parameter

async
-

setSubject(subject) → Promise

+

setSubject(subject) → Promise containing boolean

Updates the group subject

Parameter

@@ -883,7 +887,9 @@

Parameter

Returns
-

Promise 

+

Promise containing boolean  +

Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.

+

async
@@ -921,7 +927,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 51b4c410aaa..2090ce51ca2 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: GroupNotification + whatsapp-web.js 1.16.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 1d18650ead8..1c6d8cf229b 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: InterfaceController + whatsapp-web.js 1.16.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index 0f959821e77..e401c74c358 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Label + whatsapp-web.js 1.16.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html new file mode 100644 index 00000000000..414c156bdeb --- /dev/null +++ b/docs/LegacySessionAuth.html @@ -0,0 +1,188 @@ + + + + + + + whatsapp-web.js 1.16.0 » Class: LegacySessionAuth + + + + + + + + +
+
+
+
+ +
+
+
+

new LegacySessionAuth(options)

+
+

Parameters

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

options

+
+

 

+
+

 

+
+

options

+

Values in options have the following properties:

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

restartOnAuthFail

+
+

 

+
+

 

+
+

Restart client with a new session (i.e. use null 'session' var) if authentication fails

+
+

session

+
+

 

+
+

 

+
+

Whatsapp session to restore. If not set, will start a new session

+
+

session.WABrowserId

+
+

 

+
+

 

+
+
+

session.WASecretBundle

+
+

 

+
+

 

+
+
+

session.WAToken1

+
+

 

+
+

 

+
+
+

session.WAToken2

+
+

 

+
+

 

+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/List.html b/docs/List.html index f5aa6f7228b..857256dd432 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: List + whatsapp-web.js 1.16.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html new file mode 100644 index 00000000000..41247a5fb35 --- /dev/null +++ b/docs/LocalAuth.html @@ -0,0 +1,135 @@ + + + + + + + whatsapp-web.js 1.16.0 » Class: LocalAuth + + + + + + + + +
+
+
+
+ +
+
+
+

new LocalAuth(options)

+
+

Parameters

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

options

+
+

 

+
+

 

+
+

options

+

Values in options have the following properties:

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

clientId

+
+

 

+
+

 

+
+

Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance

+
+

dataPath

+
+

 

+
+

 

+
+

Change the default path for saving session files, default is: "./.wwebjs_auth/"

+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/Location.html b/docs/Location.html index ece044c0e6c..cb67ee19c61 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Location + whatsapp-web.js 1.16.0 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index f3d957868f9..ec2acd0e13a 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Message + whatsapp-web.js 1.16.0 » Class: Message @@ -15,7 +15,7 @@ @@ -54,6 +54,9 @@

Properties

deviceType
+
duration
+
+
forwardingScore
@@ -97,13 +100,13 @@

Properties

links
+
location
+
+

-
location
-
-
mediaKey
@@ -113,6 +116,9 @@

Properties

orderId
+
rawData
+
+
timestamp
@@ -178,6 +184,9 @@

Methods

getQuotedMessage()
+
reload()
+
+
reply(content[, chatId][, options])
@@ -227,6 +236,11 @@

deviceType

+

duration +  string

+

Indicates the duration of the message in seconds

+
+

forwardingScore  number

Indicates how many times the message was forwarded.

@@ -313,6 +327,11 @@

orderId +

rawData +  Object

+

Returns message in a raw format

+
+

timestamp  number

Unix timestamp for when the message was created

@@ -496,6 +515,16 @@

getQuotedMessage
async
+

reload() → Promise containing Message

+

Reloads this Message object's data in-place with the latest values from WhatsApp Web. + Note that the Message must still be in the web app cache for this to work, otherwise will return null.

+
+
Returns
+
+

Promise containing Message 

+
+
+
async

reply(content[, chatId][, options]) → Promise containing Message

Sends a message as a reply to this message. If chatId is specified, it will be sent through the specified Chat. If not, it will send the message @@ -580,7 +609,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 781b4686bec..08d066e34d1 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: MessageMedia + whatsapp-web.js 1.16.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -343,7 +343,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html new file mode 100644 index 00000000000..6eb911ce98e --- /dev/null +++ b/docs/NoAuth.html @@ -0,0 +1,66 @@ + + + + + + + whatsapp-web.js 1.16.0 » Class: NoAuth + + + + + + + + +
+
+
+
+ +
+
+
+

new NoAuth()

+
+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/Order.html b/docs/Order.html index 96d69db3050..1b736123b5a 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Order + whatsapp-web.js 1.16.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index fc3cb17f1f9..316c4547693 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: PrivateChat + whatsapp-web.js 1.16.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -519,7 +519,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 1f3f4c69ed8..4035f054dc7 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: PrivateContact + whatsapp-web.js 1.16.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -108,19 +108,22 @@

Methods

+
getProfilePicUrl()
+
+
unblock()
@@ -262,6 +265,15 @@

getChat

async
+

getCommonGroups() → Promise containing Array of WAWebJS.ChatId

+

Gets the Contact's common groups with you. Returns empty array if you don't have any common group.

+
+
Inherited from
+
Contact#getCommonGroups
+
Returns
+
+
+
async

getCountryCode() → Promise containing string

Returns the contact's countrycode, (1541859685@c.us) => (1)

@@ -307,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 40a21e41d24..1a732f14575 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Product + whatsapp-web.js 1.16.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Util.html b/docs/Util.html index c0d09ebd8a1..19090962ac3 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.15.8 » Class: Util + whatsapp-web.js 1.16.0 » Class: Util @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@

-
- +
+
Message#getInfo()
@@ -2094,10 +2094,6 @@

Message

-
-
-
-
Message#links
@@ -2108,6 +2104,10 @@

Message

+
+
+
+
Message#mediaKey
@@ -2128,6 +2128,11 @@

Message

+
+ Message#react(reaction) +
+
+
Message#reload()
@@ -3149,7 +3154,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index f64644bde5d..878d9c4e1bb 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Base.js + whatsapp-web.js 1.17.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 5d7565e53ba..539389f5624 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/BusinessContact.js + whatsapp-web.js 1.17.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index a3e582e2aee..d98ef044bd9 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Buttons.js + whatsapp-web.js 1.17.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index dc33883bf31..4390d3ad5be 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Call.js + whatsapp-web.js 1.17.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 705255d7f87..92e84b12b53 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Chat.js + whatsapp-web.js 1.17.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -215,7 +215,7 @@

Source: structures/Chat.js

if (searchOptions &amp;&amp; searchOptions.limit > 0) { while (msgs.length &lt; searchOptions.limit) { const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(chat); - if (!loadedMessages) break; + if (!loadedMessages || !loadedMessages.length) break; msgs = [...loadedMessages.filter(msgFilter), ...msgs]; } @@ -290,7 +290,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 5a54abd7e5c..a87312b9c54 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/ClientInfo.js + whatsapp-web.js 1.17.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 2ba974c3647..95ac42a5a6b 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Contact.js + whatsapp-web.js 1.17.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 910aff9219b..391df25a0d3 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/GroupChat.js + whatsapp-web.js 1.17.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -178,7 +178,7 @@

Source: structures/GroupChat.js

this.groupMetadata.desc = description; return true; } - + /** * Updates the group settings to only allow admins to send messages. * @param {boolean} [adminsOnly=true] Enable or disable this option @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 52970d420e9..0ade5b5399e 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/GroupNotification.js + whatsapp-web.js 1.17.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 2dddd3603a9..f8acc76d886 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Label.js + whatsapp-web.js 1.17.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 5974441f5cd..27b0eedeb31 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/List.js + whatsapp-web.js 1.17.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 0da80696a52..6026c632df4 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Location.js + whatsapp-web.js 1.17.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index d28393172fb..3bb29af9056 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Message.js + whatsapp-web.js 1.17.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -366,6 +366,18 @@

Source: structures/Message.js

return this.client.sendMessage(chatId, content, options); } + /** + * React to this message with an emoji + * @param {string} reaction - Emoji to react with. Send an empty string to remove the reaction. + * @return {Promise} + */ + async react(reaction){ + await this.client.pupPage.evaluate(async (messageId, reaction) => { + const msg = await window.Store.Msg.get(messageId); + await window.Store.sendReactionToMsg(msg, reaction); + }, this.id._serialized, reaction); + } + /** * Accept Group V4 Invite * @returns {Promise&lt;Object>} @@ -554,7 +566,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 946108bb4ad..a0fbcc99947 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/MessageMedia.js + whatsapp-web.js 1.17.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -142,7 +142,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index d680f422a62..6c5a007577c 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Order.js + whatsapp-web.js 1.17.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 0fbd03968fe..7494ad846a3 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Payment.js + whatsapp-web.js 1.17.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 756771a358b..e97628c9eae 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/PrivateChat.js + whatsapp-web.js 1.17.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index d62a94ea05d..2cab9bafac8 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/PrivateContact.js + whatsapp-web.js 1.17.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index ddf184cc9bc..4518a459fc3 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/Product.js + whatsapp-web.js 1.17.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 7f6d5384d8e..12eb181fc2d 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.17.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 6896ab5f479..6d370c20f18 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: util/Constants.js + whatsapp-web.js 1.17.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -197,7 +197,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 5649a00818f..ac19a0b220d 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: util/InterfaceController.js + whatsapp-web.js 1.17.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -160,7 +160,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 450a2959c5f..01e5a75e2cb 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.16.7 » Source: util/Util.js + whatsapp-web.js 1.17.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -37,7 +37,6 @@

Source: util/Util.js

const ffmpeg = require('fluent-ffmpeg'); const webp = require('node-webpmux'); const fs = require('fs').promises; - const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); /** @@ -226,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index e74ac5df56f..8332cdbce87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.16.7", + "version": "1.17.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 73e4b3b6e0f68400882720e017f39815fda40f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BC=BA=20L=E1=B4=87G=CC=B8=E1=B4=87=C9=B4D=20=E0=BC=BB?= <39593002+jtourisNS@users.noreply.github.com> Date: Sun, 10 Jul 2022 03:07:57 -0300 Subject: [PATCH 044/430] fix: `getNumberId` Error: Evaluation failed: TypeError: e.isLid is not a function (#1571) --- src/Client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index 843a9fe6c26..40bf560c494 100644 --- a/src/Client.js +++ b/src/Client.js @@ -949,7 +949,8 @@ class Client extends EventEmitter { } return await this.pupPage.evaluate(async number => { - const result = await window.Store.QueryExist(number); + const wid = window.Store.WidFactory.createWid(number); + const result = await window.Store.QueryExist(wid); if (!result || result.wid === undefined) return null; return result.wid; }, number); From b8b41920e3638dfe294fc4940345408e6d708cd6 Mon Sep 17 00:00:00 2001 From: Caio Agiani Date: Sun, 10 Jul 2022 03:10:53 -0300 Subject: [PATCH 045/430] chore(client): adjust typo (#1565) --- docs/Client.js.html | 2 +- src/Client.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Client.js.html b/docs/Client.js.html index 763cd64f8d8..08babce87be 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -163,7 +163,7 @@

Source: Client.js

}) ]); - // Checks if an error ocurred on the first found selector. The second will be discarded and ignored by .race; + // Checks if an error occurred on the first found selector. The second will be discarded and ignored by .race; if (needAuthentication instanceof Error) throw needAuthentication; // Scan-qrcode selector was found. Needs authentication diff --git a/src/Client.js b/src/Client.js index 40bf560c494..d30390b1365 100644 --- a/src/Client.js +++ b/src/Client.js @@ -132,7 +132,7 @@ class Client extends EventEmitter { }) ]); - // Checks if an error ocurred on the first found selector. The second will be discarded and ignored by .race; + // Checks if an error occurred on the first found selector. The second will be discarded and ignored by .race; if (needAuthentication instanceof Error) throw needAuthentication; // Scan-qrcode selector was found. Needs authentication From e7025ceca1a1c637ad937b73a2dd25b22be8ab27 Mon Sep 17 00:00:00 2001 From: Maksim Date: Sun, 10 Jul 2022 09:11:34 +0300 Subject: [PATCH 046/430] Fix TS declaration for Promise of new "react" method (#1561) Without explicit delaration of void for Promise running tsc causing the error: ``` node_modules/whatsapp-web.js/index.d.ts:707:38 - error TS2314: Generic type 'Promise' requires 1 type argument(s). ``` --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index a242bf4c3f2..276496dbd8b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -704,7 +704,7 @@ declare namespace WAWebJS { */ reply: (content: MessageContent, chatId?: string, options?: MessageSendOptions) => Promise, /** React to this message with an emoji*/ - react: (reaction: string) => Promise, + react: (reaction: string) => Promise, /** * Forwards this message to another chat */ From 8497a3d7e54420d184f5460ab9365c63a39618a9 Mon Sep 17 00:00:00 2001 From: Keenan Yafiq Date: Sun, 10 Jul 2022 13:14:16 +0700 Subject: [PATCH 047/430] Add "React to message" in README (#1534) * Add "React message" in Supported features list * Update README.md Co-authored-by: Pedro S. Lopez --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 03626ab9dba..239baa12676 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ For more information on saving and restoring sessions, check out the available [ | Get contact info | ✅ | | Get profile pictures | ✅ | | Set user status message | ✅ | +| React to messages | ✅ | Something missing? Make an issue and let us know! From 75d3c635f0d8eb73775eb8f8aa2653d2ec8d6731 Mon Sep 17 00:00:00 2001 From: Thomas <1688389+RakSrinaNa@users.noreply.github.com> Date: Sun, 10 Jul 2022 08:15:11 +0200 Subject: [PATCH 048/430] Add missing deviceType property in Message interface (#1510) Co-authored-by: Rajeh Taher --- index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.d.ts b/index.d.ts index 276496dbd8b..74502087497 100644 --- a/index.d.ts +++ b/index.d.ts @@ -604,6 +604,8 @@ declare namespace WAWebJS { ack: MessageAck, /** If the message was sent to a group, this field will contain the user that sent the message. */ author?: string, + /** String that represents from which device type the message was sent */ + deviceType: string, /** Message content */ body: string, /** Indicates if the message was a broadcast */ From 0e5bd9f38e324153918a841fffa7a073bd2b118b Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 10 Jul 2022 02:22:20 -0400 Subject: [PATCH 049/430] chore: mark version v1.17.1 --- docs/Base.html | 6 +++--- docs/BaseAuthStrategy.html | 6 +++--- docs/BusinessContact.html | 6 +++--- docs/Buttons.html | 6 +++--- docs/Call.html | 6 +++--- docs/Chat.html | 6 +++--- docs/Client.html | 6 +++--- docs/Client.js.html | 9 +++++---- docs/ClientInfo.html | 6 +++--- docs/Contact.html | 6 +++--- docs/GroupChat.html | 6 +++--- docs/GroupNotification.html | 6 +++--- docs/InterfaceController.html | 6 +++--- docs/Label.html | 6 +++--- docs/LegacySessionAuth.html | 6 +++--- docs/List.html | 6 +++--- docs/LocalAuth.html | 6 +++--- docs/Location.html | 6 +++--- docs/Message.html | 6 +++--- docs/MessageMedia.html | 6 +++--- docs/NoAuth.html | 6 +++--- docs/Order.html | 6 +++--- docs/PrivateChat.html | 6 +++--- docs/PrivateContact.html | 6 +++--- docs/Product.html | 6 +++--- docs/Util.html | 6 +++--- docs/authStrategies_BaseAuthStrategy.js.html | 6 +++--- docs/authStrategies_LegacySessionAuth.js.html | 6 +++--- docs/authStrategies_LocalAuth.js.html | 6 +++--- docs/authStrategies_NoAuth.js.html | 6 +++--- docs/global.html | 6 +++--- docs/index.html | 12 ++++++++---- docs/structures_Base.js.html | 6 +++--- docs/structures_BusinessContact.js.html | 6 +++--- docs/structures_Buttons.js.html | 6 +++--- docs/structures_Call.js.html | 6 +++--- docs/structures_Chat.js.html | 6 +++--- docs/structures_ClientInfo.js.html | 6 +++--- docs/structures_Contact.js.html | 6 +++--- docs/structures_GroupChat.js.html | 6 +++--- 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 | 6 +++--- docs/structures_MessageMedia.js.html | 6 +++--- docs/structures_Order.js.html | 6 +++--- docs/structures_Payment.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/util_Constants.js.html | 6 +++--- docs/util_InterfaceController.js.html | 6 +++--- docs/util_Util.js.html | 6 +++--- package.json | 2 +- 56 files changed, 173 insertions(+), 168 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index f0946b93769..146705d630e 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Base + whatsapp-web.js 1.17.1 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 725c678323f..eb1fd0d5fae 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.17.1 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index a027e9a65c7..86a7d39824c 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: BusinessContact + whatsapp-web.js 1.17.1 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index 95144f397ce..a5269104e50 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Buttons + whatsapp-web.js 1.17.1 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 0b8e5439012..d6ecec6298a 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Call + whatsapp-web.js 1.17.1 » Class: Call @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index 9217ec23f6c..a1f3a9a9d2e 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Chat + whatsapp-web.js 1.17.1 » Class: Chat @@ -15,7 +15,7 @@ @@ -483,7 +483,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 1e6b66c127f..599d86a97cb 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Client + whatsapp-web.js 1.17.1 » Class: Client @@ -15,7 +15,7 @@ @@ -2310,7 +2310,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 08babce87be..1e5b887f0bc 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: Client.js + whatsapp-web.js 1.17.1 » Source: Client.js @@ -15,7 +15,7 @@ @@ -980,7 +980,8 @@

Source: Client.js

} return await this.pupPage.evaluate(async number => { - const result = await window.Store.QueryExist(number); + const wid = window.Store.WidFactory.createWid(number); + const result = await window.Store.QueryExist(wid); if (!result || result.wid === undefined) return null; return result.wid; }, number); @@ -1130,7 +1131,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index dc67b2dee4c..0bb31af40a5 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: ClientInfo + whatsapp-web.js 1.17.1 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index eee5ec9e010..5988ce31f17 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Contact + whatsapp-web.js 1.17.1 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index d996d776df7..a54f8dfe8f7 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: GroupChat + whatsapp-web.js 1.17.1 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -927,7 +927,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 69feb31b06b..64aeb49bccc 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: GroupNotification + whatsapp-web.js 1.17.1 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 0609cac2e0c..5776e72744f 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: InterfaceController + whatsapp-web.js 1.17.1 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index 950b6a5cd63..e678cd74dda 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Label + whatsapp-web.js 1.17.1 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 838a2853a8c..5455ef32ace 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: LegacySessionAuth + whatsapp-web.js 1.17.1 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index 13e008796ba..953b5dcb888 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: List + whatsapp-web.js 1.17.1 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 5132be581ef..96ec06c6ab5 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: LocalAuth + whatsapp-web.js 1.17.1 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index fe356b5162a..a41e833983e 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Location + whatsapp-web.js 1.17.1 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index 46a641f708c..95fb491fe0e 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Message + whatsapp-web.js 1.17.1 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 0ba5c86bf8f..c2857b5074d 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: MessageMedia + whatsapp-web.js 1.17.1 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -343,7 +343,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index e8756067523..8ff57ef73c9 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: NoAuth + whatsapp-web.js 1.17.1 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index 830b8628726..dde65eebbb9 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Order + whatsapp-web.js 1.17.1 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 1ee0389caa9..3203df9015a 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: PrivateChat + whatsapp-web.js 1.17.1 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -519,7 +519,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index a8f1e8766b0..35d012f6928 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: PrivateContact + whatsapp-web.js 1.17.1 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index ae464cb5df4..746dd69623e 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Product + whatsapp-web.js 1.17.1 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Util.html b/docs/Util.html index 18dbc00bcd3..b64b60624f3 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Class: Util + whatsapp-web.js 1.17.1 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index d8ac228d01d..2bbcd7ffb4d 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.17.1 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -62,7 +62,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index fc5ff26d26c..6167ba9a397 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.17.1 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index c2a9a7ec117..ac7832cf9c7 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.17.1 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 68a6acb0443..50349b0f93a 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.17.1 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/global.html b/docs/global.html index 353f699954d..d20b79b05f0 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Globals + whatsapp-web.js 1.17.1 » Globals @@ -15,7 +15,7 @@ @@ -1980,7 +1980,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index bd7eadb6e9e..caff23885a6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Home + whatsapp-web.js 1.17.1 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
@@ -183,6 +183,10 @@

Supported features

Set user status message ✅ + + React to messages + ✅ +

Something missing? Make an issue and let us know!

@@ -3154,7 +3158,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 878d9c4e1bb..b62302b36fa 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Base.js + whatsapp-web.js 1.17.1 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 539389f5624..1569c3322be 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.17.1 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index d98ef044bd9..f11871752de 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Buttons.js + whatsapp-web.js 1.17.1 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 4390d3ad5be..cfe7007a703 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Call.js + whatsapp-web.js 1.17.1 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 92e84b12b53..09d1986a1c4 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Chat.js + whatsapp-web.js 1.17.1 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -290,7 +290,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index a87312b9c54..fe6a7253250 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.17.1 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 95ac42a5a6b..1344f74dcf5 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Contact.js + whatsapp-web.js 1.17.1 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 391df25a0d3..c0d97defc70 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.17.1 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 0ade5b5399e..943eb50c61f 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.17.1 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index f8acc76d886..1a28b122a01 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Label.js + whatsapp-web.js 1.17.1 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 27b0eedeb31..5f66e7af0b5 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/List.js + whatsapp-web.js 1.17.1 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 6026c632df4..1dfb302f4b2 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Location.js + whatsapp-web.js 1.17.1 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 3bb29af9056..125c4f3394b 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Message.js + whatsapp-web.js 1.17.1 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -566,7 +566,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index a0fbcc99947..f1886fa5962 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.17.1 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -142,7 +142,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 6c5a007577c..26461b3ab3d 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Order.js + whatsapp-web.js 1.17.1 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 7494ad846a3..8e74292ae0f 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Payment.js + whatsapp-web.js 1.17.1 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index e97628c9eae..3f32888a7d5 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.17.1 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 2cab9bafac8..40706a43f5b 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.17.1 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 4518a459fc3..0c77d311adb 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/Product.js + whatsapp-web.js 1.17.1 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 12eb181fc2d..220bef02100 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.17.1 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 6d370c20f18..ab0edca5044 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: util/Constants.js + whatsapp-web.js 1.17.1 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -197,7 +197,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index ac19a0b220d..0cdbf70afed 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.17.1 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -160,7 +160,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 01e5a75e2cb..50b56d03aa4 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.0 » Source: util/Util.js + whatsapp-web.js 1.17.1 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index 8332cdbce87..e33dfe4cec2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.17.0", + "version": "1.17.1", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From e91077a615cc54bf456e75266bb8b4742aa7eb82 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 10 Jul 2022 02:24:57 -0400 Subject: [PATCH 050/430] Update supported WhatsApp Web version to v2.2224.8 (#1532) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 239baa12676..cda4a29e6fc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2220.8](https://img.shields.io/badge/WhatsApp_Web-2.2220.8-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2224.8](https://img.shields.io/badge/WhatsApp_Web-2.2224.8-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 6f1dd18b489..5454cae0124 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2220.8 \ No newline at end of file +2.2224.8 \ No newline at end of file From 6a4fca0a778ee3fd9b2629a80bd771df9d8e77de Mon Sep 17 00:00:00 2001 From: Nowbie S <33182389+NowDev@users.noreply.github.com> Date: Tue, 9 Aug 2022 12:24:43 -0300 Subject: [PATCH 051/430] updating forward documentation. (#1624) * updating forward documentation. * Update Message.js * Update index.d.ts * Update docs/Message.html Co-authored-by: Rajeh Taher --- index.d.ts | 2 +- src/structures/Message.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 74502087497..8759f5c6920 100644 --- a/index.d.ts +++ b/index.d.ts @@ -708,7 +708,7 @@ declare namespace WAWebJS { /** React to this message with an emoji*/ react: (reaction: string) => Promise, /** - * Forwards this message to another chat + * Forwards this message to another chat (that you chatted before, otherwise it will fail) */ forward: (chat: Chat | string) => Promise, /** Star this message */ diff --git a/src/structures/Message.js b/src/structures/Message.js index 94893cca5f3..77a8e89905c 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -356,7 +356,7 @@ class Message extends Base { } /** - * Forwards this message to another chat + * Forwards this message to another chat (that you chatted before, otherwise it will fail) * * @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded * @returns {Promise} From 56343497e9e5b737975afcbe25f1b9f2a1b412d2 Mon Sep 17 00:00:00 2001 From: Ruvian S <12111730+matricce@users.noreply.github.com> Date: Tue, 9 Aug 2022 12:25:53 -0300 Subject: [PATCH 052/430] fix: `star` Error: Evaluation failed: TypeError: msg.chat.sendStarMsgs is not a function (#1598) Co-authored-by: Rajeh Taher --- docs/structures_Message.js.html | 4 ++-- src/structures/Message.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 125c4f3394b..d937dd51e27 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -480,7 +480,7 @@

Source: structures/Message.js

let msg = window.Store.Msg.get(msgId); if (msg.canStar()) { - return msg.chat.sendStarMsgs([msg], true); + return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false); } }, this.id._serialized); } @@ -493,7 +493,7 @@

Source: structures/Message.js

let msg = window.Store.Msg.get(msgId); if (msg.canStar()) { - return msg.chat.sendStarMsgs([msg], false); + return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false); } }, this.id._serialized); } diff --git a/src/structures/Message.js b/src/structures/Message.js index 77a8e89905c..f66af9993c8 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -449,7 +449,7 @@ class Message extends Base { let msg = window.Store.Msg.get(msgId); if (msg.canStar()) { - return msg.chat.sendStarMsgs([msg], true); + return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false); } }, this.id._serialized); } @@ -462,7 +462,7 @@ class Message extends Base { let msg = window.Store.Msg.get(msgId); if (msg.canStar()) { - return msg.chat.sendStarMsgs([msg], false); + return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false); } }, this.id._serialized); } From 6e047cb9bee7eeb43943e1b900b4401cd14c7c78 Mon Sep 17 00:00:00 2001 From: Yehuda Eisenberg <32451776+YehudaEi@users.noreply.github.com> Date: Tue, 9 Aug 2022 18:26:45 +0300 Subject: [PATCH 053/430] Update User agent (#1470) I encountered errors because of this (it says that the chrome version needs to be updated) Co-authored-by: Rajeh Taher --- src/util/Constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Constants.js b/src/util/Constants.js index 83a030fd887..c3d9dfdab96 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -11,7 +11,7 @@ exports.DefaultOptions = { qrMaxRetries: 0, takeoverOnConflict: false, takeoverTimeoutMs: 0, - userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36', + 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 }; From c5c705a55399204d761f11f971e35eaeab78482e Mon Sep 17 00:00:00 2001 From: tonbotfy <106827778+tonbotfy@users.noreply.github.com> Date: Tue, 9 Aug 2022 12:27:35 -0300 Subject: [PATCH 054/430] feat: [Updated] Loading screen listener with percent and message (#1563) * last update * eslint fix * headless fix * Update index.d.ts Co-authored-by: stefanfuchs * Update index.d.ts - Add 'LOADING_SCREEN' type to Enum Co-authored-by: stefanfuchs Co-authored-by: Rajeh Taher --- example.js | 4 ++++ index.d.ts | 4 ++++ src/Client.js | 46 +++++++++++++++++++++++++++++++++++++++++++ src/util/Constants.js | 1 + 4 files changed, 55 insertions(+) diff --git a/example.js b/example.js index 3c84bab0b5d..99dc7ea00ce 100644 --- a/example.js +++ b/example.js @@ -7,6 +7,10 @@ const client = new Client({ client.initialize(); +client.on('loading_screen', (percent, message) => { + console.log('LOADING SCREEN', percent, message); +}); + client.on('qr', (qr) => { // NOTE: This event will not be fired if a session is specified. console.log('QR RECEIVED', qr); diff --git a/index.d.ts b/index.d.ts index 8759f5c6920..d4289d75df7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -241,6 +241,9 @@ declare namespace WAWebJS { message: Message ) => void): this + /** Emitted when loading screen is appearing */ + on(event: 'loading_screen', listener: (percent: string, message: string) => void): this + /** Emitted when the QR code is received */ on(event: 'qr', listener: ( /** qr code string @@ -463,6 +466,7 @@ declare namespace WAWebJS { GROUP_LEAVE = 'group_leave', GROUP_UPDATE = 'group_update', QR_RECEIVED = 'qr', + LOADING_SCREEN = 'loading_screen', DISCONNECTED = 'disconnected', STATE_CHANGED = 'change_state', BATTERY_CHANGED = 'change_battery', diff --git a/src/Client.js b/src/Client.js index d30390b1365..01d95272138 100644 --- a/src/Client.js +++ b/src/Client.js @@ -115,6 +115,52 @@ class Client extends EventEmitter { referer: 'https://whatsapp.com/' }); + await page.evaluate(`function getElementByXpath(path) { + return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + }`); + + let lastPercent = null, + lastPercentMessage = null; + + await page.exposeFunction('loadingScreen', async (percent, message) => { + if (lastPercent !== percent || lastPercentMessage !== message) { + this.emit(Events.LOADING_SCREEN, percent, message); + lastPercent = percent; + lastPercentMessage = message; + } + }); + + await page.evaluate( + async function (selectors) { + var observer = new MutationObserver(function () { + let progressBar = window.getElementByXpath( + selectors.PROGRESS + ); + let progressMessage = window.getElementByXpath( + selectors.PROGRESS_MESSAGE + ); + + if (progressBar) { + window.loadingScreen( + progressBar.value, + progressMessage.innerText + ); + } + }); + + observer.observe(document, { + attributes: true, + childList: true, + characterData: true, + subtree: true, + }); + }, + { + PROGRESS: '//*[@id=\'app\']/div/div/div[2]/progress', + PROGRESS_MESSAGE: '//*[@id=\'app\']/div/div/div[3]', + } + ); + const INTRO_IMG_SELECTOR = '[data-testid="intro-md-beta-logo-dark"], [data-testid="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]'; const INTRO_QRCODE_SELECTOR = 'div[data-ref] canvas'; diff --git a/src/util/Constants.js b/src/util/Constants.js index c3d9dfdab96..009ae5e0728 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -46,6 +46,7 @@ exports.Events = { GROUP_LEAVE: 'group_leave', GROUP_UPDATE: 'group_update', QR_RECEIVED: 'qr', + LOADING_SCREEN: 'loading_screen', DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', BATTERY_CHANGED: 'change_battery', From bd553f75d35a882b4d4144e94687b8d32baf52ba Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Tue, 9 Aug 2022 18:29:59 +0300 Subject: [PATCH 055/430] feat: Adding file size by bytes to MessageMedia (#1273) * Update index.d.ts * Update Message.js * Update Message.js * Update MessageMedia.js * Update MessageMedia.js --- index.d.ts | 5 ++++- src/structures/Message.js | 5 +++-- src/structures/MessageMedia.js | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/index.d.ts b/index.d.ts index d4289d75df7..eabafb75ec1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -809,13 +809,16 @@ declare namespace WAWebJS { data: string /** Document file name. Value can be null */ filename?: string | null + /** Document file size in bytes. Value can be null. */ + filesize?: number | null /** * @param {string} mimetype MIME type of the attachment * @param {string} data Base64-encoded data of the file * @param {?string} filename Document file name. Value can be null + * @param {?number} filesize Document file size in bytes. Value can be null. */ - constructor(mimetype: string, data: string, filename?: string | null) + constructor(mimetype: string, data: string, filename?: string | null, filesize?: number | null) /** Creates a MessageMedia instance from a local file path */ static fromFilePath: (filePath: string) => MessageMedia diff --git a/src/structures/Message.js b/src/structures/Message.js index f66af9993c8..899241ba21e 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -413,7 +413,8 @@ class Message extends Base { return { data, mimetype: msg.mimetype, - filename: msg.filename + filename: msg.filename, + filesize: msg.size }; } catch (e) { if(e.status && e.status === 404) return undefined; @@ -422,7 +423,7 @@ class Message extends Base { }, this.id._serialized); if (!result) return undefined; - return new MessageMedia(result.mimetype, result.data, result.filename); + return new MessageMedia(result.mimetype, result.data, result.filename, result.filesize); } /** diff --git a/src/structures/MessageMedia.js b/src/structures/MessageMedia.js index 450f78b0355..9be15be3917 100644 --- a/src/structures/MessageMedia.js +++ b/src/structures/MessageMedia.js @@ -10,10 +10,11 @@ const { URL } = require('url'); * Media attached to a message * @param {string} mimetype MIME type of the attachment * @param {string} data Base64-encoded data of the file - * @param {?string} filename Document file name + * @param {?string} filename Document file name. Value can be null + * @param {?number} filesize Document file size in bytes. Value can be null */ class MessageMedia { - constructor(mimetype, data, filename) { + constructor(mimetype, data, filename, filesize) { /** * MIME type of the attachment * @type {string} @@ -27,10 +28,16 @@ class MessageMedia { this.data = data; /** - * Name of the file (for documents) + * Document file name. Value can be null * @type {?string} */ this.filename = filename; + + /** + * Document file size in bytes. Value can be null + * @type {?number} + */ + this.filesize = filesize; } /** @@ -68,6 +75,7 @@ class MessageMedia { const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options); const response = await fetch(url, reqOptions); const mime = response.headers.get('Content-Type'); + const size = response.headers.get('Content-Length'); const contentDisposition = response.headers.get('Content-Disposition'); const name = contentDisposition ? contentDisposition.match(/((?<=filename=")(.*)(?="))/) : null; @@ -83,7 +91,7 @@ class MessageMedia { data = btoa(data); } - return { data, mime, name }; + return { data, mime, name, size }; } const res = options.client @@ -96,7 +104,7 @@ class MessageMedia { if (!mimetype) mimetype = res.mime; - return new MessageMedia(mimetype, res.data, filename); + return new MessageMedia(mimetype, res.data, filename, res.size || null); } } From fd368361df9627d48d3046fd712c7f6330d53476 Mon Sep 17 00:00:00 2001 From: Jeremy Andes <73316325+jeremyandes@users.noreply.github.com> Date: Tue, 9 Aug 2022 12:30:56 -0300 Subject: [PATCH 056/430] Fix: Cannot read properties of undefined (reading 'id') (#1604) This change fix `react` evaluation: ``` Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'id') at Object. (https://web.whatsapp.com/bootstrap_main.44dc3fdf06d9bb8b053d.js:2:103021) at Generator.next () at t (https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66483) at s (https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66694) at https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66753 at Y (https://web.whatsapp.com/bootstrap_qr.f74b98c729dd38392a5f.js:37:128505) at new y (https://web.whatsapp.com/bootstrap_qr.f74b98c729dd38392a5f.js:37:121072) at Object. (https://web.whatsapp.com/vendor1~bootstrap_qr.5922e52928d864c0918c.js:2:66634) at Object.k (https://web.whatsapp.com/bootstrap_main.44dc3fdf06d9bb8b053d.js:2:105511) at Object.t.sendReactionToMsg (https://web.whatsapp.com/bootstrap_main.44dc3fdf06d9bb8b053d.js:2:102647) at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Message.react (/app/node_modules/whatsapp-web.js/src/structures/Message.js:344:9) ``` Co-authored-by: Rajeh Taher --- src/structures/Message.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/structures/Message.js b/src/structures/Message.js index 899241ba21e..7c1d3d0550d 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -342,6 +342,8 @@ class Message extends Base { */ async react(reaction){ await this.client.pupPage.evaluate(async (messageId, reaction) => { + if (!messageId) { return undefined; } + const msg = await window.Store.Msg.get(messageId); await window.Store.sendReactionToMsg(msg, reaction); }, this.id._serialized, reaction); From f2ec77f969c03b8d3f21d3bbb19f04320747b4ed Mon Sep 17 00:00:00 2001 From: Wictor Nogueira <57378387+wictornogueira@users.noreply.github.com> Date: Tue, 9 Aug 2022 12:09:16 -0700 Subject: [PATCH 057/430] Feat: add message_reaction event (#1619) * Add 'message_reaction' event --- index.d.ts | 19 +++++++++++ src/Client.js | 39 ++++++++++++++++++++- src/structures/Reaction.js | 69 ++++++++++++++++++++++++++++++++++++++ src/structures/index.js | 1 + src/util/Constants.js | 1 + src/util/Injected.js | 1 + 6 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 src/structures/Reaction.js diff --git a/index.d.ts b/index.d.ts index eabafb75ec1..710d4046a3a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -241,6 +241,12 @@ declare namespace WAWebJS { message: Message ) => void): this + /** Emitted when a reaction is sent, received, updated or removed */ + on(event: 'message_reaction', listener: ( + /** The reaction object */ + reaction: Reaction + ) => void): this + /** Emitted when loading screen is appearing */ on(event: 'loading_screen', listener: (percent: string, message: string) => void): this @@ -1307,6 +1313,19 @@ declare namespace WAWebJS { constructor(body: string, buttons: Array<{ id?: string; body: string }>, title?: string | null, footer?: string | null) } + + /** Message type Reaction */ + export class Reaction { + id: MessageId + orphan: number + orphanReason?: string + timestamp: number + reaction: string + read: boolean + msgId: MessageId + senderId: string + ack?: number + } } export = WAWebJS diff --git a/src/Client.js b/src/Client.js index 01d95272138..2368ef29601 100644 --- a/src/Client.js +++ b/src/Client.js @@ -10,7 +10,7 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./util/Constan const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List} = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction } = require('./structures'); const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); const NoAuth = require('./authStrategies/NoAuth'); @@ -485,6 +485,27 @@ class Client extends EventEmitter { this.emit(Events.INCOMING_CALL, cll); }); + await page.exposeFunction('onReaction', (reactions) => { + for (const reaction of reactions) { + /** + * Emitted when a reaction is sent, received, updated or removed + * @event Client#message_reaction + * @param {object} reaction + * @param {object} reaction.id - Reaction id + * @param {number} reaction.orphan - Orphan + * @param {?string} reaction.orphanReason - Orphan reason + * @param {number} reaction.timestamp - Timestamp + * @param {string} reaction.reaction - Reaction + * @param {boolean} reaction.read - Read + * @param {object} reaction.msgId - Parent message id + * @param {string} reaction.senderId - Sender id + * @param {?number} reaction.ack - Ack + */ + + this.emit(Events.MESSAGE_REACTION, new Reaction(this, reaction)); + } + }); + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); @@ -504,6 +525,22 @@ class Client extends EventEmitter { } } }); + + { + const module = window.Store.createOrUpdateReactionsModule; + const ogMethod = module.createOrUpdateReactions; + module.createOrUpdateReactions = ((...args) => { + window.onReaction(args[0].map(reaction => { + const msgKey = window.Store.MsgKey.fromString(reaction.msgKey); + const parentMsgKey = window.Store.MsgKey.fromString(reaction.parentMsgKey); + const timestamp = reaction.timestamp / 1000; + + return {...reaction, msgKey, parentMsgKey, timestamp }; + })); + + return ogMethod(...args); + }).bind(module); + } }); /** diff --git a/src/structures/Reaction.js b/src/structures/Reaction.js new file mode 100644 index 00000000000..bb30881ad3c --- /dev/null +++ b/src/structures/Reaction.js @@ -0,0 +1,69 @@ +'use strict'; + +const Base = require('./Base'); + +/** + * Represents a Reaction on WhatsApp + * @extends {Base} + */ +class Reaction extends Base { + constructor(client, data) { + super(client); + + if (data) this._patch(data); + } + + _patch(data) { + /** + * Reaction ID + * @type {object} + */ + this.id = data.msgKey; + /** + * Orphan + * @type {number} + */ + this.orphan = data.orphan; + /** + * Orphan reason + * @type {?string} + */ + this.orphanReason = data.orphanReason; + /** + * Unix timestamp for when the reaction was created + * @type {number} + */ + this.timestamp = data.timestamp; + /** + * Reaction + * @type {string} + */ + this.reaction = data.reactionText; + /** + * Read + * @type {boolean} + */ + this.read = data.read; + /** + * Message ID + * @type {object} + */ + this.msgId = data.parentMsgKey; + /** + * Sender ID + * @type {string} + */ + this.senderId = data.senderUserJid; + /** + * ACK + * @type {?number} + */ + this.ack = data.ack; + + + return super._patch(data); + } + +} + +module.exports = Reaction; \ No newline at end of file diff --git a/src/structures/index.js b/src/structures/index.js index fc5b212c4c7..ec449f0d80e 100644 --- a/src/structures/index.js +++ b/src/structures/index.js @@ -18,4 +18,5 @@ module.exports = { Buttons: require('./Buttons'), List: require('./List'), Payment: require('./Payment'), + Reaction: require('./Reaction'), }; diff --git a/src/util/Constants.js b/src/util/Constants.js index 009ae5e0728..a85b8d84559 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -41,6 +41,7 @@ exports.Events = { MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', MESSAGE_REVOKED_ME: 'message_revoke_me', MESSAGE_ACK: 'message_ack', + MESSAGE_REACTION: 'message_reaction', MEDIA_UPLOADED: 'media_uploaded', GROUP_JOIN: 'group_join', GROUP_LEAVE: 'group_leave', diff --git a/src/util/Injected.js b/src/util/Injected.js index 7eea75260e9..a5eeae3e6c6 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -50,6 +50,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0]; window.Store.ConversationMsgs = window.mR.findModule('loadEarlierMsgs')[0]; window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg; + window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0]; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], ...window.mR.findModule('addWebpMetadata')[0] From 76f7a6e279b2a08b4254a547b6cf09b58c232589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BC=BA=20L=E1=B4=87G=CC=B8=E1=B4=87=C9=B4D=20=E0=BC=BB?= <39593002+jtourisNS@users.noreply.github.com> Date: Wed, 10 Aug 2022 08:03:07 -0300 Subject: [PATCH 058/430] feat: RemoteAuth Strategy (#1450) * index.js * [authReady] - new BaseAuthStrategy function * [RemoteAuth] - new Class RemoteAuth added * Eslint Fixes * Eslint Fixes * Added types for RemoteAuth (mostly assumed types from PR message and src/authStrategies/RemoteAuth.js) * [dependency updates] - added unzipper & archiver * [Types] - Fixing typescript declarations * Renaming Base Class Hook * auth hook rename on client * [Error Handling] - Delegate responsability to end users * [Refactor] - deletemetadata code refactor * [Refactor] - backupSyncIntervalMs renamed * [Refactor] - Minor improvement on deleteMetadata * [Refactor] - backupSyncIntervalMs rename on index.d.ts * [Update] - Fix for Ubuntu crahsing on extractSession * [Update] - Delegate responsability to stores of making sure the previous session is deleted strictly only after the new one is saved * [Update] - Improve file paths handling & naming (reduce assumptions between RemoteAuth and stores) * [Update] - Adding new event on Constants.js * [Update] - Adding new authHooks & * [Update] - Adding & hooks on Client.js * [Update] - Adding new features to index.d.ts * [RemoteAuth] - New Features added to RemoteAuth Class * [dependency updates] - added fs-extra * [Cross Platform] - Windows is now compatible with RemoteAuth * [optionalDependencies] - moved archiver, fs-extra & unzipper to optional dependencies on package.json * [optionalDependencies] - adding validation for when optional dependencies are missing * [Update] - Node Deprecation warining for rmdir changed for rm instead Co-authored-by: h110m --- index.d.ts | 31 ++++ index.js | 1 + package.json | 5 + src/Client.js | 6 +- src/authStrategies/BaseAuthStrategy.js | 3 + src/authStrategies/RemoteAuth.js | 201 +++++++++++++++++++++++++ src/util/Constants.js | 3 +- 7 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 src/authStrategies/RemoteAuth.js diff --git a/index.d.ts b/index.d.ts index 710d4046a3a..a99c508d869 100644 --- a/index.d.ts +++ b/index.d.ts @@ -265,6 +265,9 @@ declare namespace WAWebJS { /** Emitted when the client has initialized and is ready to receive messages */ on(event: 'ready', listener: () => void): this + + /** Emitted when the RemoteAuth session is saved successfully on the external Database */ + on(event: 'remote_session_saved', listener: () => void): this } /** Current connection information */ @@ -354,6 +357,9 @@ declare namespace WAWebJS { failureEventPayload?: any }>; getAuthEventPayload: () => Promise; + afterAuthReady: () => Promise; + disconnect: () => Promise; + destroy: () => Promise; logout: () => Promise; } @@ -374,6 +380,30 @@ declare namespace WAWebJS { dataPath?: string }) } + + /** + * Remote-based authentication + */ + export class RemoteAuth extends AuthStrategy { + public clientId?: string; + public dataPath?: string; + constructor(options?: { + store: Store, + clientId?: string, + dataPath?: string, + backupSyncIntervalMs: number + }) + } + + /** + * Remote store interface + */ + export interface Store { + sessionExists: ({session: string}) => Promise | boolean, + delete: ({session: string}) => Promise | any, + save: ({session: string}) => Promise | any, + extract: ({session: string, path: string}) => Promise | any, + } /** * Legacy session auth strategy @@ -476,6 +506,7 @@ declare namespace WAWebJS { DISCONNECTED = 'disconnected', STATE_CHANGED = 'change_state', BATTERY_CHANGED = 'change_battery', + REMOTE_SESSION_SAVED = 'remote_session_saved' } /** Group notification types */ diff --git a/index.js b/index.js index 5a149e4588f..b498064088d 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,7 @@ module.exports = { // Auth Strategies NoAuth: require('./src/authStrategies/NoAuth'), LocalAuth: require('./src/authStrategies/LocalAuth'), + RemoteAuth: require('./src/authStrategies/RemoteAuth'), LegacySessionAuth: require('./src/authStrategies/LegacySessionAuth'), ...Constants diff --git a/package.json b/package.json index e33dfe4cec2..13f41c0a353 100644 --- a/package.json +++ b/package.json @@ -51,5 +51,10 @@ }, "engines": { "node": ">=12.0.0" + }, + "optionalDependencies": { + "archiver": "^5.3.1", + "fs-extra": "^10.1.0", + "unzipper": "^0.10.11" } } diff --git a/src/Client.js b/src/Client.js index 2368ef29601..b36eb9613c4 100644 --- a/src/Client.js +++ b/src/Client.js @@ -419,7 +419,7 @@ class Client extends EventEmitter { this.emit(Events.MEDIA_UPLOADED, message); }); - await page.exposeFunction('onAppStateChangedEvent', (state) => { + await page.exposeFunction('onAppStateChangedEvent', async (state) => { /** * Emitted when the connection state changes @@ -446,6 +446,7 @@ class Client extends EventEmitter { * @event Client#disconnected * @param {WAState|"NAVIGATION"} reason reason that caused the disconnect */ + await this.authStrategy.disconnect(); this.emit(Events.DISCONNECTED, state); this.destroy(); } @@ -548,11 +549,13 @@ class Client extends EventEmitter { * @event Client#ready */ this.emit(Events.READY); + this.authStrategy.afterAuthReady(); // Disconnect when navigating away when in PAIRING state (detect logout) this.pupPage.on('framenavigated', async () => { const appState = await this.getState(); if(!appState || appState === WAState.PAIRING) { + await this.authStrategy.disconnect(); this.emit(Events.DISCONNECTED, 'NAVIGATION'); await this.destroy(); } @@ -564,6 +567,7 @@ class Client extends EventEmitter { */ async destroy() { await this.pupBrowser.close(); + await this.authStrategy.destroy(); } /** diff --git a/src/authStrategies/BaseAuthStrategy.js b/src/authStrategies/BaseAuthStrategy.js index 0c7a7c9d0b0..03440261c16 100644 --- a/src/authStrategies/BaseAuthStrategy.js +++ b/src/authStrategies/BaseAuthStrategy.js @@ -18,6 +18,9 @@ class BaseAuthStrategy { }; } async getAuthEventPayload() {} + async afterAuthReady() {} + async disconnect() {} + async destroy() {} async logout() {} } diff --git a/src/authStrategies/RemoteAuth.js b/src/authStrategies/RemoteAuth.js new file mode 100644 index 00000000000..1645ccd7eaf --- /dev/null +++ b/src/authStrategies/RemoteAuth.js @@ -0,0 +1,201 @@ +'use strict'; + +/* Require Optional Dependencies */ +try { + var fs = require('fs-extra'); + var unzipper = require('unzipper'); + var archiver = require('archiver'); +} catch { + throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag'); +} + +const path = require('path'); +const { Events } = require('./../util/Constants'); +const BaseAuthStrategy = require('./BaseAuthStrategy'); + +/** + * Remote-based authentication + * @param {object} options - options + * @param {object} options.store - Remote database store instance + * @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance + * @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/" + * @param {number} options.backupSyncIntervalMs - Sets the time interval for periodic session backups. Accepts values starting from 60000ms {1 minute} + */ +class RemoteAuth extends BaseAuthStrategy { + constructor({ clientId, dataPath, store, backupSyncIntervalMs } = {}) { + super(); + + const idRegex = /^[-_\w]+$/i; + if (clientId && !idRegex.test(clientId)) { + throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.'); + } + if (!backupSyncIntervalMs || backupSyncIntervalMs < 60000) { + throw new Error('Invalid backupSyncIntervalMs. Accepts values starting from 60000ms {1 minute}.'); + } + if(!store) throw new Error('Remote database store is required.'); + + this.store = store; + this.clientId = clientId; + this.backupSyncIntervalMs = backupSyncIntervalMs; + this.dataPath = path.resolve(dataPath || './.wwebjs_auth/'); + this.tempDir = `${this.dataPath}/wwebjs_temp_session`; + this.requiredDirs = ['Default', 'IndexedDB', 'Local Storage']; /* => Required Files & Dirs in WWebJS to restore session */ + } + + async beforeBrowserInitialized() { + const puppeteerOpts = this.client.options.puppeteer; + const sessionDirName = this.clientId ? `RemoteAuth-${this.clientId}` : 'RemoteAuth'; + const dirPath = path.join(this.dataPath, sessionDirName); + + if (puppeteerOpts.userDataDir && puppeteerOpts.userDataDir !== dirPath) { + throw new Error('RemoteAuth is not compatible with a user-supplied userDataDir.'); + } + + this.userDataDir = dirPath; + this.sessionName = sessionDirName; + + await this.extractRemoteSession(); + + this.client.options.puppeteer = { + ...puppeteerOpts, + userDataDir: dirPath + }; + } + + async logout() { + await this.disconnect(); + } + + async destroy() { + clearInterval(this.backupSync); + } + + async disconnect() { + await this.deleteRemoteSession(); + + let pathExists = await this.isValidPath(this.userDataDir); + if (pathExists) { + await fs.promises.rm(this.userDataDir, { + recursive: true, + force: true + }).catch(() => {}); + } + clearInterval(this.backupSync); + } + + async afterAuthReady() { + const sessionExists = await this.store.sessionExists({session: this.sessionName}); + if(!sessionExists) { + await this.delay(60000); /* Initial delay sync required for session to be stable enough to recover */ + await this.storeRemoteSession({emit: true}); + } + var self = this; + this.backupSync = setInterval(async function () { + await self.storeRemoteSession(); + }, this.backupSyncIntervalMs); + } + + async storeRemoteSession(options) { + /* Compress & Store Session */ + const pathExists = await this.isValidPath(this.userDataDir); + if (pathExists) { + await this.compressSession(); + await this.store.save({session: this.sessionName}); + await fs.promises.unlink(`${this.sessionName}.zip`); + await fs.promises.rm(`${this.tempDir}`, { + recursive: true, + force: true + }).catch(() => {}); + if(options && options.emit) this.client.emit(Events.REMOTE_SESSION_SAVED); + } + } + + async extractRemoteSession() { + const pathExists = await this.isValidPath(this.userDataDir); + const compressedSessionPath = `${this.sessionName}.zip`; + const sessionExists = await this.store.sessionExists({session: this.sessionName}); + if (pathExists) { + await fs.promises.rm(this.userDataDir, { + recursive: true, + force: true + }).catch(() => {}); + } + if (sessionExists) { + await this.store.extract({session: this.sessionName, path: compressedSessionPath}); + await this.unCompressSession(compressedSessionPath); + } else { + fs.mkdirSync(this.userDataDir, { recursive: true }); + } + } + + async deleteRemoteSession() { + const sessionExists = await this.store.sessionExists({session: this.sessionName}); + if (sessionExists) await this.store.delete({session: this.sessionName}); + } + + async compressSession() { + const archive = archiver('zip'); + const stream = fs.createWriteStream(`${this.sessionName}.zip`); + + await fs.copy(this.userDataDir, this.tempDir).catch(() => {}); + await this.deleteMetadata(); + return new Promise((resolve, reject) => { + archive + .directory(this.tempDir, false) + .on('error', err => reject(err)) + .pipe(stream); + + stream.on('close', () => resolve()); + archive.finalize(); + }); + } + + async unCompressSession(compressedSessionPath) { + var stream = fs.createReadStream(compressedSessionPath); + await new Promise((resolve, reject) => { + stream.pipe(unzipper.Extract({ + path: this.userDataDir + })) + .on('error', err => reject(err)) + .on('finish', () => resolve()); + }); + await fs.promises.unlink(compressedSessionPath); + } + + async deleteMetadata() { + const sessionDirs = [this.tempDir, path.join(this.tempDir, 'Default')]; + for (const dir of sessionDirs) { + const sessionFiles = await fs.promises.readdir(dir); + for (const element of sessionFiles) { + if (!this.requiredDirs.includes(element)) { + const dirElement = path.join(dir, element); + const stats = await fs.promises.lstat(dirElement); + + if (stats.isDirectory()) { + await fs.promises.rm(dirElement, { + recursive: true, + force: true + }); + } else { + await fs.promises.unlink(dirElement); + } + } + } + } + } + + async isValidPath(path) { + try { + await fs.promises.access(path); + return true; + } catch { + return false; + } + } + + async delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } +} + +module.exports = RemoteAuth; \ No newline at end of file diff --git a/src/util/Constants.js b/src/util/Constants.js index a85b8d84559..d062c7a28c9 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -51,7 +51,8 @@ exports.Events = { DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', BATTERY_CHANGED: 'change_battery', - INCOMING_CALL: 'incoming_call' + INCOMING_CALL: 'incoming_call', + REMOTE_SESSION_SAVED: 'remote_session_saved' }; /** From 537e843a49529488b8d735f6c28503dc676c5731 Mon Sep 17 00:00:00 2001 From: jurajmatus Date: Wed, 10 Aug 2022 18:31:04 +0200 Subject: [PATCH 059/430] Async buffer->BASE64 conversion (#1481) * Async buffer->BASE64 conversion * ESLint fixes --- src/structures/Message.js | 2 +- src/util/Injected.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 7c1d3d0550d..dc4acafcdc6 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -410,7 +410,7 @@ class Message extends Base { signal: (new AbortController).signal }); - const data = window.WWebJS.arrayBufferToBase64(decryptedMedia); + const data = await window.WWebJS.arrayBufferToBase64Async(decryptedMedia); return { data, diff --git a/src/util/Injected.js b/src/util/Injected.js index a5eeae3e6c6..b09b27e3046 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -480,6 +480,20 @@ exports.LoadUtils = () => { return window.btoa(binary); }; + window.WWebJS.arrayBufferToBase64Async = (arrayBuffer) => + new Promise((resolve, reject) => { + const blob = new Blob([arrayBuffer], { + type: 'application/octet-stream', + }); + const fileReader = new FileReader(); + fileReader.onload = () => { + const [, data] = fileReader.result.split(','); + resolve(data); + }; + fileReader.onerror = (e) => reject(e); + fileReader.readAsDataURL(blob); + }); + window.WWebJS.getFileHash = async (data) => { let buffer = await data.arrayBuffer(); const hashBuffer = await crypto.subtle.digest('SHA-256', buffer); From ab7ee0eb4f3f93b31220613fe08176450e2b68de Mon Sep 17 00:00:00 2001 From: Yuri <65935022+tuyuribr3@users.noreply.github.com> Date: Wed, 10 Aug 2022 13:46:43 -0300 Subject: [PATCH 060/430] Fixing remote auth optional depencies error (#1640) Co-authored-by: Rajeh Taher --- src/authStrategies/RemoteAuth.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/authStrategies/RemoteAuth.js b/src/authStrategies/RemoteAuth.js index 1645ccd7eaf..5ae85cc951c 100644 --- a/src/authStrategies/RemoteAuth.js +++ b/src/authStrategies/RemoteAuth.js @@ -6,7 +6,9 @@ try { var unzipper = require('unzipper'); var archiver = require('archiver'); } catch { - throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag'); + fs = undefined; + unzipper = undefined; + archiver = undefined; } const path = require('path'); @@ -23,6 +25,7 @@ const BaseAuthStrategy = require('./BaseAuthStrategy'); */ class RemoteAuth extends BaseAuthStrategy { constructor({ clientId, dataPath, store, backupSyncIntervalMs } = {}) { + if (!fs && !unzipper && !archiver) throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag'); super(); const idRegex = /^[-_\w]+$/i; @@ -198,4 +201,4 @@ class RemoteAuth extends BaseAuthStrategy { } } -module.exports = RemoteAuth; \ No newline at end of file +module.exports = RemoteAuth; From b74246d69a0e1d8478c55a45d5cc126c06b4e2f7 Mon Sep 17 00:00:00 2001 From: Roi Greenberg Date: Sun, 14 Aug 2022 18:30:14 +0300 Subject: [PATCH 061/430] Add "fromMe" option to fetchMessages (#1444) --- index.d.ts | 4 ++++ src/structures/Chat.js | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index a99c508d869..edf4684ae72 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1062,6 +1062,10 @@ declare namespace WAWebJS { * Set this to Infinity to load all messages. */ limit?: number + /** + * Return only messages from the bot number or vise versa. To get all messages, leave the option undefined. + */ + fromMe?: boolean } /** diff --git a/src/structures/Chat.js b/src/structures/Chat.js index 6f0f0e21294..241d297d92b 100644 --- a/src/structures/Chat.js +++ b/src/structures/Chat.js @@ -170,13 +170,22 @@ class Chat extends Base { /** * Loads chat messages, sorted from earliest to latest. - * @param {Object} searchOptions Options for searching messages. Right now only limit is supported. + * @param {Object} searchOptions Options for searching messages. Right now only limit and fromMe is supported. * @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages. + * @param {Boolean} [searchOptions.fromMe] Return only messages from the bot number or vise versa. To get all messages, leave the option undefined. * @returns {Promise>} */ async fetchMessages(searchOptions) { let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => { - const msgFilter = m => !m.isNotification; // dont include notification messages + const msgFilter = (m) => { + if (m.isNotification) { + return false; // dont include notification messages + } + if (searchOptions && searchOptions.fromMe && m.id.fromMe !== searchOptions.fromMe) { + return false; + } + return true; + }; const chat = window.Store.Chat.get(chatId); let msgs = chat.msgs.getModelsArray().filter(msgFilter); From c459eca799d93c604713e5d577c399744fa061b4 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Mon, 15 Aug 2022 02:52:17 -0400 Subject: [PATCH 062/430] add release action --- .github/workflows/release.yml | 28 ++++++++++++ tools/publish | 80 +++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100755 tools/publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..3c3d6232014 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: release + +on: + workflow_dispatch: + inputs: + release_type: + description: "`alpha`, `alpha-minor`, `alpha-major` release?" + required: true + default: "alpha" + +jobs: + release: + runs-on: ubuntu-latest + if: ${{ github.repository == 'pedroslopez/whatsapp-web.js' }} + steps: + - uses: actions/checkout@v2 + - name: Bump version and publish to NPM + id: publish + run: ./tools/publish ${{ github.event.inputs.release_type }} + env: + NPM_TOKEN: ${{ secrets.RELEASE_NPM_TOKEN }} + - name: Create GitHub Release + id: create_release + uses: ncipollo/release-action@v1 + with: + prerelease: ${{ steps.publish.outputs.PRERELEASE }} + generateReleaseNotes: true + tag: v${{ steps.publish.outputs.NEW_VERSION }} \ No newline at end of file diff --git a/tools/publish b/tools/publish new file mode 100755 index 00000000000..80a2670958c --- /dev/null +++ b/tools/publish @@ -0,0 +1,80 @@ +#!/bin/bash + +cd "$(dirname "$0")" +cd '..' + +BRANCH=`git rev-parse --abbrev-ref HEAD` +RELEASE_MODE=$1 + +echo "" +echo "-----> CHECK INPUTS" +echo "" + +if [[ "$RELEASE_MODE" == "alpha" ]] +then + PRERELEASE='true' + VERSION_ARGS='prerelease --preid alpha -m "chore: prerelease v%s"' + DIST_TAG="next" +elif [[ "$RELEASE_MODE" == "alpha-minor" ]] +then + PRERELEASE='true' + VERSION_ARGS='preminor --preid alpha -m "chore: prerelease v%s"' + DIST_TAG="next" +elif [[ "$RELEASE_MODE" == "alpha-major" ]] +then + PRERELEASE='true' + VERSION_ARGS='premajor --preid alpha -m "chore: prerelease v%s"' + DIST_TAG="next" +else + echo 'Release Mode required' + exit 1 +fi + +if [ -f ~/.npmrc ]; then + echo "Found existing .npmrc" +else + if [[ -z "$NPM_TOKEN" ]];then + echo "No NPM_TOKEN or ~/.npmrc, exiting.." + exit 1; + else + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + fi +fi +echo "Publishing as NPM user: `npm whoami`" + +if [[ $BRANCH != 'main' ]]; then + echo "Not on 'main' branch. Exiting" + exit 1 +fi + +if [[ -n $(git status -s) ]]; then + echo "There are uncommitted changes on this branch. Exiting" + exit 1 +fi + +echo "" +echo "-----> BUMP VERSION" +echo "" + +npm version $VERSION_ARGS || exit 1 +git push && git push --tags + +NEW_VERSION=`cat package.json | jq -r .version` +echo "New Version: $NEW_VERSION" + +echo "" +echo "-----> PUSH TO NPM" +echo "" + +npm publish --tag $DIST_TAG + + +echo "" +echo "-----> Done!" +echo "Version $NEW_VERSION published to $DIST_TAG tag" +echo "" + +echo "::set-output name=NEW_VERSION::$NEW_VERSION" +echo "::set-output name=PRERELEASE::$PRELEASE" + +exit 0 \ No newline at end of file From 694a52bf26525a2f31d8766bfbed23ca00644c67 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Mon, 15 Aug 2022 03:22:43 -0400 Subject: [PATCH 063/430] fix(publish): ouput, remove message --- tools/publish | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/publish b/tools/publish index 80a2670958c..2989fafa2b0 100755 --- a/tools/publish +++ b/tools/publish @@ -13,17 +13,17 @@ echo "" if [[ "$RELEASE_MODE" == "alpha" ]] then PRERELEASE='true' - VERSION_ARGS='prerelease --preid alpha -m "chore: prerelease v%s"' + VERSION_ARGS="prerelease --preid alpha" DIST_TAG="next" elif [[ "$RELEASE_MODE" == "alpha-minor" ]] then PRERELEASE='true' - VERSION_ARGS='preminor --preid alpha -m "chore: prerelease v%s"' + VERSION_ARGS="preminor --preid alpha" DIST_TAG="next" elif [[ "$RELEASE_MODE" == "alpha-major" ]] then PRERELEASE='true' - VERSION_ARGS='premajor --preid alpha -m "chore: prerelease v%s"' + VERSION_ARGS="premajor --preid alpha" DIST_TAG="next" else echo 'Release Mode required' @@ -48,7 +48,7 @@ if [[ $BRANCH != 'main' ]]; then fi if [[ -n $(git status -s) ]]; then - echo "There are uncommitted changes on this branch. Exiting" + echo "There are uncommitted changes on this branch. Exiting..." exit 1 fi @@ -75,6 +75,6 @@ echo "Version $NEW_VERSION published to $DIST_TAG tag" echo "" echo "::set-output name=NEW_VERSION::$NEW_VERSION" -echo "::set-output name=PRERELEASE::$PRELEASE" +echo "::set-output name=PRERELEASE::$PRERELEASE" exit 0 \ No newline at end of file From bb09bb74e7aaae72380014fe865b1210c48a2a4f Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Mon, 15 Aug 2022 03:32:40 -0400 Subject: [PATCH 064/430] fix(publish): add git user --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c3d6232014..89299c67037 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,8 @@ jobs: if: ${{ github.repository == 'pedroslopez/whatsapp-web.js' }} steps: - uses: actions/checkout@v2 + - run: git config --global user.email "hello@wwebjs.dev" + - run: git config --global user.name "WWebJS Bot" - name: Bump version and publish to NPM id: publish run: ./tools/publish ${{ github.event.inputs.release_type }} @@ -25,4 +27,4 @@ jobs: with: prerelease: ${{ steps.publish.outputs.PRERELEASE }} generateReleaseNotes: true - tag: v${{ steps.publish.outputs.NEW_VERSION }} \ No newline at end of file + tag: v${{ steps.publish.outputs.NEW_VERSION }} From c09a22c53360aecf74d12eb5ab9c412739050534 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Mon, 15 Aug 2022 03:42:06 -0400 Subject: [PATCH 065/430] fix(publish): exit if pushing to github failed --- tools/publish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/publish b/tools/publish index 2989fafa2b0..c3a6a974058 100755 --- a/tools/publish +++ b/tools/publish @@ -57,7 +57,7 @@ echo "-----> BUMP VERSION" echo "" npm version $VERSION_ARGS || exit 1 -git push && git push --tags +git push && git push --tags || exit 1 NEW_VERSION=`cat package.json | jq -r .version` echo "New Version: $NEW_VERSION" @@ -77,4 +77,4 @@ echo "" echo "::set-output name=NEW_VERSION::$NEW_VERSION" echo "::set-output name=PRERELEASE::$PRERELEASE" -exit 0 \ No newline at end of file +exit 0 From 09a81d0e1e98abd1c62c3a03bd1e814cedf7924b Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Mon, 15 Aug 2022 03:47:51 -0400 Subject: [PATCH 066/430] v1.18.0-alpha.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13f41c0a353..2d155229a9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.17.1", + "version": "1.18.0-alpha.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 7fe35747308fad980e6dc5b42149e1802d4ab991 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Mon, 15 Aug 2022 03:53:57 -0400 Subject: [PATCH 067/430] fix(release): try setting PAT to push to main --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89299c67037..a5e1d3d52eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,8 @@ jobs: if: ${{ github.repository == 'pedroslopez/whatsapp-web.js' }} steps: - uses: actions/checkout@v2 + with: + token: ${{ secrets.RELEASE_GITHUB_TOKEN }} - run: git config --global user.email "hello@wwebjs.dev" - run: git config --global user.name "WWebJS Bot" - name: Bump version and publish to NPM From bd4df4cf75cbe0fdc91c28f8b85cc6be524826b6 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Mon, 15 Aug 2022 07:54:39 +0000 Subject: [PATCH 068/430] 1.18.0-alpha.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d155229a9d..46ce3391c98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.0-alpha.0", + "version": "1.18.0-alpha.1", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 705d4d31fdbfcfdc4a1f997c2864ce23176419ef Mon Sep 17 00:00:00 2001 From: Shir Serlui <70711723+shirser121@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:20:30 +0300 Subject: [PATCH 069/430] Use getCommonGroups not contact (#1623) --- src/Client.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index b36eb9613c4..d3c9bb42df7 100644 --- a/src/Client.js +++ b/src/Client.js @@ -989,7 +989,13 @@ class Client extends EventEmitter { */ async getCommonGroups(contactId) { const commonGroups = await this.pupPage.evaluate(async (contactId) => { - const contact = window.Store.Contact.get(contactId); + let contact = window.Store.Contact.get(contactId); + if (!contact) { + const wid = window.Store.WidFactory.createUserWid(contactId); + const chatConstructor = window.Store.Contact.getModelsArray().find(c=>!c.isGroup).constructor; + contact = new chatConstructor({id: wid}); + } + if (contact.commonGroups) { return contact.commonGroups.serialize(); } From 62623347e8bcb23ba62ea43d36048b77cee10821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BC=BA=20L=E1=B4=87G=CC=B8=E1=B4=87=C9=B4D=20=E0=BC=BB?= <39593002+jtourisNS@users.noreply.github.com> Date: Thu, 18 Aug 2022 14:26:46 -0300 Subject: [PATCH 070/430] [Update] - adding catch block on promise for windows error (#1659) --- src/authStrategies/RemoteAuth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/authStrategies/RemoteAuth.js b/src/authStrategies/RemoteAuth.js index 5ae85cc951c..f84ba595c34 100644 --- a/src/authStrategies/RemoteAuth.js +++ b/src/authStrategies/RemoteAuth.js @@ -178,9 +178,9 @@ class RemoteAuth extends BaseAuthStrategy { await fs.promises.rm(dirElement, { recursive: true, force: true - }); + }).catch(() => {}); } else { - await fs.promises.unlink(dirElement); + await fs.promises.unlink(dirElement).catch(() => {}); } } } From b1e0fce5048c51a1c15b20d0e03845190d04d971 Mon Sep 17 00:00:00 2001 From: blox <73058244+soudblox@users.noreply.github.com> Date: Mon, 19 Sep 2022 02:33:43 +0700 Subject: [PATCH 071/430] Allow the deletion of others' messages (#1688) --- src/structures/Message.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index dc4acafcdc6..e8260dd264c 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -430,14 +430,14 @@ class Message extends Base { /** * Deletes a message from the chat - * @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat. + * @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) => { let msg = window.Store.Msg.get(msgId); - if (everyone && msg.id.fromMe && msg._canRevoke()) { - return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], {type: 'Sender'}); + if (everyone && msg._canRevoke()) { + return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' }); } return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true); From 55f75b8f69eaf2bd2b35c634cd6ffc29956297b8 Mon Sep 17 00:00:00 2001 From: stefanfuchs Date: Tue, 4 Oct 2022 09:24:03 -0300 Subject: [PATCH 072/430] fix: typescript compilation (#1693) Co-authored-by: Rajeh Taher --- index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index edf4684ae72..76ac2644555 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'events' import { RequestInit } from 'node-fetch' -import puppeteer from 'puppeteer' +import * as puppeteer from 'puppeteer' declare namespace WAWebJS { @@ -399,10 +399,10 @@ declare namespace WAWebJS { * Remote store interface */ export interface Store { - sessionExists: ({session: string}) => Promise | boolean, - delete: ({session: string}) => Promise | any, - save: ({session: string}) => Promise | any, - extract: ({session: string, path: string}) => Promise | any, + sessionExists: (options: { session: string }) => Promise | boolean, + delete: (options: { session: string }) => Promise | any, + save: (options: { session: string }) => Promise | any, + extract: (options: { session: string, path: string }) => Promise | any, } /** From 45972fb47e7932a71945f1e1d05b7ee8300da8c5 Mon Sep 17 00:00:00 2001 From: tuyuribr <45042245+tuyuribr@users.noreply.github.com> Date: Mon, 10 Oct 2022 17:45:48 -0300 Subject: [PATCH 073/430] Create pull_request_template (#1632) Any Ideas on how to improve this template? https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository Co-authored-by: Rajeh Taher Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com> --- .github/pull_request_template.md | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..ad41c055da0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,41 @@ +# PR Details + + + +## Description + + + +## Related Issue + + + + +## Motivation and Context + + + + +## How Has This Been Tested + + + + +## Types of changes + + + +- [ ] Dependency change +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist + + + +- [ ] My code follows the code style of this project. +- [ ] I have updated the documentation accordingly (index.d.ts). + + + From 36aa37f1ac94ee07368fc6e1e39cb568772c7af9 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Fri, 21 Oct 2022 00:12:02 -0400 Subject: [PATCH 074/430] fix: set ephemeral fields and get links from messages (#1752) * fix setting ephemeral fields * fix missing links method --- src/util/Injected.js | 11 ++++------- tests/client.js | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index b09b27e3046..b1ae286ef1d 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -51,6 +51,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.ConversationMsgs = window.mR.findModule('loadEarlierMsgs')[0]; window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg; window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0]; + window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0]; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], ...window.mR.findModule('addWebpMetadata')[0] @@ -227,11 +228,7 @@ exports.LoadUtils = () => { const extraOptions = options.extraOptions || {}; delete options.extraOptions; - const ephemeralSettings = { - ephemeralDuration: chat.isEphemeralSettingOn() ? chat.getEphemeralSetting() : undefined, - ephemeralSettingTimestamp: chat.getEphemeralSettingTimestamp() || undefined, - disappearingModeInitiator: chat.getDisappearingModeInitiator() || undefined, - }; + const ephemeralFields = window.Store.EphemeralFields.getEphemeralFields(chat); const message = { ...options, @@ -245,7 +242,7 @@ exports.LoadUtils = () => { t: parseInt(new Date().getTime() / 1000), isNewMsg: true, type: 'chat', - ...ephemeralSettings, + ...ephemeralFields, ...locationOptions, ...attOptions, ...quotedMsgOptions, @@ -366,7 +363,7 @@ exports.LoadUtils = () => { msg.isEphemeral = message.isEphemeral; msg.isStatusV3 = message.isStatusV3; - msg.links = (message.getLinks()).map(link => ({ + msg.links = (message.getRawLinks()).map(link => ({ link: link.href, isSuspicious: Boolean(link.suspiciousCharacters && link.suspiciousCharacters.size) })); diff --git a/tests/client.js b/tests/client.js index 233590524ce..55f5334c1c7 100644 --- a/tests/client.js +++ b/tests/client.js @@ -313,6 +313,7 @@ describe('Client', function() { 'Conn', 'Contact', 'DownloadManager', + 'EphemeralFields', 'Features', 'GroupMetadata', 'GroupParticipants', From ab87fecfd993d8252da1dba55568a77744bd8b82 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 21 Oct 2022 00:22:56 -0400 Subject: [PATCH 075/430] Update supported WhatsApp Web version to v2.2240.7 (#1592) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cda4a29e6fc..89ff5e54300 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2224.8](https://img.shields.io/badge/WhatsApp_Web-2.2224.8-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2240.7](https://img.shields.io/badge/WhatsApp_Web-2.2240.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 5454cae0124..f3c915135d7 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2224.8 \ No newline at end of file +2.2240.7 \ No newline at end of file From ef3eadc6e5e237316d4154f19a2f25eb5d2cf56f Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Fri, 21 Oct 2022 00:25:57 -0400 Subject: [PATCH 076/430] chore: mark version 1.18.0 --- docs/Base.html | 6 +- docs/BaseAuthStrategy.html | 6 +- docs/BusinessContact.html | 6 +- docs/Buttons.html | 6 +- docs/Call.html | 6 +- docs/Chat.html | 22 +- docs/Client.html | 182 +++++++++++- docs/Client.js.html | 105 ++++++- docs/ClientInfo.html | 6 +- docs/Contact.html | 6 +- docs/GroupChat.html | 22 +- docs/GroupNotification.html | 6 +- docs/InterfaceController.html | 6 +- docs/Label.html | 6 +- docs/LegacySessionAuth.html | 6 +- docs/List.html | 6 +- docs/LocalAuth.html | 6 +- docs/Location.html | 6 +- docs/Message.html | 10 +- docs/MessageMedia.html | 43 ++- docs/NoAuth.html | 6 +- docs/Order.html | 6 +- docs/PrivateChat.html | 22 +- docs/PrivateContact.html | 6 +- docs/Product.html | 6 +- docs/Reaction.html | 159 +++++++++++ docs/RemoteAuth.html | 163 +++++++++++ docs/Util.html | 6 +- docs/authStrategies_BaseAuthStrategy.js.html | 9 +- docs/authStrategies_LegacySessionAuth.js.html | 6 +- docs/authStrategies_LocalAuth.js.html | 6 +- docs/authStrategies_NoAuth.js.html | 6 +- docs/authStrategies_RemoteAuth.js.html | 258 ++++++++++++++++++ docs/global.html | 45 ++- docs/index.html | 158 +++++++++-- docs/scripts/jsdoc-toc.js | 2 +- docs/structures_Base.js.html | 6 +- docs/structures_BusinessContact.js.html | 6 +- docs/structures_Buttons.js.html | 6 +- docs/structures_Call.js.html | 6 +- docs/structures_Chat.js.html | 19 +- docs/structures_ClientInfo.js.html | 6 +- docs/structures_Contact.js.html | 6 +- docs/structures_GroupChat.js.html | 6 +- 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 | 23 +- docs/structures_MessageMedia.js.html | 24 +- docs/structures_Order.js.html | 6 +- docs/structures_Payment.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 | 122 +++++++++ docs/util_Constants.js.html | 13 +- docs/util_InterfaceController.js.html | 6 +- docs/util_Util.js.html | 6 +- package.json | 2 +- 61 files changed, 1433 insertions(+), 216 deletions(-) create mode 100644 docs/Reaction.html create mode 100644 docs/RemoteAuth.html create mode 100644 docs/authStrategies_RemoteAuth.js.html create mode 100644 docs/structures_Reaction.js.html diff --git a/docs/Base.html b/docs/Base.html index 146705d630e..8d659f4e1c1 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Base + whatsapp-web.js 1.18.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index eb1fd0d5fae..f3b466818a2 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: BaseAuthStrategy + whatsapp-web.js 1.18.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 86a7d39824c..f82c6eeebae 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: BusinessContact + whatsapp-web.js 1.18.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index a5269104e50..e5c7e300717 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Buttons + whatsapp-web.js 1.18.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index d6ecec6298a..7c80fc99644 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Call + whatsapp-web.js 1.18.0 » Class: Call @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index a1f3a9a9d2e..eebcf581458 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Chat + whatsapp-web.js 1.18.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -271,7 +271,7 @@

Parameters

 

-

Options for searching messages. Right now only limit is supported.

+

Options for searching messages. Right now only limit and fromMe is supported.

Values in searchOptions have the following properties:

@@ -297,6 +297,20 @@

Parameters

The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.

+ + + + + +
+

fromMe

+
+

Boolean

+
+

Yes

+
+

Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.

+
@@ -483,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 599d86a97cb..24b52a03c0d 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Client + whatsapp-web.js 1.18.0 » Class: Client @@ -15,7 +15,7 @@ @@ -236,6 +236,9 @@

Events

message_create
+
message_reaction
+
+
message_revoke_everyone
@@ -2181,6 +2184,179 @@

Parameter

+

message_reaction

+

Emitted when a reaction is sent, received, updated or removed

+
+

Parameters

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

reaction

+
+

object

+
+

 

+
+

Values in reaction have the following properties:

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

id

+
+

object

+
+

 

+
+

Reaction id

+
+

orphan

+
+

number

+
+

 

+
+

Orphan

+
+

orphanReason

+
+

string

+
+

 

+
+

Orphan reason

+

Value can be null.

+
+

timestamp

+
+

number

+
+

 

+
+

Timestamp

+
+

reaction

+
+

string

+
+

 

+
+

Reaction

+
+

read

+
+

boolean

+
+

 

+
+

Read

+
+

msgId

+
+

object

+
+

 

+
+

Parent message id

+
+

senderId

+
+

string

+
+

 

+
+

Sender id

+
+

ack

+
+

number

+
+

 

+
+

Ack

+

Value can be null.

+
+
+
+
+

message_revoke_everyone

Emitted when a message is deleted for everyone in the chat.

@@ -2310,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 1e5b887f0bc..c39799f9689 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: Client.js + whatsapp-web.js 1.18.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -41,7 +41,7 @@

Source: Client.js

const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List} = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction } = require('./structures'); const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); const NoAuth = require('./authStrategies/NoAuth'); @@ -146,6 +146,52 @@

Source: Client.js

referer: 'https://whatsapp.com/' }); + await page.evaluate(`function getElementByXpath(path) { + return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; + }`); + + let lastPercent = null, + lastPercentMessage = null; + + await page.exposeFunction('loadingScreen', async (percent, message) => { + if (lastPercent !== percent || lastPercentMessage !== message) { + this.emit(Events.LOADING_SCREEN, percent, message); + lastPercent = percent; + lastPercentMessage = message; + } + }); + + await page.evaluate( + async function (selectors) { + var observer = new MutationObserver(function () { + let progressBar = window.getElementByXpath( + selectors.PROGRESS + ); + let progressMessage = window.getElementByXpath( + selectors.PROGRESS_MESSAGE + ); + + if (progressBar) { + window.loadingScreen( + progressBar.value, + progressMessage.innerText + ); + } + }); + + observer.observe(document, { + attributes: true, + childList: true, + characterData: true, + subtree: true, + }); + }, + { + PROGRESS: '//*[@id=\'app\']/div/div/div[2]/progress', + PROGRESS_MESSAGE: '//*[@id=\'app\']/div/div/div[3]', + } + ); + const INTRO_IMG_SELECTOR = '[data-testid="intro-md-beta-logo-dark"], [data-testid="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]'; const INTRO_QRCODE_SELECTOR = 'div[data-ref] canvas'; @@ -404,7 +450,7 @@

Source: Client.js

this.emit(Events.MEDIA_UPLOADED, message); }); - await page.exposeFunction('onAppStateChangedEvent', (state) => { + await page.exposeFunction('onAppStateChangedEvent', async (state) => { /** * Emitted when the connection state changes @@ -431,6 +477,7 @@

Source: Client.js

* @event Client#disconnected * @param {WAState|"NAVIGATION"} reason reason that caused the disconnect */ + await this.authStrategy.disconnect(); this.emit(Events.DISCONNECTED, state); this.destroy(); } @@ -470,6 +517,27 @@

Source: Client.js

this.emit(Events.INCOMING_CALL, cll); }); + await page.exposeFunction('onReaction', (reactions) => { + for (const reaction of reactions) { + /** + * Emitted when a reaction is sent, received, updated or removed + * @event Client#message_reaction + * @param {object} reaction + * @param {object} reaction.id - Reaction id + * @param {number} reaction.orphan - Orphan + * @param {?string} reaction.orphanReason - Orphan reason + * @param {number} reaction.timestamp - Timestamp + * @param {string} reaction.reaction - Reaction + * @param {boolean} reaction.read - Read + * @param {object} reaction.msgId - Parent message id + * @param {string} reaction.senderId - Sender id + * @param {?number} reaction.ack - Ack + */ + + this.emit(Events.MESSAGE_REACTION, new Reaction(this, reaction)); + } + }); + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); @@ -489,6 +557,22 @@

Source: Client.js

} } }); + + { + const module = window.Store.createOrUpdateReactionsModule; + const ogMethod = module.createOrUpdateReactions; + module.createOrUpdateReactions = ((...args) => { + window.onReaction(args[0].map(reaction => { + const msgKey = window.Store.MsgKey.fromString(reaction.msgKey); + const parentMsgKey = window.Store.MsgKey.fromString(reaction.parentMsgKey); + const timestamp = reaction.timestamp / 1000; + + return {...reaction, msgKey, parentMsgKey, timestamp }; + })); + + return ogMethod(...args); + }).bind(module); + } }); /** @@ -496,11 +580,13 @@

Source: Client.js

* @event Client#ready */ this.emit(Events.READY); + this.authStrategy.afterAuthReady(); // Disconnect when navigating away when in PAIRING state (detect logout) this.pupPage.on('framenavigated', async () => { const appState = await this.getState(); if(!appState || appState === WAState.PAIRING) { + await this.authStrategy.disconnect(); this.emit(Events.DISCONNECTED, 'NAVIGATION'); await this.destroy(); } @@ -512,6 +598,7 @@

Source: Client.js

*/ async destroy() { await this.pupBrowser.close(); + await this.authStrategy.destroy(); } /** @@ -933,7 +1020,13 @@

Source: Client.js

*/ async getCommonGroups(contactId) { const commonGroups = await this.pupPage.evaluate(async (contactId) => { - const contact = window.Store.Contact.get(contactId); + let contact = window.Store.Contact.get(contactId); + if (!contact) { + const wid = window.Store.WidFactory.createUserWid(contactId); + const chatConstructor = window.Store.Contact.getModelsArray().find(c=>!c.isGroup).constructor; + contact = new chatConstructor({id: wid}); + } + if (contact.commonGroups) { return contact.commonGroups.serialize(); } @@ -1131,7 +1224,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 0bb31af40a5..064991c8520 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: ClientInfo + whatsapp-web.js 1.18.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index 5988ce31f17..4594061a25f 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Contact + whatsapp-web.js 1.18.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index a54f8dfe8f7..a39e4541388 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: GroupChat + whatsapp-web.js 1.18.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -436,7 +436,7 @@

Parameters

 

-

Options for searching messages. Right now only limit is supported.

+

Options for searching messages. Right now only limit and fromMe is supported.

Values in searchOptions have the following properties:

@@ -462,6 +462,20 @@

Parameters

The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.

+ + + + + +
+

fromMe

+
+

 

+
+

Yes

+
+

Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.

+
@@ -927,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 64aeb49bccc..eb9ce7ce5a4 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: GroupNotification + whatsapp-web.js 1.18.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 5776e72744f..707aee24fb4 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: InterfaceController + whatsapp-web.js 1.18.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index e678cd74dda..ab642e9ca12 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Label + whatsapp-web.js 1.18.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 5455ef32ace..cc1aedbd705 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: LegacySessionAuth + whatsapp-web.js 1.18.0 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index 953b5dcb888..dce13cfe811 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: List + whatsapp-web.js 1.18.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 96ec06c6ab5..dbf9ed26eb5 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: LocalAuth + whatsapp-web.js 1.18.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index a41e833983e..cfb20a0ec1e 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Location + whatsapp-web.js 1.18.0 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index 95fb491fe0e..04e7b38d28f 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Message + whatsapp-web.js 1.18.0 » Class: Message @@ -15,7 +15,7 @@ @@ -400,7 +400,7 @@

Parameter

 

-

If true and the message is sent by the current user, will delete it for everyone in the chat.

+

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.

Value can be null.

@@ -420,7 +420,7 @@

downloadMedia
async

forward(chat) → Promise

-

Forwards this message to another chat

+

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

Parameter

@@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index c2857b5074d..1dc5e9abac2 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: MessageMedia + whatsapp-web.js 1.18.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@

@@ -135,7 +136,22 @@

Parameters

 

+ + + + + + @@ -155,7 +171,12 @@

data

filename  nullable string

-

Name of the file (for documents)

+

Document file name. Value can be null

+
+
+

filesize +  nullable number

+

Document file size in bytes. Value can be null

mimetype @@ -343,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 8ff57ef73c9..688a6ac324e 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: NoAuth + whatsapp-web.js 1.18.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index dde65eebbb9..1cdda968a69 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Order + whatsapp-web.js 1.18.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 3203df9015a..1922966a11b 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: PrivateChat + whatsapp-web.js 1.18.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -295,7 +295,7 @@

Parameters

 

@@ -519,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 35d012f6928..b5257e03ef3 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: PrivateContact + whatsapp-web.js 1.18.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 746dd69623e..3f595d3be09 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Product + whatsapp-web.js 1.18.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html new file mode 100644 index 00000000000..b2914133028 --- /dev/null +++ b/docs/Reaction.html @@ -0,0 +1,159 @@ + + + + + + + whatsapp-web.js 1.18.0 » Class: Reaction + + + + + + + + +
+
+
+
+ +
+
+

Properties

+
+
+
+
ack
+
+
+
id
+
+
+
msgId
+
+
+
+
+
+
+
orphan
+
+
+
orphanReason
+
+
+
reaction
+
+
+
+
+
+
+
read
+
+
+
senderId
+
+
+
timestamp
+
+
+
+
+
+
+
+
+

new Reaction()

+
+
Extends
+
Base
+
+
+
+

Properties

+
+

ack +  nullable number

+

ACK

+
+
+

id +  object

+

Reaction ID

+
+
+

msgId +  object

+

Message ID

+
+
+

orphan +  number

+

Orphan

+
+
+

orphanReason +  nullable string

+

Orphan reason

+
+
+

reaction +  string

+

Reaction

+
+
+

read +  boolean

+

Read

+
+
+

senderId +  string

+

Sender ID

+
+
+

timestamp +  number

+

Unix timestamp for when the reaction was created

+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html new file mode 100644 index 00000000000..9a028bc72dd --- /dev/null +++ b/docs/RemoteAuth.html @@ -0,0 +1,163 @@ + + + + + + + whatsapp-web.js 1.18.0 » Class: RemoteAuth + + + + + + + + +
+
+
+
+ +
+
+
+

new RemoteAuth(options)

+
+

Parameters

+

-

Document file name

+

Document file name. Value can be null

+

Value can be null.

+
+

filesize

+
+

 

+
+

 

+
+

Document file size in bytes. Value can be null

Value can be null.

-

Options for searching messages. Right now only limit is supported.

+

Options for searching messages. Right now only limit and fromMe is supported.

Values in searchOptions have the following properties:

@@ -321,6 +321,20 @@

Parameters

The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.

+ + + + + +
+

fromMe

+
+

 

+
+

Yes

+
+

Return only messages from the bot number or vise versa. To get all messages, leave the option undefined.

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

options

+
+

 

+
+

 

+
+

options

+

Values in options have the following properties:

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

store

+
+

 

+
+

 

+
+

Remote database store instance

+
+

clientId

+
+

 

+
+

 

+
+

Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance

+
+

dataPath

+
+

 

+
+

 

+
+

Change the default path for saving session files, default is: "./.wwebjs_auth/"

+
+

backupSyncIntervalMs

+
+

 

+
+

 

+
+

Sets the time interval for periodic session backups. Accepts values starting from 60000ms {1 minute}

+
+
+
+
+
+

+
+
+

+

+ + + +
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/Util.html b/docs/Util.html index b64b60624f3..86ed99c6b33 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Class: Util + whatsapp-web.js 1.18.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 2bbcd7ffb4d..0912654e36d 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.18.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -49,6 +49,9 @@

Source: authStrategies/BaseAuthStrategy.js

}; } async getAuthEventPayload() {} + async afterAuthReady() {} + async disconnect() {} + async destroy() {} async logout() {} } @@ -62,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 6167ba9a397..344cfbfa5a3 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.18.0 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index ac7832cf9c7..83cf47b3ee2 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.18.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 50349b0f93a..f6ee7a454d7 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.18.0 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html new file mode 100644 index 00000000000..63709bd2d40 --- /dev/null +++ b/docs/authStrategies_RemoteAuth.js.html @@ -0,0 +1,258 @@ + + + + + + + whatsapp-web.js 1.18.0 » Source: authStrategies/RemoteAuth.js + + + + + + + + +
+
+
+ +
+ +
+
'use strict';
+
+/* Require Optional Dependencies */
+try {
+    var fs = require('fs-extra');
+    var unzipper = require('unzipper');
+    var archiver = require('archiver');
+} catch {
+    fs = undefined;
+    unzipper = undefined;
+    archiver = undefined;
+}
+
+const path = require('path');
+const { Events } = require('./../util/Constants');
+const BaseAuthStrategy = require('./BaseAuthStrategy');
+
+/**
+ * Remote-based authentication
+ * @param {object} options - options
+ * @param {object} options.store - Remote database store instance
+ * @param {string} options.clientId - Client id to distinguish instances if you are using multiple, otherwise keep null if you are using only one instance
+ * @param {string} options.dataPath - Change the default path for saving session files, default is: "./.wwebjs_auth/" 
+ * @param {number} options.backupSyncIntervalMs - Sets the time interval for periodic session backups. Accepts values starting from 60000ms {1 minute}
+ */
+class RemoteAuth extends BaseAuthStrategy {
+    constructor({ clientId, dataPath, store, backupSyncIntervalMs } = {}) {
+        if (!fs &amp;&amp; !unzipper &amp;&amp; !archiver) throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag');
+        super();
+
+        const idRegex = /^[-_\w]+$/i;
+        if (clientId &amp;&amp; !idRegex.test(clientId)) {
+            throw new Error('Invalid clientId. Only alphanumeric characters, underscores and hyphens are allowed.');
+        }
+        if (!backupSyncIntervalMs || backupSyncIntervalMs &lt; 60000) {
+            throw new Error('Invalid backupSyncIntervalMs. Accepts values starting from 60000ms {1 minute}.');
+        }
+        if(!store) throw new Error('Remote database store is required.');
+
+        this.store = store;
+        this.clientId = clientId;
+        this.backupSyncIntervalMs = backupSyncIntervalMs;
+        this.dataPath = path.resolve(dataPath || './.wwebjs_auth/');
+        this.tempDir = `${this.dataPath}/wwebjs_temp_session`;
+        this.requiredDirs = ['Default', 'IndexedDB', 'Local Storage']; /* => Required Files &amp; Dirs in WWebJS to restore session */
+    }
+
+    async beforeBrowserInitialized() {
+        const puppeteerOpts = this.client.options.puppeteer;
+        const sessionDirName = this.clientId ? `RemoteAuth-${this.clientId}` : 'RemoteAuth';
+        const dirPath = path.join(this.dataPath, sessionDirName);
+
+        if (puppeteerOpts.userDataDir &amp;&amp; puppeteerOpts.userDataDir !== dirPath) {
+            throw new Error('RemoteAuth is not compatible with a user-supplied userDataDir.');
+        }
+
+        this.userDataDir = dirPath;
+        this.sessionName = sessionDirName;
+
+        await this.extractRemoteSession();
+
+        this.client.options.puppeteer = {
+            ...puppeteerOpts,
+            userDataDir: dirPath
+        };
+    }
+
+    async logout() {
+        await this.disconnect();
+    }
+
+    async destroy() {
+        clearInterval(this.backupSync);
+    }
+
+    async disconnect() {
+        await this.deleteRemoteSession();
+
+        let pathExists = await this.isValidPath(this.userDataDir);
+        if (pathExists) {
+            await fs.promises.rm(this.userDataDir, {
+                recursive: true,
+                force: true
+            }).catch(() => {});
+        }
+        clearInterval(this.backupSync);
+    }
+
+    async afterAuthReady() {
+        const sessionExists = await this.store.sessionExists({session: this.sessionName});
+        if(!sessionExists) {
+            await this.delay(60000); /* Initial delay sync required for session to be stable enough to recover */
+            await this.storeRemoteSession({emit: true});
+        }
+        var self = this;
+        this.backupSync = setInterval(async function () {
+            await self.storeRemoteSession();
+        }, this.backupSyncIntervalMs);
+    }
+
+    async storeRemoteSession(options) {
+        /* Compress &amp; Store Session */
+        const pathExists = await this.isValidPath(this.userDataDir);
+        if (pathExists) {
+            await this.compressSession();
+            await this.store.save({session: this.sessionName});
+            await fs.promises.unlink(`${this.sessionName}.zip`);
+            await fs.promises.rm(`${this.tempDir}`, {
+                recursive: true,
+                force: true
+            }).catch(() => {});
+            if(options &amp;&amp; options.emit) this.client.emit(Events.REMOTE_SESSION_SAVED);
+        }
+    }
+
+    async extractRemoteSession() {
+        const pathExists = await this.isValidPath(this.userDataDir);
+        const compressedSessionPath = `${this.sessionName}.zip`;
+        const sessionExists = await this.store.sessionExists({session: this.sessionName});
+        if (pathExists) {
+            await fs.promises.rm(this.userDataDir, {
+                recursive: true,
+                force: true
+            }).catch(() => {});
+        }
+        if (sessionExists) {
+            await this.store.extract({session: this.sessionName, path: compressedSessionPath});
+            await this.unCompressSession(compressedSessionPath);
+        } else {
+            fs.mkdirSync(this.userDataDir, { recursive: true });
+        }
+    }
+
+    async deleteRemoteSession() {
+        const sessionExists = await this.store.sessionExists({session: this.sessionName});
+        if (sessionExists) await this.store.delete({session: this.sessionName});
+    }
+
+    async compressSession() {
+        const archive = archiver('zip');
+        const stream = fs.createWriteStream(`${this.sessionName}.zip`);
+
+        await fs.copy(this.userDataDir, this.tempDir).catch(() => {});
+        await this.deleteMetadata();
+        return new Promise((resolve, reject) => {
+            archive
+                .directory(this.tempDir, false)
+                .on('error', err => reject(err))
+                .pipe(stream);
+
+            stream.on('close', () => resolve());
+            archive.finalize();
+        });
+    }
+
+    async unCompressSession(compressedSessionPath) {
+        var stream = fs.createReadStream(compressedSessionPath);
+        await new Promise((resolve, reject) => {
+            stream.pipe(unzipper.Extract({
+                path: this.userDataDir
+            }))
+                .on('error', err => reject(err))
+                .on('finish', () => resolve());
+        });
+        await fs.promises.unlink(compressedSessionPath);
+    }
+
+    async deleteMetadata() {
+        const sessionDirs = [this.tempDir, path.join(this.tempDir, 'Default')];
+        for (const dir of sessionDirs) {
+            const sessionFiles = await fs.promises.readdir(dir);
+            for (const element of sessionFiles) {
+                if (!this.requiredDirs.includes(element)) {
+                    const dirElement = path.join(dir, element);
+                    const stats = await fs.promises.lstat(dirElement);
+    
+                    if (stats.isDirectory()) {
+                        await fs.promises.rm(dirElement, {
+                            recursive: true,
+                            force: true
+                        }).catch(() => {});
+                    } else {
+                        await fs.promises.unlink(dirElement).catch(() => {});
+                    }
+                }
+            }
+        }
+    }
+
+    async isValidPath(path) {
+        try {
+            await fs.promises.access(path);
+            return true;
+        } catch {
+            return false;
+        }
+    }
+
+    async delay(ms) {
+        return new Promise(resolve => setTimeout(resolve, ms));
+    }
+}
+
+module.exports = RemoteAuth;
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/global.html b/docs/global.html index d20b79b05f0..89c6ad9c00f 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Globals + whatsapp-web.js 1.18.0 » Globals @@ -15,7 +15,7 @@ @@ -285,6 +285,19 @@

Properties

+ + +

MESSAGE_REACTION

+ + +

 

+ + +

 

+ + + +

MEDIA_UPLOADED

@@ -350,6 +363,19 @@

Properties

+ + +

LOADING_SCREEN

+ + +

 

+ + +

 

+ + + +

DISCONNECTED

@@ -402,6 +428,19 @@

Properties

+ + +

REMOTE_SESSION_SAVED

+ + +

 

+ + +

 

+ + + + @@ -1980,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index caff23885a6..3e2c8fd2f8d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Home + whatsapp-web.js 1.18.0 » Home @@ -15,7 +15,7 @@ @@ -27,11 +27,11 @@
+
+ Client#event:message_revoke_everyone +
+
+
Client#event:message_revoke_me
@@ -911,15 +916,15 @@

Client

+
+
+ -
-
Client#info
@@ -1234,17 +1239,22 @@

Events

+
+ Events.GROUP_UPDATE +
+
+
+
+
+

Reaction

+
+
+
+
+ Reaction() +
+
+
+
+ Reaction#ack +
+
+
+
+ Reaction#id +
+
+
+
+ Reaction#msgId +
+
+
+
+
+
+
+
+ Reaction#orphan +
+
+
+
+ Reaction#orphanReason +
+
+
+
+ Reaction#reaction +
+
+
+
+ Reaction#read +
+
+
+
+
+
+
+
+ Reaction#senderId +
+
+
+
+ Reaction#timestamp +
+
+
+
+
+
+
+
+
+
+

RemoteAuth

+
+
+
+
+ RemoteAuth(options) +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Status

@@ -3158,7 +3276,7 @@

WAState

diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js index 62e7e8f4789..f910b0116bb 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":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","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":"LegacySessionAuth","id":"LegacySessionAuth","children":[]},{"label":"List","id":"List","children":[]},{"label":"LocalAuth","id":"LocalAuth","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":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Util","id":"Util","children":[]}], + data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BaseAuthStrategy","id":"BaseAuthStrategy","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","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":"LegacySessionAuth","id":"LegacySessionAuth","children":[]},{"label":"List","id":"List","children":[]},{"label":"LocalAuth","id":"LocalAuth","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":"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":"Util","id":"Util","children":[]}], openedIcon: ' ⇣', saveState: false, useContextMenu: false diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index b62302b36fa..65d6ae73d40 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Base.js + whatsapp-web.js 1.18.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 1569c3322be..c6740cb2ade 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/BusinessContact.js + whatsapp-web.js 1.18.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index f11871752de..8be1944da67 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Buttons.js + whatsapp-web.js 1.18.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index cfe7007a703..81cb49b1ebd 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Call.js + whatsapp-web.js 1.18.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 09d1986a1c4..5521da65611 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Chat.js + whatsapp-web.js 1.18.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -201,13 +201,22 @@

Source: structures/Chat.js

/** * Loads chat messages, sorted from earliest to latest. - * @param {Object} searchOptions Options for searching messages. Right now only limit is supported. + * @param {Object} searchOptions Options for searching messages. Right now only limit and fromMe is supported. * @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages. + * @param {Boolean} [searchOptions.fromMe] Return only messages from the bot number or vise versa. To get all messages, leave the option undefined. * @returns {Promise&lt;Array&lt;Message>>} */ async fetchMessages(searchOptions) { let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => { - const msgFilter = m => !m.isNotification; // dont include notification messages + const msgFilter = (m) => { + if (m.isNotification) { + return false; // dont include notification messages + } + if (searchOptions &amp;&amp; searchOptions.fromMe &amp;&amp; m.id.fromMe !== searchOptions.fromMe) { + return false; + } + return true; + }; const chat = window.Store.Chat.get(chatId); let msgs = chat.msgs.getModelsArray().filter(msgFilter); @@ -290,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index fe6a7253250..f591d3d37e9 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/ClientInfo.js + whatsapp-web.js 1.18.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 1344f74dcf5..9280f8010f3 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Contact.js + whatsapp-web.js 1.18.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index c0d97defc70..a3043e0c474 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/GroupChat.js + whatsapp-web.js 1.18.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 943eb50c61f..dcc45b4b914 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/GroupNotification.js + whatsapp-web.js 1.18.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 1a28b122a01..8edcac81e3a 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Label.js + whatsapp-web.js 1.18.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 5f66e7af0b5..85ada9e7efe 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/List.js + whatsapp-web.js 1.18.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 1dfb302f4b2..788874f81be 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Location.js + whatsapp-web.js 1.18.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index d937dd51e27..193ada00ee8 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Message.js + whatsapp-web.js 1.18.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -373,6 +373,8 @@

Source: structures/Message.js

*/ async react(reaction){ await this.client.pupPage.evaluate(async (messageId, reaction) => { + if (!messageId) { return undefined; } + const msg = await window.Store.Msg.get(messageId); await window.Store.sendReactionToMsg(msg, reaction); }, this.id._serialized, reaction); @@ -387,7 +389,7 @@

Source: structures/Message.js

} /** - * Forwards this message to another chat + * Forwards this message to another chat (that you chatted before, otherwise it will fail) * * @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded * @returns {Promise} @@ -439,12 +441,13 @@

Source: structures/Message.js

signal: (new AbortController).signal }); - const data = window.WWebJS.arrayBufferToBase64(decryptedMedia); + const data = await window.WWebJS.arrayBufferToBase64Async(decryptedMedia); return { data, mimetype: msg.mimetype, - filename: msg.filename + filename: msg.filename, + filesize: msg.size }; } catch (e) { if(e.status &amp;&amp; e.status === 404) return undefined; @@ -453,19 +456,19 @@

Source: structures/Message.js

}, this.id._serialized); if (!result) return undefined; - return new MessageMedia(result.mimetype, result.data, result.filename); + return new MessageMedia(result.mimetype, result.data, result.filename, result.filesize); } /** * Deletes a message from the chat - * @param {?boolean} everyone If true and the message is sent by the current user, will delete it for everyone in the chat. + * @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) => { let msg = window.Store.Msg.get(msgId); - if (everyone &amp;&amp; msg.id.fromMe &amp;&amp; msg._canRevoke()) { - return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], {type: 'Sender'}); + if (everyone &amp;&amp; msg._canRevoke()) { + return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' }); } return window.Store.Cmd.sendDeleteMsgs(msg.chat, [msg], true); @@ -566,7 +569,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index f1886fa5962..07dc863030c 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/MessageMedia.js + whatsapp-web.js 1.18.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -41,10 +41,11 @@

Source: structures/MessageMedia.js

* Media attached to a message * @param {string} mimetype MIME type of the attachment * @param {string} data Base64-encoded data of the file - * @param {?string} filename Document file name + * @param {?string} filename Document file name. Value can be null + * @param {?number} filesize Document file size in bytes. Value can be null */ class MessageMedia { - constructor(mimetype, data, filename) { + constructor(mimetype, data, filename, filesize) { /** * MIME type of the attachment * @type {string} @@ -58,10 +59,16 @@

Source: structures/MessageMedia.js

this.data = data; /** - * Name of the file (for documents) + * Document file name. Value can be null * @type {?string} */ this.filename = filename; + + /** + * Document file size in bytes. Value can be null + * @type {?number} + */ + this.filesize = filesize; } /** @@ -99,6 +106,7 @@

Source: structures/MessageMedia.js

const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options); const response = await fetch(url, reqOptions); const mime = response.headers.get('Content-Type'); + const size = response.headers.get('Content-Length'); const contentDisposition = response.headers.get('Content-Disposition'); const name = contentDisposition ? contentDisposition.match(/((?&lt;=filename=")(.*)(?="))/) : null; @@ -114,7 +122,7 @@

Source: structures/MessageMedia.js

data = btoa(data); } - return { data, mime, name }; + return { data, mime, name, size }; } const res = options.client @@ -127,7 +135,7 @@

Source: structures/MessageMedia.js

if (!mimetype) mimetype = res.mime; - return new MessageMedia(mimetype, res.data, filename); + return new MessageMedia(mimetype, res.data, filename, res.size || null); } } @@ -142,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 26461b3ab3d..e2b2716a82f 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Order.js + whatsapp-web.js 1.18.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 8e74292ae0f..bb84d740bce 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Payment.js + whatsapp-web.js 1.18.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 3f32888a7d5..100c40388bd 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/PrivateChat.js + whatsapp-web.js 1.18.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 40706a43f5b..ebea085ac48 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/PrivateContact.js + whatsapp-web.js 1.18.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 0c77d311adb..7fccd8ae0b4 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/Product.js + whatsapp-web.js 1.18.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 220bef02100..62e786bd0d5 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.18.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html new file mode 100644 index 00000000000..bcdc65e4bee --- /dev/null +++ b/docs/structures_Reaction.js.html @@ -0,0 +1,122 @@ + + + + + + + whatsapp-web.js 1.18.0 » Source: structures/Reaction.js + + + + + + + + +
+
+
+ +
+ +
+
'use strict';
+
+const Base = require('./Base');
+
+/**
+ * Represents a Reaction on WhatsApp
+ * @extends {Base}
+ */
+class Reaction extends Base {
+    constructor(client, data) {
+        super(client);
+
+        if (data) this._patch(data);
+    }
+
+    _patch(data) {
+        /**
+         * Reaction ID
+         * @type {object}
+         */
+        this.id = data.msgKey;
+        /**
+         * Orphan
+         * @type {number}
+         */
+        this.orphan = data.orphan;
+        /**
+         * Orphan reason
+         * @type {?string}
+         */
+        this.orphanReason = data.orphanReason;
+        /**
+         * Unix timestamp for when the reaction was created
+         * @type {number}
+         */
+        this.timestamp = data.timestamp;
+        /**
+         * Reaction
+         * @type {string}
+         */
+        this.reaction = data.reactionText;
+        /**
+         * Read
+         * @type {boolean}
+         */
+        this.read = data.read;
+        /**
+         * Message ID
+         * @type {object}
+         */
+        this.msgId = data.parentMsgKey;
+        /**
+         * Sender ID
+         * @type {string}
+         */
+        this.senderId = data.senderUserJid;
+        /**
+         * ACK
+         * @type {?number}
+         */
+        this.ack = data.ack;
+        
+        
+        return super._patch(data);
+    }
+    
+}
+
+module.exports = Reaction;
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index ab0edca5044..84a5d6f31aa 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: util/Constants.js + whatsapp-web.js 1.18.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -42,7 +42,7 @@

Source: util/Constants.js

qrMaxRetries: 0, takeoverOnConflict: false, takeoverTimeoutMs: 0, - userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36', + 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 }; @@ -72,15 +72,18 @@

Source: util/Constants.js

MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', MESSAGE_REVOKED_ME: 'message_revoke_me', MESSAGE_ACK: 'message_ack', + MESSAGE_REACTION: 'message_reaction', MEDIA_UPLOADED: 'media_uploaded', GROUP_JOIN: 'group_join', GROUP_LEAVE: 'group_leave', GROUP_UPDATE: 'group_update', QR_RECEIVED: 'qr', + LOADING_SCREEN: 'loading_screen', DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', BATTERY_CHANGED: 'change_battery', - INCOMING_CALL: 'incoming_call' + INCOMING_CALL: 'incoming_call', + REMOTE_SESSION_SAVED: 'remote_session_saved' }; /** @@ -197,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 0cdbf70afed..a036bd64f7e 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: util/InterfaceController.js + whatsapp-web.js 1.18.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -160,7 +160,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 50b56d03aa4..6906bf1a813 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.17.1 » Source: util/Util.js + whatsapp-web.js 1.18.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index 46ce3391c98..e7e47ae1634 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.0-alpha.1", + "version": "1.18.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 088ec32b7bedae76f4e1b9fea06ed6a09cacc477 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Wed, 26 Oct 2022 22:43:19 -0400 Subject: [PATCH 077/430] Support for WhatsApp Web 2.2241.6 (#1762) * proposed fix * Fixes * Add condition for older versions of WA * fix for old node version support * fix: default to mdbackend = true Co-authored-by: purpshell --- src/util/Injected.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index b1ae286ef1d..4184de8665b 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -13,7 +13,6 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd; window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; - window.Store.MDBackend = window.mR.findModule('isMDBackend')[0].isMDBackend(); window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures; window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; @@ -39,7 +38,6 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default; window.Store.Validators = window.mR.findModule('findLinks')[0]; window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0]; - window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default; window.Store.WidFactory = window.mR.findModule('createWid')[0]; window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0]; window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0]; @@ -71,6 +69,19 @@ exports.ExposeStore = (moduleRaidStr) => { }); }; } + + // TODO remove these once everybody has been updated to WWebJS with legacy sessions removed + const _linkPreview = window.mR.findModule('queryLinkPreview'); + if (_linkPreview && _linkPreview[0] && _linkPreview[0].default) { + window.Store.Wap = _linkPreview[0].default; + } + + const _isMDBackend = window.mR.findModule('isMDBackend'); + if(_isMDBackend && _isMDBackend[0] && _isMDBackend[0].isMDBackend) { + window.Store.MDBackend = _isMDBackend[0].isMDBackend(); + } else { + window.Store.MDBackend = true; + } }; exports.LoadUtils = () => { From 7d672078cd6370001134bc19d09386344cba9c29 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Wed, 26 Oct 2022 22:44:05 -0400 Subject: [PATCH 078/430] chore: mark version v1.18.1 --- docs/Base.html | 6 +++--- docs/BaseAuthStrategy.html | 6 +++--- docs/BusinessContact.html | 6 +++--- docs/Buttons.html | 6 +++--- docs/Call.html | 6 +++--- docs/Chat.html | 6 +++--- docs/Client.html | 6 +++--- docs/Client.js.html | 6 +++--- docs/ClientInfo.html | 6 +++--- docs/Contact.html | 6 +++--- docs/GroupChat.html | 6 +++--- docs/GroupNotification.html | 6 +++--- docs/InterfaceController.html | 6 +++--- docs/Label.html | 6 +++--- docs/LegacySessionAuth.html | 6 +++--- docs/List.html | 6 +++--- docs/LocalAuth.html | 6 +++--- docs/Location.html | 6 +++--- docs/Message.html | 6 +++--- docs/MessageMedia.html | 6 +++--- docs/NoAuth.html | 6 +++--- docs/Order.html | 6 +++--- docs/PrivateChat.html | 6 +++--- docs/PrivateContact.html | 6 +++--- docs/Product.html | 6 +++--- docs/Reaction.html | 6 +++--- docs/RemoteAuth.html | 6 +++--- docs/Util.html | 6 +++--- docs/authStrategies_BaseAuthStrategy.js.html | 6 +++--- docs/authStrategies_LegacySessionAuth.js.html | 6 +++--- docs/authStrategies_LocalAuth.js.html | 6 +++--- docs/authStrategies_NoAuth.js.html | 6 +++--- docs/authStrategies_RemoteAuth.js.html | 6 +++--- docs/global.html | 6 +++--- docs/index.html | 8 ++++---- docs/structures_Base.js.html | 6 +++--- docs/structures_BusinessContact.js.html | 6 +++--- docs/structures_Buttons.js.html | 6 +++--- docs/structures_Call.js.html | 6 +++--- docs/structures_Chat.js.html | 6 +++--- docs/structures_ClientInfo.js.html | 6 +++--- docs/structures_Contact.js.html | 6 +++--- docs/structures_GroupChat.js.html | 6 +++--- 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 | 6 +++--- docs/structures_MessageMedia.js.html | 6 +++--- docs/structures_Order.js.html | 6 +++--- docs/structures_Payment.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/util_Constants.js.html | 6 +++--- docs/util_InterfaceController.js.html | 6 +++--- docs/util_Util.js.html | 6 +++--- package.json | 2 +- 60 files changed, 179 insertions(+), 179 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 8d659f4e1c1..77231a4a329 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Base + whatsapp-web.js 1.18.1 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index f3b466818a2..5956368dc5e 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.18.1 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index f82c6eeebae..eab9cd753d3 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: BusinessContact + whatsapp-web.js 1.18.1 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index e5c7e300717..46e7b9659d2 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Buttons + whatsapp-web.js 1.18.1 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 7c80fc99644..3388ab302e2 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Call + whatsapp-web.js 1.18.1 » Class: Call @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index eebcf581458..df3f8a54375 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Chat + whatsapp-web.js 1.18.1 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 24b52a03c0d..a7208606f7f 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Client + whatsapp-web.js 1.18.1 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index c39799f9689..c3d648a32db 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: Client.js + whatsapp-web.js 1.18.1 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1224,7 +1224,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 064991c8520..773e469d26b 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: ClientInfo + whatsapp-web.js 1.18.1 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index 4594061a25f..7434e191bcc 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Contact + whatsapp-web.js 1.18.1 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index a39e4541388..66229e3a30b 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: GroupChat + whatsapp-web.js 1.18.1 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index eb9ce7ce5a4..9e141e3c70d 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: GroupNotification + whatsapp-web.js 1.18.1 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 707aee24fb4..ae940456a74 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: InterfaceController + whatsapp-web.js 1.18.1 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index ab642e9ca12..dd347094d90 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Label + whatsapp-web.js 1.18.1 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index cc1aedbd705..bcf1a990d1f 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: LegacySessionAuth + whatsapp-web.js 1.18.1 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index dce13cfe811..7e255268093 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: List + whatsapp-web.js 1.18.1 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index dbf9ed26eb5..cabdefc943a 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: LocalAuth + whatsapp-web.js 1.18.1 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index cfb20a0ec1e..838a1a655f7 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Location + whatsapp-web.js 1.18.1 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index 04e7b38d28f..b3b00ce71be 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Message + whatsapp-web.js 1.18.1 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 1dc5e9abac2..867b40e52c4 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: MessageMedia + whatsapp-web.js 1.18.1 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 688a6ac324e..59fa31d30d5 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: NoAuth + whatsapp-web.js 1.18.1 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index 1cdda968a69..115a492ae77 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Order + whatsapp-web.js 1.18.1 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 1922966a11b..5ed58ecca0a 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: PrivateChat + whatsapp-web.js 1.18.1 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index b5257e03ef3..965ec03e5c1 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: PrivateContact + whatsapp-web.js 1.18.1 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 3f595d3be09..efd382c065b 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Product + whatsapp-web.js 1.18.1 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index b2914133028..ee5855e2d50 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Reaction + whatsapp-web.js 1.18.1 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 9a028bc72dd..136674b21a7 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: RemoteAuth + whatsapp-web.js 1.18.1 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index 86ed99c6b33..b308c264f99 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Class: Util + whatsapp-web.js 1.18.1 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 0912654e36d..3900d7726fc 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.18.1 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 344cfbfa5a3..ff903be189d 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.18.1 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 83cf47b3ee2..040b0c47298 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.18.1 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index f6ee7a454d7..2f543493364 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.18.1 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 63709bd2d40..8bdd2e77fef 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.18.1 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index 89c6ad9c00f..16a70a00076 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Globals + whatsapp-web.js 1.18.1 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index 3e2c8fd2f8d..ca3c5c0e97c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Home + whatsapp-web.js 1.18.1 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
@@ -3276,7 +3276,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 65d6ae73d40..e9df2021d93 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Base.js + whatsapp-web.js 1.18.1 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index c6740cb2ade..cc6b32b40d7 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.18.1 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 8be1944da67..02e405b2468 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Buttons.js + whatsapp-web.js 1.18.1 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 81cb49b1ebd..00ee9c03557 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Call.js + whatsapp-web.js 1.18.1 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 5521da65611..f8c0561a6a9 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Chat.js + whatsapp-web.js 1.18.1 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index f591d3d37e9..f75a6d6eda9 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.18.1 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 9280f8010f3..043f0cacedb 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Contact.js + whatsapp-web.js 1.18.1 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index a3043e0c474..fb2afb131dd 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.18.1 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index dcc45b4b914..ad9040234c9 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.18.1 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 8edcac81e3a..f0c922b9c9d 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Label.js + whatsapp-web.js 1.18.1 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 85ada9e7efe..baf1f161d0a 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/List.js + whatsapp-web.js 1.18.1 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 788874f81be..4a4cf80b0f6 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Location.js + whatsapp-web.js 1.18.1 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 193ada00ee8..9853f2626a6 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Message.js + whatsapp-web.js 1.18.1 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -569,7 +569,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 07dc863030c..f4e96a77386 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.18.1 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index e2b2716a82f..3ab31a3bf20 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Order.js + whatsapp-web.js 1.18.1 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index bb84d740bce..282f375015c 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Payment.js + whatsapp-web.js 1.18.1 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 100c40388bd..10e6230996c 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.18.1 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index ebea085ac48..2550477919f 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.18.1 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 7fccd8ae0b4..19e2beea8eb 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Product.js + whatsapp-web.js 1.18.1 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 62e786bd0d5..24942442c68 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.18.1 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index bcdc65e4bee..d5e6817e5ba 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: structures/Reaction.js + whatsapp-web.js 1.18.1 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 84a5d6f31aa..6267643981e 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: util/Constants.js + whatsapp-web.js 1.18.1 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index a036bd64f7e..775d9faa8c3 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.18.1 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -160,7 +160,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 6906bf1a813..22e2dcb51eb 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.0 » Source: util/Util.js + whatsapp-web.js 1.18.1 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index e7e47ae1634..6566140ef2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.0", + "version": "1.18.1", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 7bb7f13f07c8c7fac044c6c75bd180eabebd78b0 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Wed, 26 Oct 2022 22:45:05 -0400 Subject: [PATCH 079/430] bump supported version --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 89ff5e54300..c26079d8608 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2240.7](https://img.shields.io/badge/WhatsApp_Web-2.2240.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2241.6](https://img.shields.io/badge/WhatsApp_Web-2.2241.6-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index f3c915135d7..0b7f6f6d610 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2240.7 \ No newline at end of file +2.2241.6 \ No newline at end of file From 9981723505bfab7c2a5e109eaa7ba814d0205158 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Wed, 26 Oct 2022 23:32:06 -0400 Subject: [PATCH 080/430] fix: message replies compatible with WhatsApp Web v2.2241.6 (#1765) * fix message replies * fix up some tests --- src/util/Injected.js | 9 ++++++++- tests/client.js | 5 ++--- tests/structures/message.js | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index 4184de8665b..c513373ca37 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -50,6 +50,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg; window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0]; window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0]; + window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0]; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], ...window.mR.findModule('addWebpMetadata')[0] @@ -116,7 +117,13 @@ exports.LoadUtils = () => { let quotedMsgOptions = {}; if (options.quotedMessageId) { let quotedMessage = window.Store.Msg.get(options.quotedMessageId); - if (quotedMessage.canReply()) { + + // TODO remove .canReply() once all clients are updated to >= v2.2241.6 + const canReply = window.Store.ReplyUtils ? + window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) : + quotedMessage.canReply(); + + if (canReply) { quotedMsgOptions = quotedMessage.msgContextInfo(chat); } delete options.quotedMessageId; diff --git a/tests/client.js b/tests/client.js index 55f5334c1c7..0118c2010e7 100644 --- a/tests/client.js +++ b/tests/client.js @@ -98,7 +98,7 @@ describe('Client', function() { await helper.sleep(20000); expect(callback.called).to.equal(true); - expect(callback.args[0][0]).to.have.lengthOf(152); + expect(callback.args[0][0]).to.have.length.greaterThanOrEqual(152); await client.destroy(); }); @@ -224,7 +224,7 @@ describe('Client', function() { expect(authFailCallback.called).to.equal(true); expect(qrCallback.called).to.equal(true); - expect(qrCallback.args[0][0]).to.have.lengthOf(152); + expect(qrCallback.args[0][0]).to.have.length.greaterThanOrEqual(152); await client.destroy(); }); @@ -346,7 +346,6 @@ describe('Client', function() { 'UserConstructor', 'VCard', 'Validators', - 'Wap', 'WidFactory', 'findCommonGroups', 'sendReactionToMsg', diff --git a/tests/structures/message.js b/tests/structures/message.js index 7a9749d358f..0f87e53b188 100644 --- a/tests/structures/message.js +++ b/tests/structures/message.js @@ -66,6 +66,8 @@ describe('Message', function () { expect(message.isStarred).to.equal(false); await message.star(); + await helper.sleep(1000); + // reload and check await message.reload(); expect(message.isStarred).to.equal(true); @@ -75,6 +77,8 @@ describe('Message', function () { expect(message.isStarred).to.equal(true); await message.unstar(); + await helper.sleep(1000); + // reload and check await message.reload(); expect(message.isStarred).to.equal(false); @@ -85,7 +89,7 @@ describe('Message', function () { it('can delete a message for me', async function () { await message.delete(); - await helper.sleep(1000); + await helper.sleep(5000); expect(await message.reload()).to.equal(null); }); From 6f7c5c2dd9a617f84dd9ba9fc61b6bd441816317 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Wed, 26 Oct 2022 23:32:56 -0400 Subject: [PATCH 081/430] chore: mark version v1.18.2 --- docs/Base.html | 4 ++-- docs/BaseAuthStrategy.html | 4 ++-- docs/BusinessContact.html | 4 ++-- docs/Buttons.html | 4 ++-- docs/Call.html | 4 ++-- docs/Chat.html | 4 ++-- docs/Client.html | 4 ++-- docs/Client.js.html | 4 ++-- docs/ClientInfo.html | 4 ++-- docs/Contact.html | 4 ++-- docs/GroupChat.html | 4 ++-- docs/GroupNotification.html | 4 ++-- docs/InterfaceController.html | 4 ++-- docs/Label.html | 4 ++-- docs/LegacySessionAuth.html | 4 ++-- docs/List.html | 4 ++-- docs/LocalAuth.html | 4 ++-- docs/Location.html | 4 ++-- docs/Message.html | 4 ++-- docs/MessageMedia.html | 4 ++-- docs/NoAuth.html | 4 ++-- docs/Order.html | 4 ++-- docs/PrivateChat.html | 4 ++-- docs/PrivateContact.html | 4 ++-- docs/Product.html | 4 ++-- docs/Reaction.html | 4 ++-- docs/RemoteAuth.html | 4 ++-- docs/Util.html | 4 ++-- docs/authStrategies_BaseAuthStrategy.js.html | 4 ++-- docs/authStrategies_LegacySessionAuth.js.html | 4 ++-- docs/authStrategies_LocalAuth.js.html | 4 ++-- docs/authStrategies_NoAuth.js.html | 4 ++-- docs/authStrategies_RemoteAuth.js.html | 4 ++-- docs/global.html | 4 ++-- docs/index.html | 8 ++++---- docs/structures_Base.js.html | 4 ++-- docs/structures_BusinessContact.js.html | 4 ++-- docs/structures_Buttons.js.html | 4 ++-- docs/structures_Call.js.html | 4 ++-- docs/structures_Chat.js.html | 4 ++-- docs/structures_ClientInfo.js.html | 4 ++-- docs/structures_Contact.js.html | 4 ++-- docs/structures_GroupChat.js.html | 4 ++-- docs/structures_GroupNotification.js.html | 4 ++-- docs/structures_Label.js.html | 4 ++-- docs/structures_List.js.html | 4 ++-- docs/structures_Location.js.html | 4 ++-- docs/structures_Message.js.html | 4 ++-- docs/structures_MessageMedia.js.html | 4 ++-- docs/structures_Order.js.html | 4 ++-- docs/structures_Payment.js.html | 4 ++-- docs/structures_PrivateChat.js.html | 4 ++-- docs/structures_PrivateContact.js.html | 4 ++-- docs/structures_Product.js.html | 4 ++-- docs/structures_ProductMetadata.js.html | 4 ++-- docs/structures_Reaction.js.html | 4 ++-- docs/util_Constants.js.html | 4 ++-- docs/util_InterfaceController.js.html | 4 ++-- docs/util_Util.js.html | 4 ++-- package.json | 2 +- 60 files changed, 121 insertions(+), 121 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 77231a4a329..cee5e70c3e0 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Base + whatsapp-web.js 1.18.2 » Class: Base @@ -15,7 +15,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 5956368dc5e..8b6f33f1b4f 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: BaseAuthStrategy + whatsapp-web.js 1.18.2 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index eab9cd753d3..7980005aa0c 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: BusinessContact + whatsapp-web.js 1.18.2 » Class: BusinessContact @@ -15,7 +15,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index 46e7b9659d2..d6c2ce2efd8 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Buttons + whatsapp-web.js 1.18.2 » Class: Buttons @@ -15,7 +15,7 @@ diff --git a/docs/Call.html b/docs/Call.html index 3388ab302e2..d92e969432b 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Call + whatsapp-web.js 1.18.2 » Class: Call @@ -15,7 +15,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index df3f8a54375..93d56b418e3 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Chat + whatsapp-web.js 1.18.2 » Class: Chat @@ -15,7 +15,7 @@ diff --git a/docs/Client.html b/docs/Client.html index a7208606f7f..7e13c9b1553 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Client + whatsapp-web.js 1.18.2 » Class: Client @@ -15,7 +15,7 @@ diff --git a/docs/Client.js.html b/docs/Client.js.html index c3d648a32db..4045ce34d30 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: Client.js + whatsapp-web.js 1.18.2 » Source: Client.js @@ -15,7 +15,7 @@ diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 773e469d26b..04c988e4568 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: ClientInfo + whatsapp-web.js 1.18.2 » Class: ClientInfo @@ -15,7 +15,7 @@ diff --git a/docs/Contact.html b/docs/Contact.html index 7434e191bcc..c4a20f8481f 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Contact + whatsapp-web.js 1.18.2 » Class: Contact @@ -15,7 +15,7 @@ diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 66229e3a30b..fbf63f4fc99 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: GroupChat + whatsapp-web.js 1.18.2 » Class: GroupChat @@ -15,7 +15,7 @@ diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 9e141e3c70d..a6911931a6b 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: GroupNotification + whatsapp-web.js 1.18.2 » Class: GroupNotification @@ -15,7 +15,7 @@ diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index ae940456a74..c8992f05aae 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: InterfaceController + whatsapp-web.js 1.18.2 » Class: InterfaceController @@ -15,7 +15,7 @@ diff --git a/docs/Label.html b/docs/Label.html index dd347094d90..a05b3774c76 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Label + whatsapp-web.js 1.18.2 » Class: Label @@ -15,7 +15,7 @@ diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index bcf1a990d1f..53bbfde52c9 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: LegacySessionAuth + whatsapp-web.js 1.18.2 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ diff --git a/docs/List.html b/docs/List.html index 7e255268093..6af1ec2f069 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: List + whatsapp-web.js 1.18.2 » Class: List @@ -15,7 +15,7 @@ diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index cabdefc943a..305dc591815 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: LocalAuth + whatsapp-web.js 1.18.2 » Class: LocalAuth @@ -15,7 +15,7 @@ diff --git a/docs/Location.html b/docs/Location.html index 838a1a655f7..7d980a24c46 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Location + whatsapp-web.js 1.18.2 » Class: Location @@ -15,7 +15,7 @@ diff --git a/docs/Message.html b/docs/Message.html index b3b00ce71be..f9440d0126c 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Message + whatsapp-web.js 1.18.2 » Class: Message @@ -15,7 +15,7 @@ diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 867b40e52c4..353127f0303 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: MessageMedia + whatsapp-web.js 1.18.2 » Class: MessageMedia @@ -15,7 +15,7 @@ diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 59fa31d30d5..62a8caec57b 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: NoAuth + whatsapp-web.js 1.18.2 » Class: NoAuth @@ -15,7 +15,7 @@ diff --git a/docs/Order.html b/docs/Order.html index 115a492ae77..1b6208056c3 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Order + whatsapp-web.js 1.18.2 » Class: Order @@ -15,7 +15,7 @@ diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 5ed58ecca0a..f8a8298eaa7 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: PrivateChat + whatsapp-web.js 1.18.2 » Class: PrivateChat @@ -15,7 +15,7 @@ diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 965ec03e5c1..94d23ce52d1 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: PrivateContact + whatsapp-web.js 1.18.2 » Class: PrivateContact @@ -15,7 +15,7 @@ diff --git a/docs/Product.html b/docs/Product.html index efd382c065b..7dcbfbe76d7 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Product + whatsapp-web.js 1.18.2 » Class: Product @@ -15,7 +15,7 @@ diff --git a/docs/Reaction.html b/docs/Reaction.html index ee5855e2d50..4817db45034 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Reaction + whatsapp-web.js 1.18.2 » Class: Reaction @@ -15,7 +15,7 @@ diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 136674b21a7..0d0703104ad 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: RemoteAuth + whatsapp-web.js 1.18.2 » Class: RemoteAuth @@ -15,7 +15,7 @@ diff --git a/docs/Util.html b/docs/Util.html index b308c264f99..0d788191cc0 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Class: Util + whatsapp-web.js 1.18.2 » Class: Util @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 3900d7726fc..992219b4438 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.18.2 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index ff903be189d..d8039856f59 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.18.2 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 040b0c47298..6a8254ada7d 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.18.2 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 2f543493364..a9aab1dc8ba 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.18.2 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 8bdd2e77fef..16953eb03d0 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.18.2 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/global.html b/docs/global.html index 16a70a00076..59cb73deac7 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Globals + whatsapp-web.js 1.18.2 » Globals @@ -15,7 +15,7 @@ diff --git a/docs/index.html b/docs/index.html index ca3c5c0e97c..032bf264c67 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Home + whatsapp-web.js 1.18.2 » Home @@ -15,7 +15,7 @@ @@ -27,11 +27,11 @@
-

npm Depfu WhatsApp_Web 2.2240.7 Discord Chat

+

npm Depfu WhatsApp_Web 2.2241.6 Discord Chat

whatsapp-web.js

A WhatsApp API client that connects through the WhatsApp Web browser app

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index e9df2021d93..df20a926873 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Base.js + whatsapp-web.js 1.18.2 » Source: structures/Base.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index cc6b32b40d7..90aaecc5d4e 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/BusinessContact.js + whatsapp-web.js 1.18.2 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 02e405b2468..4699fdebfb0 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Buttons.js + whatsapp-web.js 1.18.2 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 00ee9c03557..2118c5ddb3a 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Call.js + whatsapp-web.js 1.18.2 » Source: structures/Call.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index f8c0561a6a9..96fe03d1e0a 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Chat.js + whatsapp-web.js 1.18.2 » Source: structures/Chat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index f75a6d6eda9..71f96428a27 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/ClientInfo.js + whatsapp-web.js 1.18.2 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 043f0cacedb..39cbc5fecd9 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Contact.js + whatsapp-web.js 1.18.2 » Source: structures/Contact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index fb2afb131dd..1faee566e1d 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/GroupChat.js + whatsapp-web.js 1.18.2 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index ad9040234c9..294124542de 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/GroupNotification.js + whatsapp-web.js 1.18.2 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index f0c922b9c9d..5fc785d11df 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Label.js + whatsapp-web.js 1.18.2 » Source: structures/Label.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index baf1f161d0a..0e2c0270165 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/List.js + whatsapp-web.js 1.18.2 » Source: structures/List.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 4a4cf80b0f6..353d381b4b2 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Location.js + whatsapp-web.js 1.18.2 » Source: structures/Location.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 9853f2626a6..259bc90575c 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Message.js + whatsapp-web.js 1.18.2 » Source: structures/Message.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index f4e96a77386..1c3f7aa3e91 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/MessageMedia.js + whatsapp-web.js 1.18.2 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 3ab31a3bf20..313a26faba9 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Order.js + whatsapp-web.js 1.18.2 » Source: structures/Order.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 282f375015c..a4f19c68ea9 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Payment.js + whatsapp-web.js 1.18.2 » Source: structures/Payment.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 10e6230996c..3d1b45791c7 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/PrivateChat.js + whatsapp-web.js 1.18.2 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 2550477919f..8e242437589 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/PrivateContact.js + whatsapp-web.js 1.18.2 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 19e2beea8eb..b3d345ed88a 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Product.js + whatsapp-web.js 1.18.2 » Source: structures/Product.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 24942442c68..f4b68e2e7ce 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.18.2 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index d5e6817e5ba..2efca66507b 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: structures/Reaction.js + whatsapp-web.js 1.18.2 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 6267643981e..1169b26218e 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: util/Constants.js + whatsapp-web.js 1.18.2 » Source: util/Constants.js @@ -15,7 +15,7 @@ diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 775d9faa8c3..d0349855208 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: util/InterfaceController.js + whatsapp-web.js 1.18.2 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 22e2dcb51eb..a21b1451bec 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.1 » Source: util/Util.js + whatsapp-web.js 1.18.2 » Source: util/Util.js @@ -15,7 +15,7 @@ diff --git a/package.json b/package.json index 6566140ef2b..90094ea8ae0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.1", + "version": "1.18.2", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 82120f0446170b14d3ffa18c8fd65d418d7f2fb6 Mon Sep 17 00:00:00 2001 From: Felipe Martins Date: Sun, 13 Nov 2022 08:36:06 -0300 Subject: [PATCH 082/430] Fix GroupMetadata module (#1789) * Fix GroupMetadata module * Update src/util/Injected.js Co-authored-by: Felipe Martins Co-authored-by: Rajeh Taher --- src/util/Injected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index c513373ca37..ed0f5dc1fd3 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -14,7 +14,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures; - window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default; + window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0]; window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection; From e8bae22b0317cded6065fda32bba761734fc5cd6 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Sun, 13 Nov 2022 17:54:03 +0000 Subject: [PATCH 083/430] 1.18.3-alpha.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 90094ea8ae0..ef4f2504308 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.2", + "version": "1.18.3-alpha.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From a60f5ebf407e4f8183947c497e65bb149a707dc7 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 13 Nov 2022 21:12:55 -0500 Subject: [PATCH 084/430] chore: mark version v1.18.3 --- docs/Base.html | 8 ++++---- docs/BaseAuthStrategy.html | 8 ++++---- docs/BusinessContact.html | 8 ++++---- docs/Buttons.html | 8 ++++---- docs/Call.html | 8 ++++---- docs/Chat.html | 8 ++++---- docs/Client.html | 8 ++++---- docs/Client.js.html | 8 ++++---- docs/ClientInfo.html | 8 ++++---- docs/Contact.html | 8 ++++---- docs/GroupChat.html | 8 ++++---- docs/GroupNotification.html | 8 ++++---- docs/InterfaceController.html | 8 ++++---- docs/Label.html | 8 ++++---- docs/LegacySessionAuth.html | 8 ++++---- docs/List.html | 8 ++++---- docs/LocalAuth.html | 8 ++++---- docs/Location.html | 8 ++++---- docs/Message.html | 8 ++++---- docs/MessageMedia.html | 8 ++++---- docs/NoAuth.html | 8 ++++---- docs/Order.html | 8 ++++---- docs/PrivateChat.html | 8 ++++---- docs/PrivateContact.html | 8 ++++---- docs/Product.html | 8 ++++---- docs/Reaction.html | 8 ++++---- docs/RemoteAuth.html | 8 ++++---- docs/Util.html | 8 ++++---- docs/authStrategies_BaseAuthStrategy.js.html | 8 ++++---- docs/authStrategies_LegacySessionAuth.js.html | 8 ++++---- docs/authStrategies_LocalAuth.js.html | 8 ++++---- docs/authStrategies_NoAuth.js.html | 8 ++++---- docs/authStrategies_RemoteAuth.js.html | 8 ++++---- docs/global.html | 8 ++++---- docs/index.html | 10 +++++----- docs/structures_Base.js.html | 8 ++++---- docs/structures_BusinessContact.js.html | 8 ++++---- docs/structures_Buttons.js.html | 8 ++++---- docs/structures_Call.js.html | 8 ++++---- docs/structures_Chat.js.html | 8 ++++---- docs/structures_ClientInfo.js.html | 8 ++++---- docs/structures_Contact.js.html | 8 ++++---- docs/structures_GroupChat.js.html | 8 ++++---- docs/structures_GroupNotification.js.html | 8 ++++---- docs/structures_Label.js.html | 8 ++++---- docs/structures_List.js.html | 8 ++++---- docs/structures_Location.js.html | 8 ++++---- docs/structures_Message.js.html | 8 ++++---- docs/structures_MessageMedia.js.html | 8 ++++---- docs/structures_Order.js.html | 8 ++++---- docs/structures_Payment.js.html | 8 ++++---- docs/structures_PrivateChat.js.html | 8 ++++---- docs/structures_PrivateContact.js.html | 8 ++++---- docs/structures_Product.js.html | 8 ++++---- docs/structures_ProductMetadata.js.html | 8 ++++---- docs/structures_Reaction.js.html | 8 ++++---- docs/util_Constants.js.html | 8 ++++---- docs/util_InterfaceController.js.html | 8 ++++---- docs/util_Util.js.html | 8 ++++---- package.json | 2 +- 60 files changed, 238 insertions(+), 238 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index cee5e70c3e0..a083e1ca3a5 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Base + whatsapp-web.js 1.18.3 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 8b6f33f1b4f..4942559a60a 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: BaseAuthStrategy + whatsapp-web.js 1.18.3 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 7980005aa0c..c08a29f155f 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: BusinessContact + whatsapp-web.js 1.18.3 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index d6c2ce2efd8..4bca95a3607 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Buttons + whatsapp-web.js 1.18.3 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index d92e969432b..1fb3718402f 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Call + whatsapp-web.js 1.18.3 » Class: Call @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index 93d56b418e3..e1962b8b553 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Chat + whatsapp-web.js 1.18.3 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 7e13c9b1553..0caa359aed9 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Client + whatsapp-web.js 1.18.3 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 4045ce34d30..cfe0679740c 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: Client.js + whatsapp-web.js 1.18.3 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1224,7 +1224,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 04c988e4568..672f2e7ae14 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: ClientInfo + whatsapp-web.js 1.18.3 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index c4a20f8481f..a2178935931 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Contact + whatsapp-web.js 1.18.3 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index fbf63f4fc99..0cc37642f5a 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: GroupChat + whatsapp-web.js 1.18.3 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index a6911931a6b..7988faf35b4 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: GroupNotification + whatsapp-web.js 1.18.3 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index c8992f05aae..ea2ba998ec9 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: InterfaceController + whatsapp-web.js 1.18.3 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index a05b3774c76..923d0a82da1 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Label + whatsapp-web.js 1.18.3 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 53bbfde52c9..d8daea1601e 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: LegacySessionAuth + whatsapp-web.js 1.18.3 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index 6af1ec2f069..53a5a87731b 100644 --- a/docs/List.html +++ b/docs/List.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: List + whatsapp-web.js 1.18.3 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 305dc591815..3f295bcc03c 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: LocalAuth + whatsapp-web.js 1.18.3 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index 7d980a24c46..798db80fec5 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Location + whatsapp-web.js 1.18.3 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index f9440d0126c..c9748e5377e 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Message + whatsapp-web.js 1.18.3 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 353127f0303..49d54e78ee5 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: MessageMedia + whatsapp-web.js 1.18.3 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 62a8caec57b..f821b5fe145 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: NoAuth + whatsapp-web.js 1.18.3 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index 1b6208056c3..98ef4d741bd 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Order + whatsapp-web.js 1.18.3 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index f8a8298eaa7..e89e6b9cba2 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: PrivateChat + whatsapp-web.js 1.18.3 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 94d23ce52d1..1d966cc4000 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: PrivateContact + whatsapp-web.js 1.18.3 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 7dcbfbe76d7..1605eadb21f 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Product + whatsapp-web.js 1.18.3 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index 4817db45034..61e0c4e8ac5 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Reaction + whatsapp-web.js 1.18.3 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 0d0703104ad..28a2eaebded 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: RemoteAuth + whatsapp-web.js 1.18.3 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index 0d788191cc0..c9a03b019c5 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Class: Util + whatsapp-web.js 1.18.3 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 992219b4438..dba1b7358f3 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.18.3 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index d8039856f59..861fa78e62b 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.18.3 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 6a8254ada7d..c8cd2ffcd46 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.18.3 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index a9aab1dc8ba..65269ba77a6 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.18.3 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 16953eb03d0..90965a23032 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.18.3 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index 59cb73deac7..5c2a3328cc7 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Globals + whatsapp-web.js 1.18.3 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index 032bf264c67..3c0349bd307 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Home + whatsapp-web.js 1.18.3 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
@@ -3276,7 +3276,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index df20a926873..84d94205b3b 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Base.js + whatsapp-web.js 1.18.3 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 90aaecc5d4e..5627b3a67c4 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/BusinessContact.js + whatsapp-web.js 1.18.3 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 4699fdebfb0..1555c38bd51 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Buttons.js + whatsapp-web.js 1.18.3 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 2118c5ddb3a..15ef35a35d4 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Call.js + whatsapp-web.js 1.18.3 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 96fe03d1e0a..c6352d37547 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Chat.js + whatsapp-web.js 1.18.3 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 71f96428a27..eb40d8eaaf0 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/ClientInfo.js + whatsapp-web.js 1.18.3 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 39cbc5fecd9..52e76110a07 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Contact.js + whatsapp-web.js 1.18.3 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 1faee566e1d..e8757ac56c0 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/GroupChat.js + whatsapp-web.js 1.18.3 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 294124542de..0a924bdd0bc 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/GroupNotification.js + whatsapp-web.js 1.18.3 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 5fc785d11df..7caa8bcbd74 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Label.js + whatsapp-web.js 1.18.3 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 0e2c0270165..3c787d8c31a 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/List.js + whatsapp-web.js 1.18.3 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 353d381b4b2..202e68d8d52 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Location.js + whatsapp-web.js 1.18.3 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 259bc90575c..43e0e028df2 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Message.js + whatsapp-web.js 1.18.3 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -569,7 +569,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 1c3f7aa3e91..65b3615fb48 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/MessageMedia.js + whatsapp-web.js 1.18.3 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 313a26faba9..42a516912e1 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Order.js + whatsapp-web.js 1.18.3 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index a4f19c68ea9..41aafb16212 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Payment.js + whatsapp-web.js 1.18.3 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 3d1b45791c7..8d7d2a90d16 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/PrivateChat.js + whatsapp-web.js 1.18.3 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 8e242437589..88010e70e51 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/PrivateContact.js + whatsapp-web.js 1.18.3 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index b3d345ed88a..6820848958e 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Product.js + whatsapp-web.js 1.18.3 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index f4b68e2e7ce..0c6dd41b915 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.18.3 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 2efca66507b..21d744b9a53 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: structures/Reaction.js + whatsapp-web.js 1.18.3 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 1169b26218e..e67ff21f502 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: util/Constants.js + whatsapp-web.js 1.18.3 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index d0349855208..394330aef2f 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: util/InterfaceController.js + whatsapp-web.js 1.18.3 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -160,7 +160,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index a21b1451bec..e66c61d21b9 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.2 » Source: util/Util.js + whatsapp-web.js 1.18.3 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index ef4f2504308..363e0d9e264 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.3-alpha.0", + "version": "1.18.3", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From d9f9c28276a3ce63661193118dd60a774226ea20 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sat, 26 Nov 2022 04:38:29 -0400 Subject: [PATCH 085/430] fix: get quoted msg (#1841) --- src/structures/Message.js | 5 +++-- src/util/Injected.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index e8260dd264c..25f418ad4e9 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -305,8 +305,9 @@ class Message extends Base { if (!this.hasQuotedMsg) return undefined; const quotedMsg = await this.client.pupPage.evaluate((msgId) => { - let msg = window.Store.Msg.get(msgId); - return msg.quotedMsgObj().serialize(); + const msg = window.Store.Msg.get(msgId); + const quotedMsg = window.Store.QuotedMsg.getQuotedMsgObj(msg); + return window.WWebJS.getMessageModel(quotedMsg); }, this.id._serialized); return new Message(this.client, quotedMsg); diff --git a/src/util/Injected.js b/src/util/Injected.js index ed0f5dc1fd3..bd9316cc875 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -51,6 +51,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0]; window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0]; window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0]; + window.Store.QuotedMsg = window.mR.findModule('getQuotedMsgObj')[0]; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], ...window.mR.findModule('addWebpMetadata')[0] From db55d869f819c62ca56a77427d91966b0b832ec4 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sat, 26 Nov 2022 04:44:35 -0400 Subject: [PATCH 086/430] fix: delete messages for everyone (#1842) --- src/structures/Message.js | 3 ++- src/util/Injected.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 25f418ad4e9..9af132ce8ba 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -437,7 +437,8 @@ class Message extends Base { await this.client.pupPage.evaluate((msgId, everyone) => { let msg = window.Store.Msg.get(msgId); - if (everyone && msg._canRevoke()) { + const canRevoke = window.Store.MsgActionChecks.canSenderRevokeMsg(msg) || window.Store.MsgActionChecks.canAdminRevokeMsg(msg); + if (everyone && canRevoke) { return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], { type: msg.id.fromMe ? 'Sender' : 'Admin' }); } diff --git a/src/util/Injected.js b/src/util/Injected.js index bd9316cc875..7ece210aed6 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -51,6 +51,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0]; window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0]; window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0]; + window.Store.MsgActionChecks = window.mR.findModule('canSenderRevokeMsg')[0]; window.Store.QuotedMsg = window.mR.findModule('getQuotedMsgObj')[0]; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], From dc91562f3cadfe68adcf4622853fa8d44b3e9ce1 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sat, 26 Nov 2022 05:12:54 -0400 Subject: [PATCH 087/430] fix: star/unstar messages (#1843) --- src/structures/Message.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 9af132ce8ba..ee79c201774 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -453,7 +453,7 @@ class Message extends Base { await this.client.pupPage.evaluate((msgId) => { let msg = window.Store.Msg.get(msgId); - if (msg.canStar()) { + if (window.Store.MsgActionChecks.canStarMsg(msg)) { return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false); } }, this.id._serialized); @@ -466,7 +466,7 @@ class Message extends Base { await this.client.pupPage.evaluate((msgId) => { let msg = window.Store.Msg.get(msgId); - if (msg.canStar()) { + if (window.Store.MsgActionChecks.canStarMsg(msg)) { return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false); } }, this.id._serialized); From a15f1b8428bf420152268b4b17a76fe19efe8b9d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 05:26:46 -0400 Subject: [PATCH 088/430] Update supported WhatsApp Web version to v2.2245.9 (#1764) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c26079d8608..3824f63406c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2241.6](https://img.shields.io/badge/WhatsApp_Web-2.2241.6-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2245.9](https://img.shields.io/badge/WhatsApp_Web-2.2245.9-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 0b7f6f6d610..53ab36c0b5a 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2241.6 \ No newline at end of file +2.2245.9 \ No newline at end of file From 6fe1017bd3e422f6dad5a57efbffc16f85391340 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 26 Nov 2022 05:27:37 -0400 Subject: [PATCH 089/430] chore: mark version v1.18.4 --- docs/Base.html | 8 ++++---- docs/BaseAuthStrategy.html | 8 ++++---- docs/BusinessContact.html | 8 ++++---- docs/Buttons.html | 8 ++++---- docs/Call.html | 8 ++++---- docs/Chat.html | 8 ++++---- docs/Client.html | 8 ++++---- docs/Client.js.html | 8 ++++---- docs/ClientInfo.html | 8 ++++---- docs/Contact.html | 8 ++++---- docs/GroupChat.html | 8 ++++---- docs/GroupNotification.html | 8 ++++---- docs/InterfaceController.html | 8 ++++---- docs/Label.html | 8 ++++---- docs/LegacySessionAuth.html | 8 ++++---- docs/List.html | 8 ++++---- docs/LocalAuth.html | 8 ++++---- docs/Location.html | 8 ++++---- docs/Message.html | 8 ++++---- docs/MessageMedia.html | 8 ++++---- docs/NoAuth.html | 8 ++++---- docs/Order.html | 8 ++++---- docs/PrivateChat.html | 8 ++++---- docs/PrivateContact.html | 8 ++++---- docs/Product.html | 8 ++++---- docs/Reaction.html | 8 ++++---- docs/RemoteAuth.html | 8 ++++---- docs/Util.html | 8 ++++---- docs/authStrategies_BaseAuthStrategy.js.html | 8 ++++---- docs/authStrategies_LegacySessionAuth.js.html | 8 ++++---- docs/authStrategies_LocalAuth.js.html | 8 ++++---- docs/authStrategies_NoAuth.js.html | 8 ++++---- docs/authStrategies_RemoteAuth.js.html | 8 ++++---- docs/global.html | 8 ++++---- docs/index.html | 12 +++++------ docs/structures_Base.js.html | 8 ++++---- docs/structures_BusinessContact.js.html | 8 ++++---- docs/structures_Buttons.js.html | 8 ++++---- docs/structures_Call.js.html | 8 ++++---- docs/structures_Chat.js.html | 8 ++++---- docs/structures_ClientInfo.js.html | 8 ++++---- docs/structures_Contact.js.html | 8 ++++---- docs/structures_GroupChat.js.html | 8 ++++---- docs/structures_GroupNotification.js.html | 8 ++++---- docs/structures_Label.js.html | 8 ++++---- docs/structures_List.js.html | 8 ++++---- docs/structures_Location.js.html | 8 ++++---- docs/structures_Message.js.html | 20 ++++++++++--------- docs/structures_MessageMedia.js.html | 8 ++++---- docs/structures_Order.js.html | 8 ++++---- docs/structures_Payment.js.html | 8 ++++---- docs/structures_PrivateChat.js.html | 8 ++++---- docs/structures_PrivateContact.js.html | 8 ++++---- docs/structures_Product.js.html | 8 ++++---- docs/structures_ProductMetadata.js.html | 8 ++++---- docs/structures_Reaction.js.html | 8 ++++---- docs/util_Constants.js.html | 8 ++++---- docs/util_InterfaceController.js.html | 8 ++++---- docs/util_Util.js.html | 8 ++++---- package.json | 2 +- 60 files changed, 246 insertions(+), 244 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index a083e1ca3a5..53e15f45499 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Base + whatsapp-web.js 1.18.4 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 4942559a60a..88de5bb66e7 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: BaseAuthStrategy + whatsapp-web.js 1.18.4 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index c08a29f155f..3269010944c 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: BusinessContact + whatsapp-web.js 1.18.4 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index 4bca95a3607..f619730250c 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Buttons + whatsapp-web.js 1.18.4 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 1fb3718402f..1f049398bfa 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Call + whatsapp-web.js 1.18.4 » Class: Call @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index e1962b8b553..3efe708175a 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Chat + whatsapp-web.js 1.18.4 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 0caa359aed9..60a721719ab 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Client + whatsapp-web.js 1.18.4 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index cfe0679740c..8a16378dd16 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: Client.js + whatsapp-web.js 1.18.4 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1224,7 +1224,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 672f2e7ae14..f9976b7fc2c 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: ClientInfo + whatsapp-web.js 1.18.4 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index a2178935931..515e13b532e 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Contact + whatsapp-web.js 1.18.4 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 0cc37642f5a..e00d4eaade2 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: GroupChat + whatsapp-web.js 1.18.4 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 7988faf35b4..aa4a01c063c 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: GroupNotification + whatsapp-web.js 1.18.4 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index ea2ba998ec9..8b97ada2458 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: InterfaceController + whatsapp-web.js 1.18.4 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index 923d0a82da1..7a429f64c09 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Label + whatsapp-web.js 1.18.4 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index d8daea1601e..65dfb467f4e 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: LegacySessionAuth + whatsapp-web.js 1.18.4 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index 53a5a87731b..2033a98e784 100644 --- a/docs/List.html +++ b/docs/List.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: List + whatsapp-web.js 1.18.4 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 3f295bcc03c..2b8c83eb8f4 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: LocalAuth + whatsapp-web.js 1.18.4 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index 798db80fec5..7714777e4ac 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Location + whatsapp-web.js 1.18.4 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index c9748e5377e..d63f606fe05 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Message + whatsapp-web.js 1.18.4 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 49d54e78ee5..42132819805 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: MessageMedia + whatsapp-web.js 1.18.4 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index f821b5fe145..178c61e00c5 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: NoAuth + whatsapp-web.js 1.18.4 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index 98ef4d741bd..7cc642974a0 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Order + whatsapp-web.js 1.18.4 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index e89e6b9cba2..8317e50246f 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: PrivateChat + whatsapp-web.js 1.18.4 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 1d966cc4000..98c2ee29b1e 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: PrivateContact + whatsapp-web.js 1.18.4 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 1605eadb21f..63989aea3d9 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Product + whatsapp-web.js 1.18.4 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index 61e0c4e8ac5..2499d6e3eaa 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Reaction + whatsapp-web.js 1.18.4 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 28a2eaebded..6d0db6c4089 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: RemoteAuth + whatsapp-web.js 1.18.4 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index c9a03b019c5..e612736af7f 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Class: Util + whatsapp-web.js 1.18.4 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index dba1b7358f3..b914c8f153a 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.18.4 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 861fa78e62b..d48570adb6d 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.18.4 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index c8cd2ffcd46..ba4c6a68eac 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.18.4 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 65269ba77a6..3ad238494f8 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.18.4 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 90965a23032..a9b865e106a 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.18.4 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index 5c2a3328cc7..e098ab7e1b8 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Globals + whatsapp-web.js 1.18.4 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index 3c0349bd307..875bafeb373 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Home + whatsapp-web.js 1.18.4 » Home @@ -15,7 +15,7 @@ @@ -27,11 +27,11 @@
-

npm Depfu WhatsApp_Web 2.2241.6 Discord Chat

+

npm Depfu WhatsApp_Web 2.2245.9 Discord Chat

whatsapp-web.js

A WhatsApp API client that connects through the WhatsApp Web browser app

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

@@ -3276,7 +3276,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 84d94205b3b..3f8c6f8dcf2 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Base.js + whatsapp-web.js 1.18.4 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 5627b3a67c4..1107174c479 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/BusinessContact.js + whatsapp-web.js 1.18.4 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 1555c38bd51..62185c1ad01 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Buttons.js + whatsapp-web.js 1.18.4 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 15ef35a35d4..b67cda95f57 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Call.js + whatsapp-web.js 1.18.4 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index c6352d37547..e2f7f713d2a 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Chat.js + whatsapp-web.js 1.18.4 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index eb40d8eaaf0..a5386507a8a 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/ClientInfo.js + whatsapp-web.js 1.18.4 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 52e76110a07..7ad3563c824 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Contact.js + whatsapp-web.js 1.18.4 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index e8757ac56c0..bf4daa9e568 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/GroupChat.js + whatsapp-web.js 1.18.4 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 0a924bdd0bc..c3e48c52a9c 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/GroupNotification.js + whatsapp-web.js 1.18.4 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 7caa8bcbd74..750c011138f 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Label.js + whatsapp-web.js 1.18.4 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 3c787d8c31a..61531b6bb57 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/List.js + whatsapp-web.js 1.18.4 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 202e68d8d52..a161277c8e7 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Location.js + whatsapp-web.js 1.18.4 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 43e0e028df2..adc947b6eb4 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Message.js + whatsapp-web.js 1.18.4 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -336,8 +336,9 @@

Source: structures/Message.js

if (!this.hasQuotedMsg) return undefined; const quotedMsg = await this.client.pupPage.evaluate((msgId) => { - let msg = window.Store.Msg.get(msgId); - return msg.quotedMsgObj().serialize(); + const msg = window.Store.Msg.get(msgId); + const quotedMsg = window.Store.QuotedMsg.getQuotedMsgObj(msg); + return window.WWebJS.getMessageModel(quotedMsg); }, this.id._serialized); return new Message(this.client, quotedMsg); @@ -467,7 +468,8 @@

Source: structures/Message.js

await this.client.pupPage.evaluate((msgId, everyone) => { let msg = window.Store.Msg.get(msgId); - if (everyone &amp;&amp; msg._canRevoke()) { + 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' }); } @@ -482,7 +484,7 @@

Source: structures/Message.js

await this.client.pupPage.evaluate((msgId) => { let msg = window.Store.Msg.get(msgId); - if (msg.canStar()) { + if (window.Store.MsgActionChecks.canStarMsg(msg)) { return window.Store.Cmd.sendStarMsgs(msg.chat, [msg], false); } }, this.id._serialized); @@ -495,7 +497,7 @@

Source: structures/Message.js

await this.client.pupPage.evaluate((msgId) => { let msg = window.Store.Msg.get(msgId); - if (msg.canStar()) { + if (window.Store.MsgActionChecks.canStarMsg(msg)) { return window.Store.Cmd.sendUnstarMsgs(msg.chat, [msg], false); } }, this.id._serialized); @@ -569,7 +571,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 65b3615fb48..7518e5a0b79 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/MessageMedia.js + whatsapp-web.js 1.18.4 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 42a516912e1..191f8125f48 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Order.js + whatsapp-web.js 1.18.4 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 41aafb16212..b118b402fcf 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Payment.js + whatsapp-web.js 1.18.4 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 8d7d2a90d16..72c40a2d126 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/PrivateChat.js + whatsapp-web.js 1.18.4 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 88010e70e51..c0728786dad 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/PrivateContact.js + whatsapp-web.js 1.18.4 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 6820848958e..202d07eb359 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Product.js + whatsapp-web.js 1.18.4 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 0c6dd41b915..730925a93fa 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.18.4 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 21d744b9a53..2308bab8622 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: structures/Reaction.js + whatsapp-web.js 1.18.4 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index e67ff21f502..ffc1ef92b70 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: util/Constants.js + whatsapp-web.js 1.18.4 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 394330aef2f..2d18f566da5 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: util/InterfaceController.js + whatsapp-web.js 1.18.4 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -160,7 +160,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index e66c61d21b9..a35663a629d 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.18.3 » Source: util/Util.js + whatsapp-web.js 1.18.4 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index 363e0d9e264..450d31fac28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.3", + "version": "1.18.4", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 288a572af6c4794cc6d28127d60327a176b929d4 Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Thu, 22 Dec 2022 21:02:49 +0200 Subject: [PATCH 090/430] feat: Implement Call Rejection + Introduction of Socket API (#1882) * Initial stage * ESLint * eslint is annoying * fix: distinguish Wap from Socket's Wap --- index.d.ts | 3 +++ src/structures/Call.js | 10 +++++++++- src/util/Injected.js | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 76ac2644555..4da695ef8e8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1326,6 +1326,9 @@ declare namespace WAWebJS { webClientShouldHandle: boolean, /** Object with participants */ participants: object + + /** Reject the call */ + reject: () => Promise } /** Message type List */ diff --git a/src/structures/Call.js b/src/structures/Call.js index 1e6644d1ba1..0e48989d545 100644 --- a/src/structures/Call.js +++ b/src/structures/Call.js @@ -62,7 +62,15 @@ class Call extends Base { return super._patch(data); } - + + /** + * Reject the call + */ + async reject() { + return this.client.pupPage.evaluate((peerJid, id) => { + return window.WWebJS.rejectCall(peerJid, id); + }, this.from, this.id); + } } module.exports = Call; \ No newline at end of file diff --git a/src/util/Injected.js b/src/util/Injected.js index 7ece210aed6..a0a7b12d654 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -53,6 +53,8 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0]; window.Store.MsgActionChecks = window.mR.findModule('canSenderRevokeMsg')[0]; window.Store.QuotedMsg = window.mR.findModule('getQuotedMsgObj')[0]; + window.Store.Socket = window.mR.findModule('deprecatedSendIq')[0]; + window.Store.SocketWap = window.mR.findModule('wap')[0]; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], ...window.mR.findModule('addWebpMetadata')[0] @@ -602,4 +604,21 @@ exports.LoadUtils = () => { return undefined; }; + + window.WWebJS.rejectCall = async (peerJid, id) => { + peerJid = peerJid.split('@')[0] + '@s.whatsapp.net'; + let userId = window.Store.User.getMaybeMeUser().user + '@s.whatsapp.net'; + const stanza = window.Store.SocketWap.wap('call', { + id: window.Store.SocketWap.generateId(), + from: window.Store.SocketWap.USER_JID(userId), + to: window.Store.SocketWap.USER_JID(peerJid), + }, [ + window.Store.SocketWap.wap('reject', { + 'call-id': id, + 'call-creator': window.Store.SocketWap.USER_JID(peerJid), + count: '0', + }) + ]); + await window.Store.Socket.deprecatedCastStanza(stanza); + }; }; From a7b77e15ed73a7f1901ead19ffa3060ec7fba5cf Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Fri, 23 Dec 2022 17:10:09 +0200 Subject: [PATCH 091/430] fix: Fix call event listener name + Added Call example (#1886) * fix: bugfix + example * relocate global variable --- example.js | 9 +++++++++ src/util/Constants.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/example.js b/example.js index 99dc7ea00ce..9e5eec59c83 100644 --- a/example.js +++ b/example.js @@ -257,6 +257,15 @@ client.on('change_state', state => { console.log('CHANGE STATE', state ); }); +// Change to false if you don't want to reject incoming calls +let rejectCalls = true; + +client.on('call', async (call) => { + console.log('Call received, rejecting. GOTO Line 261 to disable', call); + if (rejectCalls) await call.reject(); + await client.sendMessage(call.from, `[${call.fromMe ? 'Outgoing' : 'Incoming'}] Phone call from ${call.from}, type ${call.isGroup ? 'group' : ''} ${call.isVideo ? 'video' : 'audio'} call. ${rejectCalls ? 'This call was automatically rejected by the script.' : ''}`); +}); + client.on('disconnected', (reason) => { console.log('Client was logged out', reason); }); diff --git a/src/util/Constants.js b/src/util/Constants.js index d062c7a28c9..4c22fa138d2 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -51,7 +51,7 @@ exports.Events = { DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', BATTERY_CHANGED: 'change_battery', - INCOMING_CALL: 'incoming_call', + INCOMING_CALL: 'call', REMOTE_SESSION_SAVED: 'remote_session_saved' }; From 8655badc0f638530f42e22ed6b2bf3850bd520aa Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Wed, 4 Jan 2023 17:15:35 -0400 Subject: [PATCH 092/430] Create FUNDING.yml (#1901) * Create FUNDING.yml * Update README.md --- .github/FUNDING.yml | 3 +++ README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..4a3a1461c7e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: [pedroslopez, PurpShell] +ko_fi: pedroslopez +custom: ["paypal.me/psla", "buymeacoff.ee/pedroslopez"] diff --git a/README.md b/README.md index 3824f63406c..242dc28d477 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ You can support the maintainer of this project through the links below - [Support via GitHub Sponsors](https://github.com/sponsors/pedroslopez) - [Support via PayPal](https://www.paypal.me/psla/) -- [Sign up for DigitalOcean](https://m.do.co/c/73f906a36ed4) and get $100 in credit when you sign up (Referral) +- [Sign up for DigitalOcean](https://m.do.co/c/73f906a36ed4) and get $200 in credit when you sign up (Referral) ## Disclaimer From 23d5147a142bd790adf891aa55107c272031cf76 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 15 Jan 2023 14:30:20 -0400 Subject: [PATCH 093/430] fix: compatibility with LegacyPhoneFeatures in latest WhatsApp Web version (#1930) * fix removed features on latest wweb version * errors --- src/util/Injected.js | 6 +++++- src/util/InterfaceController.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index a0a7b12d654..e1f38711900 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -13,7 +13,6 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd; window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; - window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures; window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata; window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0]; @@ -87,6 +86,11 @@ exports.ExposeStore = (moduleRaidStr) => { } else { window.Store.MDBackend = true; } + + const _features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0]; + if(_features) { + window.Store.Features = _features.LegacyPhoneFeatures; + } }; exports.LoadUtils = () => { diff --git a/src/util/InterfaceController.js b/src/util/InterfaceController.js index 8a878f8cef3..a87959da633 100644 --- a/src/util/InterfaceController.js +++ b/src/util/InterfaceController.js @@ -79,6 +79,7 @@ class InterfaceController { */ async getFeatures() { return await this.pupPage.evaluate(() => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.F; }); } @@ -89,6 +90,7 @@ class InterfaceController { */ async checkFeatureStatus(feature) { return await this.pupPage.evaluate((feature) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.supportsFeature(feature); }, feature); } @@ -99,6 +101,7 @@ class InterfaceController { */ async enableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], true); } @@ -111,6 +114,7 @@ class InterfaceController { */ async disableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], false); } From 7dd8688f048faad658a6718a57f83488421735da Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sun, 15 Jan 2023 20:32:28 +0200 Subject: [PATCH 094/430] fix: Fix client-side message rendering issue when sending attachements through the library (#1905) --- src/util/Injected.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/Injected.js b/src/util/Injected.js index e1f38711900..bc05602ba02 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -271,6 +271,7 @@ exports.LoadUtils = () => { ...ephemeralFields, ...locationOptions, ...attOptions, + ...(Object.keys(attOptions).length > 0 ? attOptions.toJSON() : {}), ...quotedMsgOptions, ...vcardOptions, ...buttonOptions, From bd0e27a0d0bd387409bf74432240c129eb937ca0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 15 Jan 2023 14:34:23 -0400 Subject: [PATCH 095/430] Update supported WhatsApp Web version to v2.2301.6 (#1869) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 242dc28d477..54c439b19ed 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2245.9](https://img.shields.io/badge/WhatsApp_Web-2.2245.9-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2301.6](https://img.shields.io/badge/WhatsApp_Web-2.2301.6-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 53ab36c0b5a..07e78805ef4 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2245.9 \ No newline at end of file +2.2301.6 \ No newline at end of file From bd192993b7369feacd82ecef551eeaa61fea658d Mon Sep 17 00:00:00 2001 From: tofers Date: Sun, 15 Jan 2023 21:35:26 +0300 Subject: [PATCH 096/430] fix method downloadMedia when not found msg (#1852) Co-authored-by: Rajeh Taher --- src/structures/Message.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index ee79c201774..7ac55366d42 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -386,7 +386,9 @@ class Message extends Base { const result = await this.client.pupPage.evaluate(async (msgId) => { const msg = window.Store.Msg.get(msgId); - + if (!msg) { + return undefined; + } if (msg.mediaData.mediaStage != 'RESOLVED') { // try to resolve media await msg.downloadMedia({ From a525e2330a917981f1af00e1c582f56e6d20caea Mon Sep 17 00:00:00 2001 From: Azeem Haider Date: Sun, 15 Jan 2023 23:36:08 +0500 Subject: [PATCH 097/430] Adding missing CALL in events enum (#1899) --- index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 4da695ef8e8..6abef660cde 100644 --- a/index.d.ts +++ b/index.d.ts @@ -506,7 +506,8 @@ declare namespace WAWebJS { DISCONNECTED = 'disconnected', STATE_CHANGED = 'change_state', BATTERY_CHANGED = 'change_battery', - REMOTE_SESSION_SAVED = 'remote_session_saved' + REMOTE_SESSION_SAVED = 'remote_session_saved', + CALL = 'call' } /** Group notification types */ From d2479f397e482da097cfe0f0544f2ee981febc59 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 14:38:46 -0400 Subject: [PATCH 098/430] chore: mark version v1.19.0 --- docs/Base.html | 6 ++-- docs/BaseAuthStrategy.html | 6 ++-- docs/BusinessContact.html | 6 ++-- docs/Buttons.html | 6 ++-- docs/Call.html | 30 +++++++++++++++++-- docs/Chat.html | 6 ++-- docs/Client.html | 6 ++-- docs/Client.js.html | 6 ++-- docs/ClientInfo.html | 6 ++-- docs/Contact.html | 6 ++-- docs/GroupChat.html | 6 ++-- docs/GroupNotification.html | 6 ++-- docs/InterfaceController.html | 6 ++-- docs/Label.html | 6 ++-- docs/LegacySessionAuth.html | 6 ++-- docs/List.html | 6 ++-- docs/LocalAuth.html | 6 ++-- docs/Location.html | 6 ++-- docs/Message.html | 6 ++-- docs/MessageMedia.html | 6 ++-- docs/NoAuth.html | 6 ++-- docs/Order.html | 6 ++-- docs/PrivateChat.html | 6 ++-- docs/PrivateContact.html | 6 ++-- docs/Product.html | 6 ++-- docs/Reaction.html | 6 ++-- docs/RemoteAuth.html | 6 ++-- docs/Util.html | 6 ++-- docs/authStrategies_BaseAuthStrategy.js.html | 6 ++-- docs/authStrategies_LegacySessionAuth.js.html | 6 ++-- docs/authStrategies_LocalAuth.js.html | 6 ++-- docs/authStrategies_NoAuth.js.html | 6 ++-- docs/authStrategies_RemoteAuth.js.html | 6 ++-- docs/global.html | 6 ++-- docs/index.html | 17 +++++++---- docs/structures_Base.js.html | 6 ++-- docs/structures_BusinessContact.js.html | 6 ++-- docs/structures_Buttons.js.html | 6 ++-- docs/structures_Call.js.html | 16 +++++++--- docs/structures_Chat.js.html | 6 ++-- docs/structures_ClientInfo.js.html | 6 ++-- docs/structures_Contact.js.html | 6 ++-- docs/structures_GroupChat.js.html | 6 ++-- 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 | 10 ++++--- docs/structures_MessageMedia.js.html | 6 ++-- docs/structures_Order.js.html | 6 ++-- docs/structures_Payment.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/util_Constants.js.html | 8 ++--- docs/util_InterfaceController.js.html | 10 +++++-- docs/util_Util.js.html | 6 ++-- package.json | 2 +- 60 files changed, 227 insertions(+), 184 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 53e15f45499..6d4df28f895 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Base + whatsapp-web.js 1.19.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 88de5bb66e7..d73f022c775 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 3269010944c..fa8ffff1c22 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: BusinessContact + whatsapp-web.js 1.19.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index f619730250c..aea422971e4 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Buttons + whatsapp-web.js 1.19.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 1f049398bfa..532867a65ec 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Call + whatsapp-web.js 1.19.0 » Class: Call @@ -15,7 +15,7 @@ @@ -78,6 +78,22 @@

Properties

+
+

Method

+
+
+
+
reject()
+
+
+
+
+
+
+
+
+
+

new Call()

@@ -135,6 +151,14 @@

webClientShouldHandle

+

Method

+
+
async
+

reject()

+

Reject the call

+
+
+
@@ -144,7 +168,7 @@

webClientShouldHandle diff --git a/docs/Chat.html b/docs/Chat.html index 3efe708175a..7ef6426f022 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Chat + whatsapp-web.js 1.19.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 60a721719ab..3d5be243cbd 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Client + whatsapp-web.js 1.19.0 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 8a16378dd16..17a955ef70d 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: Client.js + whatsapp-web.js 1.19.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1224,7 +1224,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index f9976b7fc2c..b6e3a0b9785 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: ClientInfo + whatsapp-web.js 1.19.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index 515e13b532e..3f0658d24f7 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Contact + whatsapp-web.js 1.19.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index e00d4eaade2..2ae8fbc7336 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: GroupChat + whatsapp-web.js 1.19.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index aa4a01c063c..eb482e8048b 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: GroupNotification + whatsapp-web.js 1.19.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 8b97ada2458..33c243dffd2 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: InterfaceController + whatsapp-web.js 1.19.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index 7a429f64c09..e7361d98763 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Label + whatsapp-web.js 1.19.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 65dfb467f4e..38af38191af 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: LegacySessionAuth + whatsapp-web.js 1.19.0 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index 2033a98e784..22880df9f47 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: List + whatsapp-web.js 1.19.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 2b8c83eb8f4..65ecb371700 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: LocalAuth + whatsapp-web.js 1.19.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index 7714777e4ac..67a75823683 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Location + whatsapp-web.js 1.19.0 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index d63f606fe05..071506d36a8 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Message + whatsapp-web.js 1.19.0 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 42132819805..980a53fc57b 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: MessageMedia + whatsapp-web.js 1.19.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 178c61e00c5..04b3c9fc4d9 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: NoAuth + whatsapp-web.js 1.19.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index 7cc642974a0..d25e1f2127a 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Order + whatsapp-web.js 1.19.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 8317e50246f..abe558c9654 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: PrivateChat + whatsapp-web.js 1.19.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 98c2ee29b1e..8987daa02bc 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: PrivateContact + whatsapp-web.js 1.19.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 63989aea3d9..896000f469c 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Product + whatsapp-web.js 1.19.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index 2499d6e3eaa..6e7df361da0 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Reaction + whatsapp-web.js 1.19.0 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 6d0db6c4089..e37622a6065 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: RemoteAuth + whatsapp-web.js 1.19.0 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index e612736af7f..cba7d45f181 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Class: Util + whatsapp-web.js 1.19.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index b914c8f153a..4417f6bb898 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index d48570adb6d..60dfe747a38 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index ba4c6a68eac..c8aa59f4134 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 3ad238494f8..ecd96252729 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index a9b865e106a..1d5b67f54c6 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.0 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index e098ab7e1b8..c88dfaa7ab7 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Globals + whatsapp-web.js 1.19.0 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index 875bafeb373..8687453e272 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Home + whatsapp-web.js 1.19.0 » Home @@ -15,7 +15,7 @@ @@ -27,11 +27,11 @@
-

npm Depfu WhatsApp_Web 2.2245.9 Discord Chat

+

npm Depfu WhatsApp_Web 2.2301.6 Discord Chat

whatsapp-web.js

A WhatsApp API client that connects through the WhatsApp Web browser app

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

@@ -197,7 +197,7 @@

Supporting the project

Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

@@ -498,6 +498,11 @@

Call

+
+ Call#reject() +
+
+
Call#timestamp
@@ -3276,7 +3281,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 3f8c6f8dcf2..66418ba951d 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Base.js + whatsapp-web.js 1.19.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 1107174c479..0924cc27b20 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 62185c1ad01..9cbf169dee1 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Buttons.js + whatsapp-web.js 1.19.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index b67cda95f57..2ceb625a59a 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Call.js + whatsapp-web.js 1.19.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -93,7 +93,15 @@

Source: structures/Call.js

return super._patch(data); } - + + /** + * Reject the call + */ + async reject() { + return this.client.pupPage.evaluate((peerJid, id) => { + return window.WWebJS.rejectCall(peerJid, id); + }, this.from, this.id); + } } module.exports = Call; @@ -106,7 +114,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index e2f7f713d2a..2cee8f87ce3 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Chat.js + whatsapp-web.js 1.19.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index a5386507a8a..1055ab66bb6 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 7ad3563c824..4cbed822bb1 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Contact.js + whatsapp-web.js 1.19.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index bf4daa9e568..af108d3c0a1 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -272,7 +272,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index c3e48c52a9c..2f982a8d924 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 750c011138f..4c94add33a3 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Label.js + whatsapp-web.js 1.19.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 61531b6bb57..9c8c20a58e0 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/List.js + whatsapp-web.js 1.19.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index a161277c8e7..3fef82f557a 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Location.js + whatsapp-web.js 1.19.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index adc947b6eb4..e8dc63511ff 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Message.js + whatsapp-web.js 1.19.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -417,7 +417,9 @@

Source: structures/Message.js

const result = await this.client.pupPage.evaluate(async (msgId) => { const msg = window.Store.Msg.get(msgId); - + if (!msg) { + return undefined; + } if (msg.mediaData.mediaStage != 'RESOLVED') { // try to resolve media await msg.downloadMedia({ @@ -571,7 +573,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 7518e5a0b79..0b220cd94fd 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 191f8125f48..497111543f9 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Order.js + whatsapp-web.js 1.19.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index b118b402fcf..9399cfdda59 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Payment.js + whatsapp-web.js 1.19.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 72c40a2d126..cdba2e74817 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index c0728786dad..a9adad18033 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 202d07eb359..d5e49962013 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Product.js + whatsapp-web.js 1.19.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 730925a93fa..5b035fd3ea0 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 2308bab8622..828d26c4020 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: structures/Reaction.js + whatsapp-web.js 1.19.0 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index ffc1ef92b70..d344f3c8c79 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: util/Constants.js + whatsapp-web.js 1.19.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -82,7 +82,7 @@

Source: util/Constants.js

DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', BATTERY_CHANGED: 'change_battery', - INCOMING_CALL: 'incoming_call', + INCOMING_CALL: 'call', REMOTE_SESSION_SAVED: 'remote_session_saved' }; @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 2d18f566da5..442064e8865 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -110,6 +110,7 @@

Source: util/InterfaceController.js

*/ async getFeatures() { return await this.pupPage.evaluate(() => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.F; }); } @@ -120,6 +121,7 @@

Source: util/InterfaceController.js

*/ async checkFeatureStatus(feature) { return await this.pupPage.evaluate((feature) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); return window.Store.Features.supportsFeature(feature); }, feature); } @@ -130,6 +132,7 @@

Source: util/InterfaceController.js

*/ async enableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], true); } @@ -142,6 +145,7 @@

Source: util/InterfaceController.js

*/ async disableFeatures(features) { await this.pupPage.evaluate((features) => { + if(!window.Store.Features) throw new Error('This version of Whatsapp Web does not support features'); for (const feature in features) { window.Store.Features.setFeature(features[feature], false); } @@ -160,7 +164,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index a35663a629d..60e966f4519 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.18.4 » Source: util/Util.js + whatsapp-web.js 1.19.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index 450d31fac28..366aa7c78ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.18.4", + "version": "1.19.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From e1917494bf44fa77a77b1156cb042b43f7d58adf Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 15 Jan 2023 14:54:50 -0400 Subject: [PATCH 099/430] Revert "fix: Fix client-side message rendering issue when sending attachements through the library (#1905)" (#1932) This reverts commit 7dd8688f048faad658a6718a57f83488421735da. --- src/util/Injected.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index bc05602ba02..e1f38711900 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -271,7 +271,6 @@ exports.LoadUtils = () => { ...ephemeralFields, ...locationOptions, ...attOptions, - ...(Object.keys(attOptions).length > 0 ? attOptions.toJSON() : {}), ...quotedMsgOptions, ...vcardOptions, ...buttonOptions, From 1e3374f0cd4fc5ba28b8611336f8ada36aa16be8 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 14:55:28 -0400 Subject: [PATCH 100/430] chore: mark version v1.19.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 366aa7c78ac..a396b2db4d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.0", + "version": "1.19.1", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 698305f66882f3ef8c37cdcf7ca0daee45dac9fb Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 14:56:00 -0400 Subject: [PATCH 101/430] update docs for 1.19.1 --- docs/Base.html | 4 ++-- docs/BaseAuthStrategy.html | 4 ++-- docs/BusinessContact.html | 4 ++-- docs/Buttons.html | 4 ++-- docs/Call.html | 4 ++-- docs/Chat.html | 4 ++-- docs/Client.html | 4 ++-- docs/Client.js.html | 4 ++-- docs/ClientInfo.html | 4 ++-- docs/Contact.html | 4 ++-- docs/GroupChat.html | 4 ++-- docs/GroupNotification.html | 4 ++-- docs/InterfaceController.html | 4 ++-- docs/Label.html | 4 ++-- docs/LegacySessionAuth.html | 4 ++-- docs/List.html | 4 ++-- docs/LocalAuth.html | 4 ++-- docs/Location.html | 4 ++-- docs/Message.html | 4 ++-- docs/MessageMedia.html | 4 ++-- docs/NoAuth.html | 4 ++-- docs/Order.html | 4 ++-- docs/PrivateChat.html | 4 ++-- docs/PrivateContact.html | 4 ++-- docs/Product.html | 4 ++-- docs/Reaction.html | 4 ++-- docs/RemoteAuth.html | 4 ++-- docs/Util.html | 4 ++-- docs/authStrategies_BaseAuthStrategy.js.html | 4 ++-- docs/authStrategies_LegacySessionAuth.js.html | 4 ++-- docs/authStrategies_LocalAuth.js.html | 4 ++-- docs/authStrategies_NoAuth.js.html | 4 ++-- docs/authStrategies_RemoteAuth.js.html | 4 ++-- docs/global.html | 4 ++-- docs/index.html | 6 +++--- docs/structures_Base.js.html | 4 ++-- docs/structures_BusinessContact.js.html | 4 ++-- docs/structures_Buttons.js.html | 4 ++-- docs/structures_Call.js.html | 4 ++-- docs/structures_Chat.js.html | 4 ++-- docs/structures_ClientInfo.js.html | 4 ++-- docs/structures_Contact.js.html | 4 ++-- docs/structures_GroupChat.js.html | 4 ++-- docs/structures_GroupNotification.js.html | 4 ++-- docs/structures_Label.js.html | 4 ++-- docs/structures_List.js.html | 4 ++-- docs/structures_Location.js.html | 4 ++-- docs/structures_Message.js.html | 4 ++-- docs/structures_MessageMedia.js.html | 4 ++-- docs/structures_Order.js.html | 4 ++-- docs/structures_Payment.js.html | 4 ++-- docs/structures_PrivateChat.js.html | 4 ++-- docs/structures_PrivateContact.js.html | 4 ++-- docs/structures_Product.js.html | 4 ++-- docs/structures_ProductMetadata.js.html | 4 ++-- docs/structures_Reaction.js.html | 4 ++-- docs/util_Constants.js.html | 4 ++-- docs/util_InterfaceController.js.html | 4 ++-- docs/util_Util.js.html | 4 ++-- 59 files changed, 119 insertions(+), 119 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 6d4df28f895..405ceda0884 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Base + whatsapp-web.js 1.19.1 » Class: Base @@ -15,7 +15,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index d73f022c775..7e45bbdd5c4 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.1 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index fa8ffff1c22..a0096378951 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: BusinessContact + whatsapp-web.js 1.19.1 » Class: BusinessContact @@ -15,7 +15,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index aea422971e4..eda638764ec 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Buttons + whatsapp-web.js 1.19.1 » Class: Buttons @@ -15,7 +15,7 @@ diff --git a/docs/Call.html b/docs/Call.html index 532867a65ec..5bf102ce405 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Call + whatsapp-web.js 1.19.1 » Class: Call @@ -15,7 +15,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index 7ef6426f022..58d67b0c869 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Chat + whatsapp-web.js 1.19.1 » Class: Chat @@ -15,7 +15,7 @@ diff --git a/docs/Client.html b/docs/Client.html index 3d5be243cbd..de09c4a7e7e 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Client + whatsapp-web.js 1.19.1 » Class: Client @@ -15,7 +15,7 @@ diff --git a/docs/Client.js.html b/docs/Client.js.html index 17a955ef70d..e3e7bb4bdf2 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: Client.js + whatsapp-web.js 1.19.1 » Source: Client.js @@ -15,7 +15,7 @@ diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index b6e3a0b9785..2653b0ccdd9 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: ClientInfo + whatsapp-web.js 1.19.1 » Class: ClientInfo @@ -15,7 +15,7 @@ diff --git a/docs/Contact.html b/docs/Contact.html index 3f0658d24f7..3144b3afccd 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Contact + whatsapp-web.js 1.19.1 » Class: Contact @@ -15,7 +15,7 @@ diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 2ae8fbc7336..9cabfa227c1 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: GroupChat + whatsapp-web.js 1.19.1 » Class: GroupChat @@ -15,7 +15,7 @@ diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index eb482e8048b..419bcf981ac 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: GroupNotification + whatsapp-web.js 1.19.1 » Class: GroupNotification @@ -15,7 +15,7 @@ diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 33c243dffd2..2d73cf874ee 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: InterfaceController + whatsapp-web.js 1.19.1 » Class: InterfaceController @@ -15,7 +15,7 @@ diff --git a/docs/Label.html b/docs/Label.html index e7361d98763..578779f0707 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Label + whatsapp-web.js 1.19.1 » Class: Label @@ -15,7 +15,7 @@ diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 38af38191af..833f2c400a4 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: LegacySessionAuth + whatsapp-web.js 1.19.1 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ diff --git a/docs/List.html b/docs/List.html index 22880df9f47..ead1c220036 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: List + whatsapp-web.js 1.19.1 » Class: List @@ -15,7 +15,7 @@ diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 65ecb371700..54cb42a7e8e 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: LocalAuth + whatsapp-web.js 1.19.1 » Class: LocalAuth @@ -15,7 +15,7 @@ diff --git a/docs/Location.html b/docs/Location.html index 67a75823683..fd1926c7928 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Location + whatsapp-web.js 1.19.1 » Class: Location @@ -15,7 +15,7 @@ diff --git a/docs/Message.html b/docs/Message.html index 071506d36a8..17825457f43 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Message + whatsapp-web.js 1.19.1 » Class: Message @@ -15,7 +15,7 @@ diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 980a53fc57b..33359d362cf 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: MessageMedia + whatsapp-web.js 1.19.1 » Class: MessageMedia @@ -15,7 +15,7 @@ diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 04b3c9fc4d9..119126acf13 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: NoAuth + whatsapp-web.js 1.19.1 » Class: NoAuth @@ -15,7 +15,7 @@ diff --git a/docs/Order.html b/docs/Order.html index d25e1f2127a..ea747c4655f 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Order + whatsapp-web.js 1.19.1 » Class: Order @@ -15,7 +15,7 @@ diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index abe558c9654..f38ad1e596c 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: PrivateChat + whatsapp-web.js 1.19.1 » Class: PrivateChat @@ -15,7 +15,7 @@ diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 8987daa02bc..3473ea03788 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: PrivateContact + whatsapp-web.js 1.19.1 » Class: PrivateContact @@ -15,7 +15,7 @@ diff --git a/docs/Product.html b/docs/Product.html index 896000f469c..457f833d6ed 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Product + whatsapp-web.js 1.19.1 » Class: Product @@ -15,7 +15,7 @@ diff --git a/docs/Reaction.html b/docs/Reaction.html index 6e7df361da0..05170041493 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Reaction + whatsapp-web.js 1.19.1 » Class: Reaction @@ -15,7 +15,7 @@ diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index e37622a6065..5f1baa776c5 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: RemoteAuth + whatsapp-web.js 1.19.1 » Class: RemoteAuth @@ -15,7 +15,7 @@ diff --git a/docs/Util.html b/docs/Util.html index cba7d45f181..5083b76f00c 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Class: Util + whatsapp-web.js 1.19.1 » Class: Util @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 4417f6bb898..2db95235c7f 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.1 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 60dfe747a38..ed0343d79db 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index c8aa59f4134..63203666d6b 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index ecd96252729..1be866f9f9a 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 1d5b67f54c6..f7f48d2e62d 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.1 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/global.html b/docs/global.html index c88dfaa7ab7..f599dc79d4e 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Globals + whatsapp-web.js 1.19.1 » Globals @@ -15,7 +15,7 @@ diff --git a/docs/index.html b/docs/index.html index 8687453e272..7b3457e400a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Home + whatsapp-web.js 1.19.1 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 66418ba951d..4e70ed72a11 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Base.js + whatsapp-web.js 1.19.1 » Source: structures/Base.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 0924cc27b20..e7600cd55b0 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.1 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 9cbf169dee1..3a79b8d5c3e 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Buttons.js + whatsapp-web.js 1.19.1 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 2ceb625a59a..2c64c0a94f3 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Call.js + whatsapp-web.js 1.19.1 » Source: structures/Call.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 2cee8f87ce3..0fab4cbc11e 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Chat.js + whatsapp-web.js 1.19.1 » Source: structures/Chat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 1055ab66bb6..4c205c76237 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.1 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 4cbed822bb1..2da12453e54 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Contact.js + whatsapp-web.js 1.19.1 » Source: structures/Contact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index af108d3c0a1..7635f2ea860 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.1 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 2f982a8d924..882f1cd1780 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.1 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 4c94add33a3..84fe4a5982f 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Label.js + whatsapp-web.js 1.19.1 » Source: structures/Label.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 9c8c20a58e0..5b902080382 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/List.js + whatsapp-web.js 1.19.1 » Source: structures/List.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 3fef82f557a..5d66947c06d 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Location.js + whatsapp-web.js 1.19.1 » Source: structures/Location.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index e8dc63511ff..0c4d051282f 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Message.js + whatsapp-web.js 1.19.1 » Source: structures/Message.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 0b220cd94fd..499f7cfb6bd 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.1 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 497111543f9..9ad5d7ec72d 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Order.js + whatsapp-web.js 1.19.1 » Source: structures/Order.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 9399cfdda59..e934dd14b0b 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Payment.js + whatsapp-web.js 1.19.1 » Source: structures/Payment.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index cdba2e74817..b7af1457300 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.1 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index a9adad18033..7aec0d9865a 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.1 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index d5e49962013..9e78871cf39 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Product.js + whatsapp-web.js 1.19.1 » Source: structures/Product.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 5b035fd3ea0..ba7f554f2b1 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.1 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 828d26c4020..6b470247390 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: structures/Reaction.js + whatsapp-web.js 1.19.1 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index d344f3c8c79..12a26d5159f 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: util/Constants.js + whatsapp-web.js 1.19.1 » Source: util/Constants.js @@ -15,7 +15,7 @@ diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 442064e8865..02b7dc3b3d2 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.1 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 60e966f4519..5f19a8f8391 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.0 » Source: util/Util.js + whatsapp-web.js 1.19.1 » Source: util/Util.js @@ -15,7 +15,7 @@ From 70f2391d51c6684dc22b84d7518b9ea9482ab83e Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Sun, 15 Jan 2023 17:59:20 -0400 Subject: [PATCH 102/430] fix group methods (#1934) * fix: create group * fix set group subject, description, properties; exit group * fix participant methods * fix return type * fix invite methods --- src/Client.js | 18 +++++----- src/structures/GroupChat.js | 70 ++++++++++++++++++++++++------------- src/util/Injected.js | 12 +++---- 3 files changed, 60 insertions(+), 40 deletions(-) diff --git a/src/Client.js b/src/Client.js index d3c9bb42df7..7a09d7a8d94 100644 --- a/src/Client.js +++ b/src/Client.js @@ -774,7 +774,7 @@ class Client extends EventEmitter { */ async getInviteInfo(inviteCode) { return await this.pupPage.evaluate(inviteCode => { - return window.Store.InviteInfo.sendQueryGroupInvite(inviteCode); + return window.Store.InviteInfo.queryGroupInvite(inviteCode); }, inviteCode); } @@ -784,11 +784,11 @@ class Client extends EventEmitter { * @returns {Promise} Id of the joined Chat */ async acceptInvite(inviteCode) { - const chatId = await this.pupPage.evaluate(async inviteCode => { - return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode); + const res = await this.pupPage.evaluate(async inviteCode => { + return await window.Store.Invite.joinGroupViaInvite(inviteCode); }, inviteCode); - return chatId._serialized; + return res.gid._serialized; } /** @@ -1095,19 +1095,17 @@ class Client extends EventEmitter { const createRes = await this.pupPage.evaluate(async (name, participantIds) => { const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p)); - const id = window.Store.MsgKey.newId(); - const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id); - return res; + return await window.Store.GroupUtils.createGroup(name, participantWIDs, 0); }, name, participants); const missingParticipants = createRes.participants.reduce(((missing, c) => { - const id = Object.keys(c)[0]; - const statusCode = c[id].code; + const id = c.wid._serialized; + const statusCode = c.error ? c.error.toString() : '200'; if (statusCode != 200) return Object.assign(missing, { [id]: statusCode }); return missing; }), {}); - return { gid: createRes.gid, missingParticipants }; + return { gid: createRes.wid, missingParticipants }; } /** diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index c11f5a9784e..0be6b62e101 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -59,10 +59,15 @@ class GroupChat extends Chat { * @returns {Promise} */ async addParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = await Promise.all(participantIds.map(async p => { + const wid = window.Store.WidFactory.createWid(p); + return await window.Store.Contact.get(wid); + })); + await window.Store.GroupParticipants.addParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -72,10 +77,14 @@ class GroupChat extends Chat { * @returns {Promise} */ async removeParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.removeParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -85,10 +94,14 @@ class GroupChat extends Chat { * @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful */ async promoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.promoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -98,10 +111,14 @@ class GroupChat extends Chat { * @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful */ async demoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.demoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -114,7 +131,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, subject) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject); + await window.Store.GroupUtils.setGroupSubject(chatWid, subject); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -136,7 +154,8 @@ class GroupChat extends Chat { const chatWid = window.Store.WidFactory.createWid(chatId); let descId = window.Store.GroupMetadata.get(chatWid).descId; try { - return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -157,7 +176,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -179,7 +199,8 @@ class GroupChat extends Chat { const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -197,12 +218,12 @@ class GroupChat extends Chat { * @returns {Promise} Group's invite code */ async getInviteCode() { - const code = await this.client.pupPage.evaluate(async chatId => { + const codeRes = await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendQueryGroupInviteCode(chatWid); + return window.Store.Invite.queryGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -210,12 +231,12 @@ class GroupChat extends Chat { * @returns {Promise} New invite code */ async revokeInvite() { - const code = await this.client.pupPage.evaluate(chatId => { + const codeRes = await this.client.pupPage.evaluate(chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendRevokeGroupInviteCode(chatWid); + return window.Store.Invite.resetGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -223,9 +244,10 @@ class GroupChat extends Chat { * @returns {Promise} */ async leave() { - await this.client.pupPage.evaluate(chatId => { + await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.GroupUtils.sendExitGroup(chatWid); + const chat = await window.Store.Chat.find(chatWid); + return window.Store.GroupUtils.sendExitGroup(chat); }, this.id._serialized); } diff --git a/src/util/Injected.js b/src/util/Injected.js index e1f38711900..7acc145681c 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -14,8 +14,8 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0]; window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager; window.Store.GroupMetadata = window.mR.findModule('GroupMetadata')[0].default.GroupMetadata; - window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0]; - window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0]; + window.Store.Invite = window.mR.findModule('resetGroupInviteCode')[0]; + window.Store.InviteInfo = window.mR.findModule('queryGroupInvite')[0]; window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection; window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0]; window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0]; @@ -41,7 +41,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0]; window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0]; window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0]; - window.Store.GroupParticipants = window.mR.findModule('sendPromoteParticipants')[0]; + window.Store.GroupParticipants = window.mR.findModule('promoteParticipants')[1]; window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0]; window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups; window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0]; @@ -60,9 +60,9 @@ exports.ExposeStore = (moduleRaidStr) => { }; window.Store.GroupUtils = { - ...window.mR.findModule('sendCreateGroup')[0], - ...window.mR.findModule('sendSetGroupSubject')[0], - ...window.mR.findModule('markExited')[0] + ...window.mR.findModule('createGroup')[0], + ...window.mR.findModule('setGroupDescription')[0], + ...window.mR.findModule('sendExitGroup')[0] }; if (!window.Store.Chat._find) { From 6cead95f3c08403a0ad5c49e3a2508e3fb45dc14 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 15 Jan 2023 18:00:25 -0400 Subject: [PATCH 103/430] chore: mark version v1.19.2 --- docs/Base.html | 4 +- docs/BaseAuthStrategy.html | 4 +- docs/BusinessContact.html | 4 +- docs/Buttons.html | 4 +- docs/Call.html | 4 +- docs/Chat.html | 4 +- docs/Client.html | 4 +- docs/Client.js.html | 22 +++--- docs/ClientInfo.html | 4 +- docs/Contact.html | 4 +- docs/GroupChat.html | 4 +- docs/GroupNotification.html | 4 +- docs/InterfaceController.html | 4 +- docs/Label.html | 4 +- docs/LegacySessionAuth.html | 4 +- docs/List.html | 4 +- docs/LocalAuth.html | 4 +- docs/Location.html | 4 +- docs/Message.html | 4 +- docs/MessageMedia.html | 4 +- docs/NoAuth.html | 4 +- docs/Order.html | 4 +- docs/PrivateChat.html | 4 +- docs/PrivateContact.html | 4 +- docs/Product.html | 4 +- docs/Reaction.html | 4 +- docs/RemoteAuth.html | 4 +- docs/Util.html | 4 +- docs/authStrategies_BaseAuthStrategy.js.html | 4 +- docs/authStrategies_LegacySessionAuth.js.html | 4 +- docs/authStrategies_LocalAuth.js.html | 4 +- docs/authStrategies_NoAuth.js.html | 4 +- docs/authStrategies_RemoteAuth.js.html | 4 +- docs/global.html | 4 +- docs/index.html | 6 +- docs/structures_Base.js.html | 4 +- docs/structures_BusinessContact.js.html | 4 +- docs/structures_Buttons.js.html | 4 +- docs/structures_Call.js.html | 4 +- docs/structures_Chat.js.html | 4 +- docs/structures_ClientInfo.js.html | 4 +- docs/structures_Contact.js.html | 4 +- docs/structures_GroupChat.js.html | 74 ++++++++++++------- docs/structures_GroupNotification.js.html | 4 +- docs/structures_Label.js.html | 4 +- docs/structures_List.js.html | 4 +- docs/structures_Location.js.html | 4 +- docs/structures_Message.js.html | 4 +- docs/structures_MessageMedia.js.html | 4 +- docs/structures_Order.js.html | 4 +- docs/structures_Payment.js.html | 4 +- docs/structures_PrivateChat.js.html | 4 +- docs/structures_PrivateContact.js.html | 4 +- docs/structures_Product.js.html | 4 +- docs/structures_ProductMetadata.js.html | 4 +- docs/structures_Reaction.js.html | 4 +- docs/util_Constants.js.html | 4 +- docs/util_InterfaceController.js.html | 4 +- docs/util_Util.js.html | 4 +- package.json | 2 +- 60 files changed, 174 insertions(+), 154 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 405ceda0884..f24dffd81ee 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Base + whatsapp-web.js 1.19.2 » Class: Base @@ -15,7 +15,7 @@ diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 7e45bbdd5c4..734f02dfe89 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.2 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index a0096378951..66a9d7469b0 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: BusinessContact + whatsapp-web.js 1.19.2 » Class: BusinessContact @@ -15,7 +15,7 @@ diff --git a/docs/Buttons.html b/docs/Buttons.html index eda638764ec..5d57a0ed223 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Buttons + whatsapp-web.js 1.19.2 » Class: Buttons @@ -15,7 +15,7 @@ diff --git a/docs/Call.html b/docs/Call.html index 5bf102ce405..3c190bfcfe5 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Call + whatsapp-web.js 1.19.2 » Class: Call @@ -15,7 +15,7 @@ diff --git a/docs/Chat.html b/docs/Chat.html index 58d67b0c869..4cf62763424 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Chat + whatsapp-web.js 1.19.2 » Class: Chat @@ -15,7 +15,7 @@ diff --git a/docs/Client.html b/docs/Client.html index de09c4a7e7e..cd112ddb446 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Client + whatsapp-web.js 1.19.2 » Class: Client @@ -15,7 +15,7 @@ diff --git a/docs/Client.js.html b/docs/Client.js.html index e3e7bb4bdf2..c5f6c316d94 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: Client.js + whatsapp-web.js 1.19.2 » Source: Client.js @@ -15,7 +15,7 @@ @@ -805,7 +805,7 @@

Source: Client.js

*/ async getInviteInfo(inviteCode) { return await this.pupPage.evaluate(inviteCode => { - return window.Store.InviteInfo.sendQueryGroupInvite(inviteCode); + return window.Store.InviteInfo.queryGroupInvite(inviteCode); }, inviteCode); } @@ -815,11 +815,11 @@

Source: Client.js

* @returns {Promise&lt;string>} Id of the joined Chat */ async acceptInvite(inviteCode) { - const chatId = await this.pupPage.evaluate(async inviteCode => { - return await window.Store.Invite.sendJoinGroupViaInvite(inviteCode); + const res = await this.pupPage.evaluate(async inviteCode => { + return await window.Store.Invite.joinGroupViaInvite(inviteCode); }, inviteCode); - return chatId._serialized; + return res.gid._serialized; } /** @@ -1126,19 +1126,17 @@

Source: Client.js

const createRes = await this.pupPage.evaluate(async (name, participantIds) => { const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p)); - const id = window.Store.MsgKey.newId(); - const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id); - return res; + return await window.Store.GroupUtils.createGroup(name, participantWIDs, 0); }, name, participants); const missingParticipants = createRes.participants.reduce(((missing, c) => { - const id = Object.keys(c)[0]; - const statusCode = c[id].code; + const id = c.wid._serialized; + const statusCode = c.error ? c.error.toString() : '200'; if (statusCode != 200) return Object.assign(missing, { [id]: statusCode }); return missing; }), {}); - return { gid: createRes.gid, missingParticipants }; + return { gid: createRes.wid, missingParticipants }; } /** diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 2653b0ccdd9..35c3a488837 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: ClientInfo + whatsapp-web.js 1.19.2 » Class: ClientInfo @@ -15,7 +15,7 @@ diff --git a/docs/Contact.html b/docs/Contact.html index 3144b3afccd..7a35f051247 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Contact + whatsapp-web.js 1.19.2 » Class: Contact @@ -15,7 +15,7 @@ diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 9cabfa227c1..2f7ed979b39 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: GroupChat + whatsapp-web.js 1.19.2 » Class: GroupChat @@ -15,7 +15,7 @@ diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 419bcf981ac..08fcd3437ae 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: GroupNotification + whatsapp-web.js 1.19.2 » Class: GroupNotification @@ -15,7 +15,7 @@ diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 2d73cf874ee..92e11fb0cbb 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: InterfaceController + whatsapp-web.js 1.19.2 » Class: InterfaceController @@ -15,7 +15,7 @@ diff --git a/docs/Label.html b/docs/Label.html index 578779f0707..e3e390064c4 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Label + whatsapp-web.js 1.19.2 » Class: Label @@ -15,7 +15,7 @@ diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 833f2c400a4..4331e896c57 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: LegacySessionAuth + whatsapp-web.js 1.19.2 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ diff --git a/docs/List.html b/docs/List.html index ead1c220036..6d6c2be7fc3 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: List + whatsapp-web.js 1.19.2 » Class: List @@ -15,7 +15,7 @@ diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 54cb42a7e8e..5b844cc6a4c 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: LocalAuth + whatsapp-web.js 1.19.2 » Class: LocalAuth @@ -15,7 +15,7 @@ diff --git a/docs/Location.html b/docs/Location.html index fd1926c7928..f8acb1c60af 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Location + whatsapp-web.js 1.19.2 » Class: Location @@ -15,7 +15,7 @@ diff --git a/docs/Message.html b/docs/Message.html index 17825457f43..fda9225f781 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Message + whatsapp-web.js 1.19.2 » Class: Message @@ -15,7 +15,7 @@ diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 33359d362cf..c7c0ba3c301 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: MessageMedia + whatsapp-web.js 1.19.2 » Class: MessageMedia @@ -15,7 +15,7 @@ diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 119126acf13..90edbd3cd3b 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: NoAuth + whatsapp-web.js 1.19.2 » Class: NoAuth @@ -15,7 +15,7 @@ diff --git a/docs/Order.html b/docs/Order.html index ea747c4655f..0f3c164cccb 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Order + whatsapp-web.js 1.19.2 » Class: Order @@ -15,7 +15,7 @@ diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index f38ad1e596c..46b71c2d8c8 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: PrivateChat + whatsapp-web.js 1.19.2 » Class: PrivateChat @@ -15,7 +15,7 @@ diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 3473ea03788..5b30b0b2f76 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: PrivateContact + whatsapp-web.js 1.19.2 » Class: PrivateContact @@ -15,7 +15,7 @@ diff --git a/docs/Product.html b/docs/Product.html index 457f833d6ed..aca2fa6f34d 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Product + whatsapp-web.js 1.19.2 » Class: Product @@ -15,7 +15,7 @@ diff --git a/docs/Reaction.html b/docs/Reaction.html index 05170041493..09d99cb6c9a 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Reaction + whatsapp-web.js 1.19.2 » Class: Reaction @@ -15,7 +15,7 @@ diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 5f1baa776c5..6c881ec24b2 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: RemoteAuth + whatsapp-web.js 1.19.2 » Class: RemoteAuth @@ -15,7 +15,7 @@ diff --git a/docs/Util.html b/docs/Util.html index 5083b76f00c..5600fa0763b 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Class: Util + whatsapp-web.js 1.19.2 » Class: Util @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 2db95235c7f..386a4d478a5 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.2 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index ed0343d79db..3cd74116954 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 63203666d6b..9fa3e14d8fd 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 1be866f9f9a..b953e64eef4 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index f7f48d2e62d..54530aad57b 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.2 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ diff --git a/docs/global.html b/docs/global.html index f599dc79d4e..db11868c288 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Globals + whatsapp-web.js 1.19.2 » Globals @@ -15,7 +15,7 @@ diff --git a/docs/index.html b/docs/index.html index 7b3457e400a..7ea7f5f4bb5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Home + whatsapp-web.js 1.19.2 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 4e70ed72a11..e9fe8539c42 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Base.js + whatsapp-web.js 1.19.2 » Source: structures/Base.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index e7600cd55b0..8599931d64a 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.2 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 3a79b8d5c3e..81e91574dda 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Buttons.js + whatsapp-web.js 1.19.2 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 2c64c0a94f3..1ada572e152 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Call.js + whatsapp-web.js 1.19.2 » Source: structures/Call.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 0fab4cbc11e..59f32bb899a 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Chat.js + whatsapp-web.js 1.19.2 » Source: structures/Chat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 4c205c76237..8645f822c46 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.2 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 2da12453e54..b220a2d707f 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Contact.js + whatsapp-web.js 1.19.2 » Source: structures/Contact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 7635f2ea860..fd3b90c16d7 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.2 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -90,10 +90,15 @@

Source: structures/GroupChat.js

* @returns {Promise&lt;Object>} */ async addParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendAddParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = await Promise.all(participantIds.map(async p => { + const wid = window.Store.WidFactory.createWid(p); + return await window.Store.Contact.get(wid); + })); + await window.Store.GroupParticipants.addParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -103,10 +108,14 @@

Source: structures/GroupChat.js

* @returns {Promise&lt;Object>} */ async removeParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendRemoveParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.removeParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -116,10 +125,14 @@

Source: structures/GroupChat.js

* @returns {Promise&lt;{ status: number }>} Object with status code indicating if the operation was successful */ async promoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendPromoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.promoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -129,10 +142,14 @@

Source: structures/GroupChat.js

* @returns {Promise&lt;{ status: number }>} Object with status code indicating if the operation was successful */ async demoteParticipants(participantIds) { - return await this.client.pupPage.evaluate((chatId, participantIds) => { + return await this.client.pupPage.evaluate(async (chatId, participantIds) => { const chatWid = window.Store.WidFactory.createWid(chatId); - const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p)); - return window.Store.GroupParticipants.sendDemoteParticipants(chatWid, participantWids); + const chat = await window.Store.Chat.find(chatWid); + const participants = participantIds.map(p => { + return chat.groupMetadata.participants.get(p); + }).filter(p => Boolean(p)); + await window.Store.GroupParticipants.demoteParticipants(chat, participants); + return { status: 200 }; }, this.id._serialized, participantIds); } @@ -145,7 +162,8 @@

Source: structures/GroupChat.js

const success = await this.client.pupPage.evaluate(async (chatId, subject) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupSubject(chatWid, subject); + await window.Store.GroupUtils.setGroupSubject(chatWid, subject); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -167,7 +185,8 @@

Source: structures/GroupChat.js

const chatWid = window.Store.WidFactory.createWid(chatId); let descId = window.Store.GroupMetadata.get(chatWid).descId; try { - return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -188,7 +207,8 @@

Source: structures/GroupChat.js

const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'announcement', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -210,7 +230,8 @@

Source: structures/GroupChat.js

const success = await this.client.pupPage.evaluate(async (chatId, adminsOnly) => { const chatWid = window.Store.WidFactory.createWid(chatId); try { - return await window.Store.GroupUtils.sendSetGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + await window.Store.GroupUtils.setGroupProperty(chatWid, 'restrict', adminsOnly ? 1 : 0); + return true; } catch (err) { if(err.name === 'ServerStatusCodeError') return false; throw err; @@ -228,12 +249,12 @@

Source: structures/GroupChat.js

* @returns {Promise&lt;string>} Group's invite code */ async getInviteCode() { - const code = await this.client.pupPage.evaluate(async chatId => { + const codeRes = await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendQueryGroupInviteCode(chatWid); + return window.Store.Invite.queryGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -241,12 +262,12 @@

Source: structures/GroupChat.js

* @returns {Promise&lt;string>} New invite code */ async revokeInvite() { - const code = await this.client.pupPage.evaluate(chatId => { + const codeRes = await this.client.pupPage.evaluate(chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.Invite.sendRevokeGroupInviteCode(chatWid); + return window.Store.Invite.resetGroupInviteCode(chatWid); }, this.id._serialized); - return code; + return codeRes.code; } /** @@ -254,9 +275,10 @@

Source: structures/GroupChat.js

* @returns {Promise} */ async leave() { - await this.client.pupPage.evaluate(chatId => { + await this.client.pupPage.evaluate(async chatId => { const chatWid = window.Store.WidFactory.createWid(chatId); - return window.Store.GroupUtils.sendExitGroup(chatWid); + const chat = await window.Store.Chat.find(chatWid); + return window.Store.GroupUtils.sendExitGroup(chat); }, this.id._serialized); } diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 882f1cd1780..907cdba6e9a 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.2 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 84fe4a5982f..9bdcc3fd657 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Label.js + whatsapp-web.js 1.19.2 » Source: structures/Label.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 5b902080382..c50fa7e3b0e 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/List.js + whatsapp-web.js 1.19.2 » Source: structures/List.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 5d66947c06d..2c81b9df45c 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Location.js + whatsapp-web.js 1.19.2 » Source: structures/Location.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 0c4d051282f..0d8eb4f04cc 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Message.js + whatsapp-web.js 1.19.2 » Source: structures/Message.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 499f7cfb6bd..4dc3d5a6ca0 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.2 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 9ad5d7ec72d..fd44444c1e4 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Order.js + whatsapp-web.js 1.19.2 » Source: structures/Order.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index e934dd14b0b..ef6c307f0f1 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Payment.js + whatsapp-web.js 1.19.2 » Source: structures/Payment.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index b7af1457300..d95fc6e15c4 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.2 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 7aec0d9865a..13abf4a25c9 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.2 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 9e78871cf39..159188532bc 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Product.js + whatsapp-web.js 1.19.2 » Source: structures/Product.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index ba7f554f2b1..ac7fca61494 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.2 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 6b470247390..0eb2f2c5949 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: structures/Reaction.js + whatsapp-web.js 1.19.2 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 12a26d5159f..c5ca2aa91ab 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: util/Constants.js + whatsapp-web.js 1.19.2 » Source: util/Constants.js @@ -15,7 +15,7 @@ diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 02b7dc3b3d2..4de61c7a8d1 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.2 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 5f19a8f8391..ca4ad46cc65 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.1 » Source: util/Util.js + whatsapp-web.js 1.19.2 » Source: util/Util.js @@ -15,7 +15,7 @@ diff --git a/package.json b/package.json index a396b2db4d5..40d37e3d4e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.1", + "version": "1.19.2", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From c208c8936a2dfc409c64a36574770645fdee7d78 Mon Sep 17 00:00:00 2001 From: Michal Serlui <70711723+shirser121@users.noreply.github.com> Date: Thu, 26 Jan 2023 23:52:39 +0200 Subject: [PATCH 104/430] Fix: message.getInfo (#1953) window.Store.MessageInfo.sendQueryMsgInfo now needs msg.id instead of msg --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 7ac55366d42..867bd888eef 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -494,7 +494,7 @@ class Message extends Base { const msg = window.Store.Msg.get(msgId); if (!msg) return null; - return await window.Store.MessageInfo.sendQueryMsgInfo(msg); + return await window.Store.MessageInfo.sendQueryMsgInfo(msg.id); }, this.id._serialized); return info; From 23cea1bac08388677587486ace5cff50bc00b313 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Thu, 26 Jan 2023 21:54:22 +0000 Subject: [PATCH 105/430] 1.20.0-alpha.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 40d37e3d4e5..f272b46e3b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.2", + "version": "1.20.0-alpha.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 97283c84c70fdb56c9b450e35fcf0f1d6154fc24 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 28 Jan 2023 00:35:27 -0400 Subject: [PATCH 106/430] chore: mark version v1.19.3 --- docs/Base.html | 6 +++--- docs/BaseAuthStrategy.html | 6 +++--- docs/BusinessContact.html | 6 +++--- docs/Buttons.html | 6 +++--- docs/Call.html | 6 +++--- docs/Chat.html | 6 +++--- docs/Client.html | 6 +++--- docs/Client.js.html | 6 +++--- docs/ClientInfo.html | 6 +++--- docs/Contact.html | 6 +++--- docs/GroupChat.html | 6 +++--- docs/GroupNotification.html | 6 +++--- docs/InterfaceController.html | 6 +++--- docs/Label.html | 6 +++--- docs/LegacySessionAuth.html | 6 +++--- docs/List.html | 6 +++--- docs/LocalAuth.html | 6 +++--- docs/Location.html | 6 +++--- docs/Message.html | 6 +++--- docs/MessageMedia.html | 6 +++--- docs/NoAuth.html | 6 +++--- docs/Order.html | 6 +++--- docs/PrivateChat.html | 6 +++--- docs/PrivateContact.html | 6 +++--- docs/Product.html | 6 +++--- docs/Reaction.html | 6 +++--- docs/RemoteAuth.html | 6 +++--- docs/Util.html | 6 +++--- docs/authStrategies_BaseAuthStrategy.js.html | 6 +++--- docs/authStrategies_LegacySessionAuth.js.html | 6 +++--- docs/authStrategies_LocalAuth.js.html | 6 +++--- docs/authStrategies_NoAuth.js.html | 6 +++--- docs/authStrategies_RemoteAuth.js.html | 6 +++--- docs/global.html | 6 +++--- docs/index.html | 8 ++++---- docs/structures_Base.js.html | 6 +++--- docs/structures_BusinessContact.js.html | 6 +++--- docs/structures_Buttons.js.html | 6 +++--- docs/structures_Call.js.html | 6 +++--- docs/structures_Chat.js.html | 6 +++--- docs/structures_ClientInfo.js.html | 6 +++--- docs/structures_Contact.js.html | 6 +++--- docs/structures_GroupChat.js.html | 6 +++--- 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 | 8 ++++---- docs/structures_MessageMedia.js.html | 6 +++--- docs/structures_Order.js.html | 6 +++--- docs/structures_Payment.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/util_Constants.js.html | 6 +++--- docs/util_InterfaceController.js.html | 6 +++--- docs/util_Util.js.html | 6 +++--- package.json | 2 +- 60 files changed, 180 insertions(+), 180 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index f24dffd81ee..2ebc5afa528 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Base + whatsapp-web.js 1.19.3 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 734f02dfe89..48c9650e956 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.3 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 66a9d7469b0..1eeac49a073 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: BusinessContact + whatsapp-web.js 1.19.3 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index 5d57a0ed223..e3fc3fd3ecc 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Buttons + whatsapp-web.js 1.19.3 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 3c190bfcfe5..126870bfe0a 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Call + whatsapp-web.js 1.19.3 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@

reject<
diff --git a/docs/Chat.html b/docs/Chat.html index 4cf62763424..24885c1f575 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Chat + whatsapp-web.js 1.19.3 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index cd112ddb446..06cf83b96fe 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Client + whatsapp-web.js 1.19.3 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index c5f6c316d94..f2d06a90cf3 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: Client.js + whatsapp-web.js 1.19.3 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1222,7 +1222,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 35c3a488837..16bf71971d0 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: ClientInfo + whatsapp-web.js 1.19.3 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index 7a35f051247..c94f5542e04 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Contact + whatsapp-web.js 1.19.3 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 2f7ed979b39..6e58e0a46f8 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: GroupChat + whatsapp-web.js 1.19.3 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 08fcd3437ae..35c89811bdd 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: GroupNotification + whatsapp-web.js 1.19.3 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 92e11fb0cbb..a6be6142dca 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: InterfaceController + whatsapp-web.js 1.19.3 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index e3e390064c4..1d42ba716aa 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Label + whatsapp-web.js 1.19.3 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 4331e896c57..e36f4e72589 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: LegacySessionAuth + whatsapp-web.js 1.19.3 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index 6d6c2be7fc3..efc7193402d 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: List + whatsapp-web.js 1.19.3 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 5b844cc6a4c..3ae6e8603df 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: LocalAuth + whatsapp-web.js 1.19.3 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index f8acb1c60af..5728b476511 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Location + whatsapp-web.js 1.19.3 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index fda9225f781..3f46e4fb79d 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Message + whatsapp-web.js 1.19.3 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index c7c0ba3c301..417c528abf9 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: MessageMedia + whatsapp-web.js 1.19.3 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 90edbd3cd3b..a267f9777eb 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: NoAuth + whatsapp-web.js 1.19.3 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index 0f3c164cccb..e86108116ac 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Order + whatsapp-web.js 1.19.3 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 46b71c2d8c8..795c1e4e6cf 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: PrivateChat + whatsapp-web.js 1.19.3 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 5b30b0b2f76..5854d05b397 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: PrivateContact + whatsapp-web.js 1.19.3 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index aca2fa6f34d..4869cec6468 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Product + whatsapp-web.js 1.19.3 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index 09d99cb6c9a..9e87af8d3d7 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Reaction + whatsapp-web.js 1.19.3 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 6c881ec24b2..fd4105da0a7 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: RemoteAuth + whatsapp-web.js 1.19.3 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index 5600fa0763b..319597e77c2 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Class: Util + whatsapp-web.js 1.19.3 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 386a4d478a5..be945369863 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.3 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 3cd74116954..8401f76ecb1 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.3 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 9fa3e14d8fd..9ada1154c1b 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.3 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index b953e64eef4..fc53dce07c7 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.3 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 54530aad57b..f905f8f9d57 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.3 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index db11868c288..65047fbd161 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Globals + whatsapp-web.js 1.19.3 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index 7ea7f5f4bb5..d523017ad9c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Home + whatsapp-web.js 1.19.3 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
@@ -3281,7 +3281,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index e9fe8539c42..d028984c017 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Base.js + whatsapp-web.js 1.19.3 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 8599931d64a..0f575efdc8a 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.3 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 81e91574dda..d5baa7f1ec6 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Buttons.js + whatsapp-web.js 1.19.3 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 1ada572e152..b2fd3238535 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Call.js + whatsapp-web.js 1.19.3 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 59f32bb899a..6997d816d87 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Chat.js + whatsapp-web.js 1.19.3 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 8645f822c46..4c4003f4408 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.3 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index b220a2d707f..ebbaf094b98 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Contact.js + whatsapp-web.js 1.19.3 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index fd3b90c16d7..c8fd25e0433 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.3 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -294,7 +294,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 907cdba6e9a..8c6e3b6c437 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.3 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 9bdcc3fd657..77bebb739c4 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Label.js + whatsapp-web.js 1.19.3 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index c50fa7e3b0e..b33b8a713fe 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/List.js + whatsapp-web.js 1.19.3 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 2c81b9df45c..3d614df1bc8 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Location.js + whatsapp-web.js 1.19.3 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 0d8eb4f04cc..b57e8831814 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Message.js + whatsapp-web.js 1.19.3 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -525,7 +525,7 @@

Source: structures/Message.js

const msg = window.Store.Msg.get(msgId); if (!msg) return null; - return await window.Store.MessageInfo.sendQueryMsgInfo(msg); + return await window.Store.MessageInfo.sendQueryMsgInfo(msg.id); }, this.id._serialized); return info; @@ -573,7 +573,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 4dc3d5a6ca0..5d8cf742aae 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.3 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index fd44444c1e4..dca025ebfbb 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Order.js + whatsapp-web.js 1.19.3 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index ef6c307f0f1..4cf4d1f4cb0 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Payment.js + whatsapp-web.js 1.19.3 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index d95fc6e15c4..ea8345b2a8c 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.3 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 13abf4a25c9..00d35495682 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.3 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 159188532bc..a81ff9583d3 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Product.js + whatsapp-web.js 1.19.3 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index ac7fca61494..aac678148b7 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.3 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 0eb2f2c5949..b03702fa278 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: structures/Reaction.js + whatsapp-web.js 1.19.3 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index c5ca2aa91ab..6fa4463fc51 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: util/Constants.js + whatsapp-web.js 1.19.3 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 4de61c7a8d1..d4a7f1f90e4 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.3 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -164,7 +164,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index ca4ad46cc65..dec3fc7fdee 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.19.2 » Source: util/Util.js + whatsapp-web.js 1.19.3 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index f272b46e3b9..b51832e9e27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.20.0-alpha.0", + "version": "1.19.3", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From f1607752dd8411df4020bcfd6ee2b7533210b32e Mon Sep 17 00:00:00 2001 From: Michal Serlui <70711723+shirser121@users.noreply.github.com> Date: Fri, 10 Feb 2023 16:06:20 +0200 Subject: [PATCH 107/430] try to fix queryWidExists (#1987) --- src/util/Injected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index 7acc145681c..77b0741c133 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -25,7 +25,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0]; window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default; - window.Store.QueryExist = window.mR.findModule('queryExists')[0].queryExists; + window.Store.QueryExist = window.mR.findModule('queryWidExists')[0].queryExists; window.Store.QueryProduct = window.mR.findModule('queryProduct')[0]; window.Store.QueryOrder = window.mR.findModule('queryOrder')[0]; window.Store.SendClear = window.mR.findModule('sendClear')[0]; From e8d4874b265968170182a8a0b768fc7d47b26b3c Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 11 Feb 2023 15:18:06 -0800 Subject: [PATCH 108/430] fix getNumberId --- src/Client.js | 2 +- src/util/Injected.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client.js b/src/Client.js index 7a09d7a8d94..52ea96f6860 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1043,7 +1043,7 @@ class Client extends EventEmitter { return await this.pupPage.evaluate(async number => { const wid = window.Store.WidFactory.createWid(number); - const result = await window.Store.QueryExist(wid); + const result = await window.Store.QueryExist.queryWidExists(wid); if (!result || result.wid === undefined) return null; return result.wid; }, number); diff --git a/src/util/Injected.js b/src/util/Injected.js index 77b0741c133..8287fb012eb 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -25,7 +25,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0]; window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default; - window.Store.QueryExist = window.mR.findModule('queryWidExists')[0].queryExists; + window.Store.QueryExist = window.mR.findModule('queryWidExists')[0]; window.Store.QueryProduct = window.mR.findModule('queryProduct')[0]; window.Store.QueryOrder = window.mR.findModule('queryOrder')[0]; window.Store.SendClear = window.mR.findModule('sendClear')[0]; From 842a342f72d112d7d2373a5ca7a10f8277388817 Mon Sep 17 00:00:00 2001 From: tofers Date: Sun, 12 Feb 2023 02:20:21 +0300 Subject: [PATCH 109/430] Fixing the queryWidExists function (#1989) * Update Injected.js fix function queryWidExists * Update Injected.js support WA old version 2.2305.7 --------- Co-authored-by: Pedro S. Lopez --- src/util/Injected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index 8287fb012eb..28cc069a660 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -25,7 +25,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default; window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0]; window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default; - window.Store.QueryExist = window.mR.findModule('queryWidExists')[0]; + window.Store.QueryExist = window.mR.findModule('queryExists')[0] ? window.mR.findModule('queryExists')[0].queryExists : window.mR.findModule('queryExist')[0].queryWidExists; window.Store.QueryProduct = window.mR.findModule('queryProduct')[0]; window.Store.QueryOrder = window.mR.findModule('queryOrder')[0]; window.Store.SendClear = window.mR.findModule('sendClear')[0]; From 617e0b89d577ce508a3d8d37d661f11a9a9eded0 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 11 Feb 2023 15:22:30 -0800 Subject: [PATCH 110/430] merge fix --- src/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index 52ea96f6860..7a09d7a8d94 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1043,7 +1043,7 @@ class Client extends EventEmitter { return await this.pupPage.evaluate(async number => { const wid = window.Store.WidFactory.createWid(number); - const result = await window.Store.QueryExist.queryWidExists(wid); + const result = await window.Store.QueryExist(wid); if (!result || result.wid === undefined) return null; return result.wid; }, number); From 1294170a25cc7a1e3d97237f7ade7a661d451b03 Mon Sep 17 00:00:00 2001 From: tofers Date: Sun, 12 Feb 2023 02:25:54 +0300 Subject: [PATCH 111/430] Fix mute chat (#1982) * fix function set mute chat * chat mute new object --- src/Client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index 7a09d7a8d94..3d87ace7faf 100644 --- a/src/Client.js +++ b/src/Client.js @@ -937,7 +937,7 @@ class Client extends EventEmitter { unmuteDate = unmuteDate ? unmuteDate.getTime() / 1000 : -1; await this.pupPage.evaluate(async (chatId, timestamp) => { let chat = await window.Store.Chat.get(chatId); - await chat.mute.mute(timestamp, !0); + await chat.mute.mute({expiration: timestamp, sendDevice:!0}); }, chatId, unmuteDate || -1); } From 313bd085b3ee277f6de215e11e3eb2511c9172bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 11 Feb 2023 15:26:28 -0800 Subject: [PATCH 112/430] Update supported WhatsApp Web version to v2.2306.7 (#1954) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 54c439b19ed..adb1cfec916 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2301.6](https://img.shields.io/badge/WhatsApp_Web-2.2301.6-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2306.7](https://img.shields.io/badge/WhatsApp_Web-2.2306.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 07e78805ef4..e7197d623dd 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2301.6 \ No newline at end of file +2.2306.7 \ No newline at end of file From 6f2ad1773e6bb34b1f916f6485114bc1b26c837b Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 11 Feb 2023 15:27:30 -0800 Subject: [PATCH 113/430] chore: mark version v1.19.4 --- docs/Base.html | 8 ++++---- docs/BaseAuthStrategy.html | 8 ++++---- docs/BusinessContact.html | 8 ++++---- docs/Buttons.html | 8 ++++---- docs/Call.html | 8 ++++---- docs/Chat.html | 8 ++++---- docs/Client.html | 8 ++++---- docs/Client.js.html | 10 +++++----- docs/ClientInfo.html | 8 ++++---- docs/Contact.html | 8 ++++---- docs/GroupChat.html | 8 ++++---- docs/GroupNotification.html | 8 ++++---- docs/InterfaceController.html | 8 ++++---- docs/Label.html | 8 ++++---- docs/LegacySessionAuth.html | 8 ++++---- docs/List.html | 8 ++++---- docs/LocalAuth.html | 8 ++++---- docs/Location.html | 8 ++++---- docs/Message.html | 8 ++++---- docs/MessageMedia.html | 8 ++++---- docs/NoAuth.html | 8 ++++---- docs/Order.html | 8 ++++---- docs/PrivateChat.html | 8 ++++---- docs/PrivateContact.html | 8 ++++---- docs/Product.html | 8 ++++---- docs/Reaction.html | 8 ++++---- docs/RemoteAuth.html | 8 ++++---- docs/Util.html | 8 ++++---- docs/authStrategies_BaseAuthStrategy.js.html | 8 ++++---- docs/authStrategies_LegacySessionAuth.js.html | 8 ++++---- docs/authStrategies_LocalAuth.js.html | 8 ++++---- docs/authStrategies_NoAuth.js.html | 8 ++++---- docs/authStrategies_RemoteAuth.js.html | 8 ++++---- docs/global.html | 8 ++++---- docs/index.html | 12 ++++++------ docs/structures_Base.js.html | 8 ++++---- docs/structures_BusinessContact.js.html | 8 ++++---- docs/structures_Buttons.js.html | 8 ++++---- docs/structures_Call.js.html | 8 ++++---- docs/structures_Chat.js.html | 8 ++++---- docs/structures_ClientInfo.js.html | 8 ++++---- docs/structures_Contact.js.html | 8 ++++---- docs/structures_GroupChat.js.html | 8 ++++---- docs/structures_GroupNotification.js.html | 8 ++++---- docs/structures_Label.js.html | 8 ++++---- docs/structures_List.js.html | 8 ++++---- docs/structures_Location.js.html | 8 ++++---- docs/structures_Message.js.html | 8 ++++---- docs/structures_MessageMedia.js.html | 8 ++++---- docs/structures_Order.js.html | 8 ++++---- docs/structures_Payment.js.html | 8 ++++---- docs/structures_PrivateChat.js.html | 8 ++++---- docs/structures_PrivateContact.js.html | 8 ++++---- docs/structures_Product.js.html | 8 ++++---- docs/structures_ProductMetadata.js.html | 8 ++++---- docs/structures_Reaction.js.html | 8 ++++---- docs/util_Constants.js.html | 8 ++++---- docs/util_InterfaceController.js.html | 8 ++++---- docs/util_Util.js.html | 8 ++++---- package.json | 2 +- 60 files changed, 240 insertions(+), 240 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 2ebc5afa528..34a43c616f2 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Base + whatsapp-web.js 1.19.4 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 48c9650e956..b2336f62a27 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.4 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 1eeac49a073..9bb7455e47c 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: BusinessContact + whatsapp-web.js 1.19.4 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index e3fc3fd3ecc..57318d0cfa2 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Buttons + whatsapp-web.js 1.19.4 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 126870bfe0a..ae81bbd5963 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Call + whatsapp-web.js 1.19.4 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@

reject<
diff --git a/docs/Chat.html b/docs/Chat.html index 24885c1f575..d89649c05dd 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Chat + whatsapp-web.js 1.19.4 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 06cf83b96fe..5cc9d96c9c8 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Client + whatsapp-web.js 1.19.4 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index f2d06a90cf3..56d491489c6 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: Client.js + whatsapp-web.js 1.19.4 » Source: Client.js @@ -15,7 +15,7 @@ @@ -968,7 +968,7 @@

Source: Client.js

unmuteDate = unmuteDate ? unmuteDate.getTime() / 1000 : -1; await this.pupPage.evaluate(async (chatId, timestamp) => { let chat = await window.Store.Chat.get(chatId); - await chat.mute.mute(timestamp, !0); + await chat.mute.mute({expiration: timestamp, sendDevice:!0}); }, chatId, unmuteDate || -1); } @@ -1222,7 +1222,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 16bf71971d0..12eb526eb70 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: ClientInfo + whatsapp-web.js 1.19.4 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index c94f5542e04..30565a59fe3 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Contact + whatsapp-web.js 1.19.4 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 6e58e0a46f8..0fdfebe531b 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: GroupChat + whatsapp-web.js 1.19.4 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 35c89811bdd..7fa5668246d 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: GroupNotification + whatsapp-web.js 1.19.4 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index a6be6142dca..76633f31b71 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: InterfaceController + whatsapp-web.js 1.19.4 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index 1d42ba716aa..29739175227 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Label + whatsapp-web.js 1.19.4 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index e36f4e72589..38f23faf758 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: LegacySessionAuth + whatsapp-web.js 1.19.4 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index efc7193402d..c85f3645001 100644 --- a/docs/List.html +++ b/docs/List.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: List + whatsapp-web.js 1.19.4 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 3ae6e8603df..8a7d37b0640 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: LocalAuth + whatsapp-web.js 1.19.4 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index 5728b476511..a10bcc07ce9 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Location + whatsapp-web.js 1.19.4 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index 3f46e4fb79d..62418d3a750 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Message + whatsapp-web.js 1.19.4 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 417c528abf9..2a1a81be603 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: MessageMedia + whatsapp-web.js 1.19.4 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index a267f9777eb..e6370493422 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: NoAuth + whatsapp-web.js 1.19.4 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index e86108116ac..aaee8eeb60b 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Order + whatsapp-web.js 1.19.4 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index 795c1e4e6cf..c27f59497bd 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: PrivateChat + whatsapp-web.js 1.19.4 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 5854d05b397..88653457cf7 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: PrivateContact + whatsapp-web.js 1.19.4 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 4869cec6468..9023672d212 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Product + whatsapp-web.js 1.19.4 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index 9e87af8d3d7..edc7531887c 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Reaction + whatsapp-web.js 1.19.4 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index fd4105da0a7..45d05e71c91 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: RemoteAuth + whatsapp-web.js 1.19.4 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index 319597e77c2..beca42ec8a5 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Class: Util + whatsapp-web.js 1.19.4 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index be945369863..b1db2b22279 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.4 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 8401f76ecb1..eed02e98411 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.4 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 9ada1154c1b..7371cd7bb80 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.4 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index fc53dce07c7..6d9a06f334a 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.4 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index f905f8f9d57..cbc37ec812f 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.4 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index 65047fbd161..0f0fa91794e 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Globals + whatsapp-web.js 1.19.4 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index d523017ad9c..ba6f82b102d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Home + whatsapp-web.js 1.19.4 » Home @@ -15,7 +15,7 @@ @@ -27,11 +27,11 @@
-

npm Depfu WhatsApp_Web 2.2301.6 Discord Chat

+

npm Depfu WhatsApp_Web 2.2306.7 Discord Chat

whatsapp-web.js

A WhatsApp API client that connects through the WhatsApp Web browser app

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

@@ -3281,7 +3281,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index d028984c017..ecd596e4231 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Base.js + whatsapp-web.js 1.19.4 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 0f575efdc8a..9a97e695820 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.4 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index d5baa7f1ec6..2ea9add92f9 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Buttons.js + whatsapp-web.js 1.19.4 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index b2fd3238535..9d9593b7eb3 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Call.js + whatsapp-web.js 1.19.4 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 6997d816d87..70eb9e27096 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Chat.js + whatsapp-web.js 1.19.4 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 4c4003f4408..790e591e59a 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.4 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index ebbaf094b98..96f2323c03a 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Contact.js + whatsapp-web.js 1.19.4 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index c8fd25e0433..badebae3fec 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.4 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -294,7 +294,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 8c6e3b6c437..9ef074dd612 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.4 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 77bebb739c4..01aed26829b 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Label.js + whatsapp-web.js 1.19.4 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index b33b8a713fe..e18dfd45032 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/List.js + whatsapp-web.js 1.19.4 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 3d614df1bc8..9707f6b2ae2 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Location.js + whatsapp-web.js 1.19.4 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index b57e8831814..e5676a233cd 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Message.js + whatsapp-web.js 1.19.4 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -573,7 +573,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 5d8cf742aae..d52fd3b8609 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.4 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index dca025ebfbb..f2d76fb4c7e 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Order.js + whatsapp-web.js 1.19.4 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 4cf4d1f4cb0..0d56ba40d6f 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Payment.js + whatsapp-web.js 1.19.4 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index ea8345b2a8c..ff74a37c2c8 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.4 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 00d35495682..7f14e299f2a 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.4 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index a81ff9583d3..882d704b1e7 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Product.js + whatsapp-web.js 1.19.4 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index aac678148b7..c4a071d26a6 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.4 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index b03702fa278..1dfda612b2f 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: structures/Reaction.js + whatsapp-web.js 1.19.4 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 6fa4463fc51..7b66690cfa9 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: util/Constants.js + whatsapp-web.js 1.19.4 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index d4a7f1f90e4..cc963e9331f 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.4 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -164,7 +164,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index dec3fc7fdee..539ac5d6948 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.3 » Source: util/Util.js + whatsapp-web.js 1.19.4 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index b51832e9e27..49c6d7801e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.3", + "version": "1.19.4", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 109fbce8db698ca12ac81af13bc69090a645d5b2 Mon Sep 17 00:00:00 2001 From: Italo Castro <72866245+Italo-Castro@users.noreply.github.com> Date: Sat, 18 Mar 2023 19:11:38 -0300 Subject: [PATCH 114/430] Fix Message.js (#2080) Fixes https://github.com/pedroslopez/whatsapp-web.js/issues/2078 --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 867bd888eef..2e16ed7755a 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -403,7 +403,7 @@ class Message extends Base { } try { - const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({ + const decryptedMedia = await window.Store.DownloadManager.downloadAndMaybeDecrypt({ directPath: msg.directPath, encFilehash: msg.encFilehash, filehash: msg.filehash, From 185465664845bb9f6b37915e20e77683b4397a6e Mon Sep 17 00:00:00 2001 From: Macley Sousa Date: Sat, 18 Mar 2023 19:12:39 -0300 Subject: [PATCH 115/430] fix: send media (#2074) --- src/util/Injected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index 28cc069a660..dbae6c2933c 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -17,7 +17,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.Invite = window.mR.findModule('resetGroupInviteCode')[0]; window.Store.InviteInfo = window.mR.findModule('queryGroupInvite')[0]; window.Store.Label = window.mR.findModule('LabelCollection')[0].LabelCollection; - window.Store.MediaPrep = window.mR.findModule('MediaPrep')[0]; + window.Store.MediaPrep = window.mR.findModule('prepRawMedia')[0]; window.Store.MediaObject = window.mR.findModule('getOrCreateMediaObject')[0]; window.Store.NumberInfo = window.mR.findModule('formattedPhoneNumber')[0]; window.Store.MediaTypes = window.mR.findModule('msgToMediaType')[0]; From ea6c130edd355edb1ef8d93cb9c015785d053828 Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 18 Mar 2023 18:17:59 -0400 Subject: [PATCH 116/430] chore: mark version v1.19.5 --- docs/Base.html | 8 ++++---- docs/BaseAuthStrategy.html | 8 ++++---- docs/BusinessContact.html | 8 ++++---- docs/Buttons.html | 8 ++++---- docs/Call.html | 8 ++++---- docs/Chat.html | 8 ++++---- docs/Client.html | 8 ++++---- docs/Client.js.html | 8 ++++---- docs/ClientInfo.html | 8 ++++---- docs/Contact.html | 8 ++++---- docs/GroupChat.html | 8 ++++---- docs/GroupNotification.html | 8 ++++---- docs/InterfaceController.html | 8 ++++---- docs/Label.html | 8 ++++---- docs/LegacySessionAuth.html | 8 ++++---- docs/List.html | 8 ++++---- docs/LocalAuth.html | 8 ++++---- docs/Location.html | 8 ++++---- docs/Message.html | 8 ++++---- docs/MessageMedia.html | 8 ++++---- docs/NoAuth.html | 8 ++++---- docs/Order.html | 8 ++++---- docs/PrivateChat.html | 8 ++++---- docs/PrivateContact.html | 8 ++++---- docs/Product.html | 8 ++++---- docs/Reaction.html | 8 ++++---- docs/RemoteAuth.html | 8 ++++---- docs/Util.html | 8 ++++---- docs/authStrategies_BaseAuthStrategy.js.html | 8 ++++---- docs/authStrategies_LegacySessionAuth.js.html | 8 ++++---- docs/authStrategies_LocalAuth.js.html | 8 ++++---- docs/authStrategies_NoAuth.js.html | 8 ++++---- docs/authStrategies_RemoteAuth.js.html | 8 ++++---- docs/global.html | 8 ++++---- docs/index.html | 10 +++++----- docs/structures_Base.js.html | 8 ++++---- docs/structures_BusinessContact.js.html | 8 ++++---- docs/structures_Buttons.js.html | 8 ++++---- docs/structures_Call.js.html | 8 ++++---- docs/structures_Chat.js.html | 8 ++++---- docs/structures_ClientInfo.js.html | 8 ++++---- docs/structures_Contact.js.html | 8 ++++---- docs/structures_GroupChat.js.html | 8 ++++---- docs/structures_GroupNotification.js.html | 8 ++++---- docs/structures_Label.js.html | 8 ++++---- docs/structures_List.js.html | 8 ++++---- docs/structures_Location.js.html | 8 ++++---- docs/structures_Message.js.html | 10 +++++----- docs/structures_MessageMedia.js.html | 8 ++++---- docs/structures_Order.js.html | 8 ++++---- docs/structures_Payment.js.html | 8 ++++---- docs/structures_PrivateChat.js.html | 8 ++++---- docs/structures_PrivateContact.js.html | 8 ++++---- docs/structures_Product.js.html | 8 ++++---- docs/structures_ProductMetadata.js.html | 8 ++++---- docs/structures_Reaction.js.html | 8 ++++---- docs/util_Constants.js.html | 8 ++++---- docs/util_InterfaceController.js.html | 8 ++++---- docs/util_Util.js.html | 8 ++++---- package.json | 2 +- 60 files changed, 239 insertions(+), 239 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 34a43c616f2..8b72b80521c 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Base + whatsapp-web.js 1.19.5 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index b2336f62a27..45b4f5d15db 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: BaseAuthStrategy + whatsapp-web.js 1.19.5 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 9bb7455e47c..8ca34628a7a 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: BusinessContact + whatsapp-web.js 1.19.5 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index 57318d0cfa2..db66dc31f4c 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Buttons + whatsapp-web.js 1.19.5 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index ae81bbd5963..2ed0b0d76a7 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Call + whatsapp-web.js 1.19.5 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@

reject<
diff --git a/docs/Chat.html b/docs/Chat.html index d89649c05dd..48ef3299c2b 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Chat + whatsapp-web.js 1.19.5 » Class: Chat @@ -15,7 +15,7 @@ @@ -497,7 +497,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 5cc9d96c9c8..01ef7bb4a6d 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Client + whatsapp-web.js 1.19.5 » Class: Client @@ -15,7 +15,7 @@ @@ -2486,7 +2486,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 56d491489c6..6a180d7c51d 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: Client.js + whatsapp-web.js 1.19.5 » Source: Client.js @@ -15,7 +15,7 @@ @@ -1222,7 +1222,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 12eb526eb70..02211359be8 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: ClientInfo + whatsapp-web.js 1.19.5 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index 30565a59fe3..29a9d00552e 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Contact + whatsapp-web.js 1.19.5 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 0fdfebe531b..a27f22dedc2 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: GroupChat + whatsapp-web.js 1.19.5 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -941,7 +941,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 7fa5668246d..739b7a2e7ce 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: GroupNotification + whatsapp-web.js 1.19.5 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 76633f31b71..862364ce497 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: InterfaceController + whatsapp-web.js 1.19.5 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index 29739175227..da6fac55466 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Label + whatsapp-web.js 1.19.5 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index 38f23faf758..b248e58d574 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: LegacySessionAuth + whatsapp-web.js 1.19.5 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index c85f3645001..f2c4affe3d7 100644 --- a/docs/List.html +++ b/docs/List.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: List + whatsapp-web.js 1.19.5 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 8a7d37b0640..1a4f18a4b1a 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: LocalAuth + whatsapp-web.js 1.19.5 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index a10bcc07ce9..0c80012040a 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Location + whatsapp-web.js 1.19.5 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index 62418d3a750..d528a725d33 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Message + whatsapp-web.js 1.19.5 » Class: Message @@ -15,7 +15,7 @@ @@ -650,7 +650,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 2a1a81be603..17046c40775 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: MessageMedia + whatsapp-web.js 1.19.5 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index e6370493422..1ee676e0483 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: NoAuth + whatsapp-web.js 1.19.5 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index aaee8eeb60b..a116147fe34 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Order + whatsapp-web.js 1.19.5 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index c27f59497bd..d903c672467 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: PrivateChat + whatsapp-web.js 1.19.5 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -533,7 +533,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 88653457cf7..b41f3e9cb20 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: PrivateContact + whatsapp-web.js 1.19.5 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 9023672d212..549ce626f07 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Product + whatsapp-web.js 1.19.5 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index edc7531887c..ade180ce7e4 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Reaction + whatsapp-web.js 1.19.5 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 45d05e71c91..077388e30b6 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: RemoteAuth + whatsapp-web.js 1.19.5 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index beca42ec8a5..ca629bade46 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Class: Util + whatsapp-web.js 1.19.5 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index b1db2b22279..2d02c68cc42 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.19.5 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index eed02e98411..3c9e0d3e95b 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.19.5 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 7371cd7bb80..9b370062d22 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.19.5 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 6d9a06f334a..6321c1d00f6 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.19.5 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index cbc37ec812f..b4a777fc2e3 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.19.5 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index 0f0fa91794e..50c2cb31a2a 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Globals + whatsapp-web.js 1.19.5 » Globals @@ -15,7 +15,7 @@ @@ -2019,7 +2019,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index ba6f82b102d..17e9fb84029 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Home + whatsapp-web.js 1.19.5 » Home @@ -15,7 +15,7 @@ @@ -27,7 +27,7 @@
@@ -3281,7 +3281,7 @@

WAState

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index ecd596e4231..92989987396 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Base.js + whatsapp-web.js 1.19.5 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 9a97e695820..3b5feb76e9c 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/BusinessContact.js + whatsapp-web.js 1.19.5 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 2ea9add92f9..7637c6ca051 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Buttons.js + whatsapp-web.js 1.19.5 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 9d9593b7eb3..09504d6944b 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Call.js + whatsapp-web.js 1.19.5 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 70eb9e27096..e470070c975 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Chat.js + whatsapp-web.js 1.19.5 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -299,7 +299,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 790e591e59a..5c59f8448d5 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/ClientInfo.js + whatsapp-web.js 1.19.5 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 96f2323c03a..9659220f026 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Contact.js + whatsapp-web.js 1.19.5 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index badebae3fec..03ef7ee6acb 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/GroupChat.js + whatsapp-web.js 1.19.5 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -294,7 +294,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 9ef074dd612..8885d690d38 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/GroupNotification.js + whatsapp-web.js 1.19.5 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 01aed26829b..0085387f54b 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Label.js + whatsapp-web.js 1.19.5 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index e18dfd45032..4939fa15bd0 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/List.js + whatsapp-web.js 1.19.5 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 9707f6b2ae2..2e263b664b9 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Location.js + whatsapp-web.js 1.19.5 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index e5676a233cd..42962cb01ab 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Message.js + whatsapp-web.js 1.19.5 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -434,7 +434,7 @@

Source: structures/Message.js

} try { - const decryptedMedia = await window.Store.DownloadManager.downloadAndDecrypt({ + const decryptedMedia = await window.Store.DownloadManager.downloadAndMaybeDecrypt({ directPath: msg.directPath, encFilehash: msg.encFilehash, filehash: msg.filehash, @@ -573,7 +573,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index d52fd3b8609..5648e76c258 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/MessageMedia.js + whatsapp-web.js 1.19.5 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index f2d76fb4c7e..3da4befad2b 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Order.js + whatsapp-web.js 1.19.5 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 0d56ba40d6f..2392de09973 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Payment.js + whatsapp-web.js 1.19.5 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index ff74a37c2c8..46d5c2ee8e8 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/PrivateChat.js + whatsapp-web.js 1.19.5 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 7f14e299f2a..0bf52689eb2 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/PrivateContact.js + whatsapp-web.js 1.19.5 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 882d704b1e7..6a42dbf231b 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Product.js + whatsapp-web.js 1.19.5 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index c4a071d26a6..be6fa76ff5e 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.19.5 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 1dfda612b2f..e4e4b009a02 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: structures/Reaction.js + whatsapp-web.js 1.19.5 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 7b66690cfa9..9389185d781 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: util/Constants.js + whatsapp-web.js 1.19.5 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -200,7 +200,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index cc963e9331f..17abf6d5992 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: util/InterfaceController.js + whatsapp-web.js 1.19.5 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -164,7 +164,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 539ac5d6948..ee2b4b4c503 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.4 » Source: util/Util.js + whatsapp-web.js 1.19.5 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index 49c6d7801e2..012bff6717a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.4", + "version": "1.19.5", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 48466251196197467673f3a21f8418586c2c671f Mon Sep 17 00:00:00 2001 From: Mohammed Khan <60229505+saifkhan7865@users.noreply.github.com> Date: Wed, 29 Mar 2023 09:20:23 +0530 Subject: [PATCH 117/430] fixed version id number (#2087) --- src/util/Injected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index dbae6c2933c..229220ca91b 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -41,7 +41,7 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0]; window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0]; window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0]; - window.Store.GroupParticipants = window.mR.findModule('promoteParticipants')[1]; + window.Store.GroupParticipants = window.mR.findModule('promoteParticipants')[0]; window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0]; window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups; window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0]; From dc16bbbdac45e4b40b88662e0c808850f87f627a Mon Sep 17 00:00:00 2001 From: Wictor Nogueira <57378387+wictornogueira@users.noreply.github.com> Date: Fri, 31 Mar 2023 22:21:09 -0300 Subject: [PATCH 118/430] Feat: change profile/group picture (#1916) * feat: pfp * Make eslint happy * Fix typo * Fix missing comma * Update src/util/Injected.js * ESLint * Update src/util/Injected.js * mfw purp breaks indentation --------- Co-authored-by: Rajeh Taher --- index.d.ts | 10 ++++++ src/Client.js | 25 +++++++++++++ src/structures/GroupChat.js | 25 +++++++++++++ src/util/Injected.js | 72 ++++++++++++++++++++++++++++++++++++- 4 files changed, 131 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 6abef660cde..cebbb75a1b7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -148,6 +148,12 @@ declare namespace WAWebJS { /** Unmutes the Chat */ unmuteChat(chatId: string): Promise + /** Sets the current user's profile picture */ + setProfilePicture(media: MessageMedia): Promise + + /** Deletes the current user's profile picture */ + deleteProfilePicture(): Promise + /** Generic event */ on(event: string, listener: (...args: any) => void): this @@ -1162,6 +1168,10 @@ declare namespace WAWebJS { revokeInvite: () => Promise; /** Makes the bot leave the group */ leave: () => Promise; + /** Sets the group's picture.*/ + setPicture: (media: MessageMedia) => Promise; + /** Deletes the group's picture */ + deletePicture: () => Promise; } /** diff --git a/src/Client.js b/src/Client.js index 3d87ace7faf..955aadcbc5f 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1178,6 +1178,31 @@ class Client extends EventEmitter { return blockedContacts.map(contact => ContactFactory.create(this.client, contact)); } + + /** + * Sets the current user's profile picture. + * @param {MessageMedia} media + * @returns {Promise} Returns true if the picture was properly updated. + */ + async setProfilePicture(media) { + const success = await this.pupPage.evaluate((chatid, media) => { + return window.WWebJS.setPicture(chatid, media); + }, this.info.wid._serialized, media); + + return success; + } + + /** + * Deletes the current user's profile picture. + * @returns {Promise} Returns true if the picture was properly deleted. + */ + async deleteProfilePicture() { + const success = await this.pupPage.evaluate((chatid) => { + return window.WWebJS.deletePicture(chatid); + }, this.info.wid._serialized); + + return success; + } } module.exports = Client; diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 0be6b62e101..51769a560b8 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -213,6 +213,31 @@ class GroupChat extends Chat { return true; } + /** + * Deletes the group's picture. + * @returns {Promise} Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions. + */ + async deletePicture() { + const success = await this.client.pupPage.evaluate((chatid) => { + return window.WWebJS.deletePicture(chatid); + }, this.id._serialized); + + return success; + } + + /** + * Sets the group's picture. + * @param {MessageMedia} media + * @returns {Promise} Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions. + */ + async setPicture(media) { + const success = await this.client.pupPage.evaluate((chatid, media) => { + return window.WWebJS.setPicture(chatid, media); + }, this.id._serialized, media); + + return success; + } + /** * Gets the invite code for a specific group * @returns {Promise} Group's invite code diff --git a/src/util/Injected.js b/src/util/Injected.js index 229220ca91b..b32d50bf7b8 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -62,7 +62,8 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.GroupUtils = { ...window.mR.findModule('createGroup')[0], ...window.mR.findModule('setGroupDescription')[0], - ...window.mR.findModule('sendExitGroup')[0] + ...window.mR.findModule('sendExitGroup')[0], + ...window.mR.findModule('sendSetPicture')[0] }; if (!window.Store.Chat._find) { @@ -625,4 +626,73 @@ exports.LoadUtils = () => { ]); await window.Store.Socket.deprecatedCastStanza(stanza); }; + + window.WWebJS.cropAndResizeImage = async (media, options = {}) => { + if (!media.mimetype.includes('image')) + throw new Error('Media is not an image'); + + if (options.mimetype && !options.mimetype.includes('image')) + delete options.mimetype; + + options = Object.assign({ size: 640, mimetype: media.mimetype, quality: .75, asDataUrl: false }, options); + + const img = await new Promise ((resolve, reject) => { + const img = new Image(); + img.onload = () => resolve(img); + img.onerror = reject; + img.src = `data:${media.mimetype};base64,${media.data}`; + }); + + const sl = Math.min(img.width, img.height); + const sx = Math.floor((img.width - sl) / 2); + const sy = Math.floor((img.height - sl) / 2); + + const canvas = document.createElement('canvas'); + canvas.width = options.size; + canvas.height = options.size; + + const ctx = canvas.getContext('2d'); + ctx.drawImage(img, sx, sy, sl, sl, 0, 0, options.size, options.size); + + const dataUrl = canvas.toDataURL(options.mimetype, options.quality); + + if (options.asDataUrl) + return dataUrl; + + return Object.assign(media, { + mimetype: options.mimeType, + data: dataUrl.replace(`data:${options.mimeType};base64,`, '') + }); + }; + + window.WWebJS.setPicture = async (chatid, media) => { + const thumbnail = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 96 }); + const profilePic = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 640 }); + + const chatWid = window.Store.WidFactory.createWid(chatid); + try { + const collection = window.Store.ProfilePicThumb.get(chatid); + if (!collection.canSet()) return; + + const res = await window.Store.GroupUtils.sendSetPicture(chatWid, thumbnail, profilePic); + return res ? res.status === 200 : false; + } catch (err) { + if(err.name === 'ServerStatusCodeError') return false; + throw err; + } + }; + + window.WWebJS.deletePicture = async (chatid) => { + const chatWid = window.Store.WidFactory.createWid(chatid); + try { + const collection = window.Store.ProfilePicThumb.get(chatid); + if (!collection.canDelete()) return; + + const res = await window.Store.GroupUtils.requestDeletePicture(chatWid); + return res ? res.status === 200 : false; + } catch (err) { + if(err.name === 'ServerStatusCodeError') return false; + throw err; + } + }; }; From c44af204a1e79308dc6720a3d90a60bc4dd7cff3 Mon Sep 17 00:00:00 2001 From: Vinicius Tavares Date: Sat, 1 Apr 2023 10:59:57 -0300 Subject: [PATCH 119/430] Add the 'unread_count' event. Listen to changes on Chat.unreadCount (#2059) * Initial commit * Update index.d.ts * The functions was returning a 'brief' chat data. With this, it will return full Chat model.. * Eslint suggested fixex --------- Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> Co-authored-by: Rajeh Taher --- index.d.ts | 6 ++++++ src/Client.js | 12 +++++++++++- src/util/Constants.js | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index cebbb75a1b7..b16a20f90d6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -223,6 +223,12 @@ declare namespace WAWebJS { /** The new ACK value */ ack: MessageAck ) => void): this + + /** Emitted when a chat unread count changes */ + on(event: 'unread_count', listener: ( + /** The chat that was affected */ + chat: Chat + ) => void): this /** Emitted when a new message is created, which may include the current user's own messages */ on(event: 'message_create', listener: ( diff --git a/src/Client.js b/src/Client.js index 955aadcbc5f..acd04ac7af3 100644 --- a/src/Client.js +++ b/src/Client.js @@ -407,6 +407,15 @@ class Client extends EventEmitter { }); + await page.exposeFunction('onChatUnreadCountEvent', async (data) =>{ + const chat = await this.getChatById(data.id); + + /** + * Emitted when the chat unread count changes + */ + this.emit(Events.UNREAD_COUNT, chat); + }); + await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => { const message = new Message(this, msg); @@ -526,7 +535,8 @@ class Client extends EventEmitter { } } }); - + window.Store.Chat.on('change:unreadCount', (chat) => {window.onChatUnreadCountEvent(chat);}); + { const module = window.Store.createOrUpdateReactionsModule; const ogMethod = module.createOrUpdateReactions; diff --git a/src/util/Constants.js b/src/util/Constants.js index 4c22fa138d2..e341b4cb2d0 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -41,6 +41,7 @@ exports.Events = { MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', MESSAGE_REVOKED_ME: 'message_revoke_me', MESSAGE_ACK: 'message_ack', + UNREAD_COUNT: 'unread_count', MESSAGE_REACTION: 'message_reaction', MEDIA_UPLOADED: 'media_uploaded', GROUP_JOIN: 'group_join', From 780005a81ac7376ef218833e51632d3fa4477609 Mon Sep 17 00:00:00 2001 From: tofers Date: Sat, 1 Apr 2023 17:03:21 +0300 Subject: [PATCH 120/430] feat: load reactions in message (#1897) * msg find reactions * reaction list * return hasReaction only true or false --------- Co-authored-by: Rajeh Taher --- index.d.ts | 14 ++++++++++++ src/structures/Message.js | 47 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index b16a20f90d6..fa36547954d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -649,6 +649,7 @@ declare namespace WAWebJS { * broadcast: false, * fromMe: false, * hasQuotedMsg: false, + * hasReaction: false, * location: undefined, * mentionedIds: [] * } @@ -678,6 +679,8 @@ declare namespace WAWebJS { hasMedia: boolean, /** Indicates if the message was sent as a reply to another message */ hasQuotedMsg: boolean, + /** Indicates whether there are reactions to the message */ + hasReaction: boolean, /** Indicates the duration of the message in seconds */ duration: string, /** ID that represents the message */ @@ -779,6 +782,10 @@ declare namespace WAWebJS { * Gets the payment details associated with a given message */ getPayment: () => Promise, + /** + * Gets the reactions associated with the given message + */ + getReactions: () => Promise, } /** ID that represents a message */ @@ -1381,6 +1388,13 @@ declare namespace WAWebJS { senderId: string ack?: number } + + export type ReactionList = { + id: string, + aggregateEmoji: string, + hasReactionByMe: boolean, + senders: Array + } } export = WAWebJS diff --git a/src/structures/Message.js b/src/structures/Message.js index 2e16ed7755a..87d716311d4 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -5,7 +5,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 @@ -134,6 +135,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} @@ -529,6 +536,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} senders Reaction senders, to this message + */ + + /** + * Gets the reactions associated with the given message + * @return {Promise} + */ + 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; From 812ff0ddfcf17e0879e5e272ba4485d295efaa29 Mon Sep 17 00:00:00 2001 From: tofers Date: Sat, 1 Apr 2023 17:07:39 +0300 Subject: [PATCH 121/430] lastMessage in chat (#1606) * lastMessage in chat * lastMessage info * Update src/util/Injected.js Co-authored-by: Rajeh Taher * fix serialize msg * markup --------- Co-authored-by: tofers Co-authored-by: Rajeh Taher --- index.d.ts | 2 ++ src/structures/Chat.js | 6 ++++++ src/util/Injected.js | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index fa36547954d..ec7ff4c85c3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1038,6 +1038,8 @@ declare namespace WAWebJS { timestamp: number, /** Amount of messages unread */ unreadCount: number, + /** Last message fo chat */ + lastMessage: Message, /** Archives this chat */ archive: () => Promise, diff --git a/src/structures/Chat.js b/src/structures/Chat.js index 241d297d92b..0e0ae78d839 100644 --- a/src/structures/Chat.js +++ b/src/structures/Chat.js @@ -75,6 +75,12 @@ class Chat extends Base { */ this.muteExpiration = data.muteExpiration; + /** + * Last message fo chat + * @type {Message} + */ + this.lastMessage = data.lastMessage ? new Message(super.client, data.lastMessage) : undefined; + return super._patch(data); } diff --git a/src/util/Injected.js b/src/util/Injected.js index b32d50bf7b8..c9a7638a523 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -427,7 +427,15 @@ exports.LoadUtils = () => { await window.Store.GroupMetadata.update(chatWid); res.groupMetadata = chat.groupMetadata.serialize(); } - + + res.lastMessage = null; + if (res.msgs && res.msgs.length) { + const lastMessage = window.Store.Msg.get(chat.lastReceivedKey._serialized); + if (lastMessage) { + res.lastMessage = window.WWebJS.getMessageModel(lastMessage); + } + } + delete res.msgs; delete res.msgUnsyncedButtonReplyMsgs; delete res.unsyncedButtonReplies; From ac7df25075dc5efd5f8718a2ead6d3b47683bd9c Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sat, 1 Apr 2023 17:09:28 +0300 Subject: [PATCH 122/430] Fix media renders (#1981) * Fixed * Update src/util/Injected.js --------- Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> --- src/util/Injected.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/Injected.js b/src/util/Injected.js index c9a7638a523..cf812a9f98e 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -272,6 +272,7 @@ exports.LoadUtils = () => { ...ephemeralFields, ...locationOptions, ...attOptions, + ...(attOptions.toJSON ? attOptions.toJSON() : {}), ...quotedMsgOptions, ...vcardOptions, ...buttonOptions, From 9f154995920da2bab0833664c6e216ed6f485687 Mon Sep 17 00:00:00 2001 From: alechkos <93551621+alechkos@users.noreply.github.com> Date: Sat, 1 Apr 2023 19:40:47 +0300 Subject: [PATCH 123/430] feat: added group_admin_changed event (#2018) * docs: updated * added group-admin-change event * minor changes * added usage example * minor changes: code docs updated --- example.js | 11 +++++++++++ index.d.ts | 7 +++++++ src/Client.js | 8 ++++++++ src/util/Constants.js | 1 + 4 files changed, 27 insertions(+) diff --git a/example.js b/example.js index 9e5eec59c83..7187b6f3194 100644 --- a/example.js +++ b/example.js @@ -270,3 +270,14 @@ client.on('disconnected', (reason) => { console.log('Client was logged out', reason); }); +client.on('group_admin_changed', (notification) => { + if (notification.type === 'promote') { + /** + * Emitted when a current user is promoted to an admin. + * {@link notification.author} is a user who performs the action of promoting/demoting the current user. + */ + console.log(`You were promoted by ${notification.author}`); + } else if (notification.type === 'demote') + /** Emitted when a current user is demoted to a regular user. */ + console.log(`You were demoted by ${notification.author}`); +}); diff --git a/index.d.ts b/index.d.ts index ec7ff4c85c3..1e94099c684 100644 --- a/index.d.ts +++ b/index.d.ts @@ -198,6 +198,12 @@ declare namespace WAWebJS { notification: GroupNotification ) => void): this + /** Emitted when a current user is promoted to an admin or demoted to a regular user */ + on(event: 'group_admin_changed', listener: ( + /** GroupNotification with more information about the action */ + notification: GroupNotification + ) => void): this + /** Emitted when group settings are updated, such as subject, description or picture */ on(event: 'group_update', listener: ( /** GroupNotification with more information about the action */ @@ -512,6 +518,7 @@ declare namespace WAWebJS { MEDIA_UPLOADED = 'media_uploaded', GROUP_JOIN = 'group_join', GROUP_LEAVE = 'group_leave', + GROUP_ADMIN_CHANGED = 'group_admin_changed', GROUP_UPDATE = 'group_update', QR_RECEIVED = 'qr', LOADING_SCREEN = 'loading_screen', diff --git a/src/Client.js b/src/Client.js index acd04ac7af3..586fee8fdce 100644 --- a/src/Client.js +++ b/src/Client.js @@ -45,6 +45,7 @@ const NoAuth = require('./authStrategies/NoAuth'); * @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state + * @fires Client#group_admin_changed */ class Client extends EventEmitter { constructor(options = {}) { @@ -317,6 +318,13 @@ class Client extends EventEmitter { * @param {GroupNotification} notification GroupNotification with more information about the action */ this.emit(Events.GROUP_LEAVE, notification); + } else if (msg.subtype === 'promote' || msg.subtype === 'demote') { + /** + * Emitted when a current user is promoted to an admin or demoted to a regular user. + * @event Client#group_admin_changed + * @param {GroupNotification} notification GroupNotification with more information about the action + */ + this.emit(Events.GROUP_ADMIN_CHANGED, notification); } else { /** * Emitted when group settings are updated, such as subject, description or picture. diff --git a/src/util/Constants.js b/src/util/Constants.js index e341b4cb2d0..39c85df1818 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -46,6 +46,7 @@ exports.Events = { MEDIA_UPLOADED: 'media_uploaded', GROUP_JOIN: 'group_join', GROUP_LEAVE: 'group_leave', + GROUP_ADMIN_CHANGED: 'group_admin_changed', GROUP_UPDATE: 'group_update', QR_RECEIVED: 'qr', LOADING_SCREEN: 'loading_screen', From f44555713d1b5de2e999c3a0e46bae9a868cc5f9 Mon Sep 17 00:00:00 2001 From: Wictor Nogueira <57378387+wictornogueira@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:19:11 -0300 Subject: [PATCH 124/430] Feat: Add chat_removed and chat_archived events (#1778) * Add chat_removed and chat_archived events * Make eslint happy --------- Co-authored-by: Rajeh Taher Co-authored-by: Aliyss Snow <33941859+Aliyss@users.noreply.github.com> --- index.d.ts | 16 ++++++++++++++++ src/Client.js | 24 +++++++++++++++++++++++- src/util/Constants.js | 2 ++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 1e94099c684..98e3a19fb9c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -265,6 +265,22 @@ declare namespace WAWebJS { reaction: Reaction ) => void): this + /** Emitted when a chat is removed */ + on(event: 'chat_removed', listener: ( + /** The chat that was removed */ + chat: Chat + ) => void): this + + /** Emitted when a chat is archived/unarchived */ + on(event: 'chat_archived', listener: ( + /** The chat that was archived/unarchived */ + chat: Chat, + /** State the chat is currently in */ + currState: boolean, + /** State the chat was previously in */ + prevState: boolean + ) => void): this + /** Emitted when loading screen is appearing */ on(event: 'loading_screen', listener: (percent: string, message: string) => void): this diff --git a/src/Client.js b/src/Client.js index 586fee8fdce..5ed011414a3 100644 --- a/src/Client.js +++ b/src/Client.js @@ -10,7 +10,7 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./util/Constan const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction } = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction, Chat } = require('./structures'); const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); const NoAuth = require('./authStrategies/NoAuth'); @@ -524,6 +524,26 @@ class Client extends EventEmitter { } }); + await page.exposeFunction('onRemoveChatEvent', (chat) => { + /** + * Emitted when a chat is removed + * @event Client#chat_removed + * @param {Chat} chat + */ + this.emit(Events.CHAT_REMOVED, new Chat(this, chat)); + }); + + await page.exposeFunction('onArchiveChatEvent', (chat, currState, prevState) => { + /** + * Emitted when a chat is archived/unarchived + * @event Client#chat_archived + * @param {Chat} chat + * @param {boolean} currState + * @param {boolean} prevState + */ + this.emit(Events.CHAT_ARCHIVED, new Chat(this, chat), currState, prevState); + }); + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); @@ -533,6 +553,8 @@ class Client extends EventEmitter { window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); }); window.Store.Call.on('add', (call) => { window.onIncomingCall(call); }); + window.Store.Chat.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WWebJS.getChatModel(chat)); }); + window.Store.Chat.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WWebJS.getChatModel(chat), currState, prevState); }); window.Store.Msg.on('add', (msg) => { if (msg.isNewMsg) { if(msg.type === 'ciphertext') { diff --git a/src/util/Constants.js b/src/util/Constants.js index 39c85df1818..2d77de0e4ae 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -36,6 +36,8 @@ exports.Events = { AUTHENTICATED: 'authenticated', AUTHENTICATION_FAILURE: 'auth_failure', READY: 'ready', + CHAT_REMOVED: 'chat_removed', + CHAT_ARCHIVED: 'chat_archived', MESSAGE_RECEIVED: 'message', MESSAGE_CREATE: 'message_create', MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', From f23ab825655b620e0b977468f5719b7bf5126ee3 Mon Sep 17 00:00:00 2001 From: alechkos <93551621+alechkos@users.noreply.github.com> Date: Sat, 1 Apr 2023 22:30:12 +0300 Subject: [PATCH 125/430] feat: added contact_changed event (#2027) --- example.js | 49 +++++++++++++++++++++++++++++++++++++------ index.d.ts | 13 ++++++++++++ src/Client.js | 31 +++++++++++++++++++++++++++ src/util/Constants.js | 1 + 4 files changed, 88 insertions(+), 6 deletions(-) diff --git a/example.js b/example.js index 7187b6f3194..f00b1303b62 100644 --- a/example.js +++ b/example.js @@ -1,4 +1,4 @@ -const { Client, Location, List, Buttons, LocalAuth} = require('./index'); +const { Client, Location, List, Buttons, LocalAuth } = require('./index'); const client = new Client({ authStrategy: new LocalAuth(), @@ -189,11 +189,11 @@ client.on('message', async msg => { client.interface.openChatWindowAt(quotedMsg.id._serialized); } } else if (msg.body === '!buttons') { - let button = new Buttons('Button body',[{body:'bt1'},{body:'bt2'},{body:'bt3'}],'title','footer'); + let button = new Buttons('Button body', [{ body: 'bt1' }, { body: 'bt2' }, { body: 'bt3' }], 'title', 'footer'); client.sendMessage(msg.from, button); } else if (msg.body === '!list') { - let sections = [{title:'sectionTitle',rows:[{title:'ListItem1', description: 'desc'},{title:'ListItem2'}]}]; - let list = new List('List body','btnText',sections,'Title','footer'); + let sections = [{ title: 'sectionTitle', rows: [{ title: 'ListItem1', description: 'desc' }, { title: 'ListItem2' }] }]; + let list = new List('List body', 'btnText', sections, 'Title', 'footer'); client.sendMessage(msg.from, list); } else if (msg.body === '!reaction') { msg.react('👍'); @@ -231,7 +231,7 @@ client.on('message_ack', (msg, ack) => { ACK_PLAYED: 4 */ - if(ack == 3) { + if (ack == 3) { // The message was read } }); @@ -254,7 +254,7 @@ client.on('group_update', (notification) => { }); client.on('change_state', state => { - console.log('CHANGE STATE', state ); + console.log('CHANGE STATE', state); }); // Change to false if you don't want to reject incoming calls @@ -270,6 +270,43 @@ client.on('disconnected', (reason) => { console.log('Client was logged out', reason); }); +client.on('contact_changed', async (message, oldId, newId, isContact) => { + /** The time the event occurred. */ + const eventTime = (new Date(message.timestamp * 1000)).toLocaleString(); + + console.log( + `The contact ${oldId.slice(0, -5)}` + + `${!isContact ? ' that participates in group ' + + `${(await client.getChatById(message.to ?? message.from)).name} ` : ' '}` + + `changed their phone number\nat ${eventTime}.\n` + + `Their new phone number is ${newId.slice(0, -5)}.\n`); + + /** + * Information about the {@name message}: + * + * 1. If a notification was emitted due to a group participant changing their phone number: + * {@name message.author} is a participant's id before the change. + * {@name message.recipients[0]} is a participant's id after the change (a new one). + * + * 1.1 If the contact who changed their number WAS in the current user's contact list at the time of the change: + * {@name message.to} is a group chat id the event was emitted in. + * {@name message.from} is a current user's id that got an notification message in the group. + * Also the {@name message.fromMe} is TRUE. + * + * 1.2 Otherwise: + * {@name message.from} is a group chat id the event was emitted in. + * {@name message.to} is @type {undefined}. + * Also {@name message.fromMe} is FALSE. + * + * 2. If a notification was emitted due to a contact changing their phone number: + * {@name message.templateParams} is an array of two user's ids: + * the old (before the change) and a new one, stored in alphabetical order. + * {@name message.from} is a current user's id that has a chat with a user, + * whos phone number was changed. + * {@name message.to} is a user's id (after the change), the current user has a chat with. + */ +}); + client.on('group_admin_changed', (notification) => { if (notification.type === 'promote') { /** diff --git a/index.d.ts b/index.d.ts index 98e3a19fb9c..23ba35cd458 100644 --- a/index.d.ts +++ b/index.d.ts @@ -210,6 +210,18 @@ declare namespace WAWebJS { notification: GroupNotification ) => void): this + /** Emitted when a contact or a group participant changed their phone number. */ + on(event: 'contact_changed', listener: ( + /** Message with more information about the event. */ + message: Message, + /** Old user's id. */ + oldId : String, + /** New user's id. */ + newId : String, + /** Indicates if a contact or a group participant changed their phone number. */ + isContact : Boolean + ) => void): this + /** Emitted when media has been uploaded for a message sent by the client */ on(event: 'media_uploaded', listener: ( /** The message with media that was uploaded */ @@ -532,6 +544,7 @@ declare namespace WAWebJS { MESSAGE_REVOKED_ME = 'message_revoke_me', MESSAGE_ACK = 'message_ack', MEDIA_UPLOADED = 'media_uploaded', + CONTACT_CHANGED = 'contact_changed', GROUP_JOIN = 'group_join', GROUP_LEAVE = 'group_leave', GROUP_ADMIN_CHANGED = 'group_admin_changed', diff --git a/src/Client.js b/src/Client.js index 5ed011414a3..d0c949c5d23 100644 --- a/src/Client.js +++ b/src/Client.js @@ -45,6 +45,7 @@ const NoAuth = require('./authStrategies/NoAuth'); * @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state + * @fires Client#contact_changed * @fires Client#group_admin_changed */ class Client extends EventEmitter { @@ -384,6 +385,36 @@ class Client extends EventEmitter { last_message = msg; } + /** + * The event notification that is received when one of + * the group participants changes thier phone number. + */ + const isParticipant = msg.type === 'gp2' && msg.subtype === 'modify'; + + /** + * The event notification that is received when one of + * the contacts changes thier phone number. + */ + const isContact = msg.type === 'notification_template' && msg.subtype === 'change_number'; + + if (isParticipant || isContact) { + /** {@link GroupNotification} object does not provide enough information about this event, so a {@link Message} object is used. */ + const message = new Message(this, msg); + + const newId = isParticipant ? msg.recipients[0] : msg.to; + const oldId = isParticipant ? msg.author : msg.templateParams.find(id => id !== newId); + + /** + * Emitted when a contact or a group participant changes their phone number. + * @event Client#contact_changed + * @param {Message} message Message with more information about the event. + * @param {String} oldId The user's id (an old one) who changed their phone number + * and who triggered the notification. + * @param {String} newId The user's new id after the change. + * @param {Boolean} isContact Indicates if a contact or a group participant changed their phone number. + */ + this.emit(Events.CONTACT_CHANGED, message, oldId, newId, isContact); + } }); await page.exposeFunction('onRemoveMessageEvent', (msg) => { diff --git a/src/util/Constants.js b/src/util/Constants.js index 2d77de0e4ae..97512c1b4d1 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -46,6 +46,7 @@ exports.Events = { UNREAD_COUNT: 'unread_count', MESSAGE_REACTION: 'message_reaction', MEDIA_UPLOADED: 'media_uploaded', + CONTACT_CHANGED: 'contact_changed', GROUP_JOIN: 'group_join', GROUP_LEAVE: 'group_leave', GROUP_ADMIN_CHANGED: 'group_admin_changed', From f8cfc7889c99b7e0d804786ddd68899334b957f6 Mon Sep 17 00:00:00 2001 From: Gabryel Rigol Date: Sun, 9 Apr 2023 09:22:56 -0400 Subject: [PATCH 126/430] Fix isStatus (#2108) * Fix isStatus * Fiz isStatus --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 87d716311d4..97aa3e3cff1 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -109,7 +109,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 From 37724f6959ae3058acc738d2a8fce2e2fe2d5a09 Mon Sep 17 00:00:00 2001 From: tofers Date: Wed, 19 Apr 2023 02:50:08 +0300 Subject: [PATCH 127/430] fix: msg.chat (#2139) * fix function openChatWindowAt * fix star \ unstar * fix function delete * fix closeRightDrawer --- src/structures/Message.js | 21 ++++++++++++--------- src/util/Injected.js | 2 ++ src/util/InterfaceController.js | 6 ++++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 97aa3e3cff1..d16e5ca1f1c 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -443,15 +443,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 && 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); } @@ -459,11 +460,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); } @@ -472,11 +474,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); } diff --git a/src/util/Injected.js b/src/util/Injected.js index cf812a9f98e..cec31434a5d 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -54,6 +54,8 @@ exports.ExposeStore = (moduleRaidStr) => { window.Store.QuotedMsg = window.mR.findModule('getQuotedMsgObj')[0]; window.Store.Socket = window.mR.findModule('deprecatedSendIq')[0]; window.Store.SocketWap = window.mR.findModule('wap')[0]; + window.Store.SearchContext = window.mR.findModule('getSearchContext')[0].getSearchContext; + window.Store.DrawerManager = window.mR.findModule('DrawerManager')[0].DrawerManager; window.Store.StickerTools = { ...window.mR.findModule('toWebpSticker')[0], ...window.mR.findModule('addWebpMetadata')[0] diff --git a/src/util/InterfaceController.js b/src/util/InterfaceController.js index a87959da633..2c7e1cab0af 100644 --- a/src/util/InterfaceController.js +++ b/src/util/InterfaceController.js @@ -50,7 +50,9 @@ class InterfaceController { async openChatWindowAt(msgId) { await this.pupPage.evaluate(async msgId => { let msg = await window.Store.Msg.get(msgId); - await window.Store.Cmd.openChatAt(msg.chat, msg.chat.getSearchContext(msg)); + let chat = await window.Store.Chat.find(msg.id.remote); + let searchContext = await window.Store.SearchContext(chat,msg); + await window.Store.Cmd.openChatAt(chat, searchContext); }, msgId); } @@ -70,7 +72,7 @@ class InterfaceController { */ async closeRightDrawer() { await this.pupPage.evaluate(async () => { - await window.Store.Cmd.closeDrawerRight(); + await window.Store.DrawerManager.closeDrawerRight(); }); } From d8fd4579143624384004c1f966bb1d92f0a69036 Mon Sep 17 00:00:00 2001 From: Pierluca Lino Date: Thu, 20 Apr 2023 17:19:57 +0200 Subject: [PATCH 128/430] feat: Optional proxy autentication (#2143) --- example.js | 6 +++++- index.d.ts | 4 +++- src/Client.js | 5 +++++ src/util/Constants.js | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/example.js b/example.js index f00b1303b62..065fd123ec3 100644 --- a/example.js +++ b/example.js @@ -2,7 +2,11 @@ const { Client, Location, List, Buttons, LocalAuth } = require('./index'); const client = new Client({ authStrategy: new LocalAuth(), - puppeteer: { headless: false } + // proxyAuthentication: { username: 'username', password: 'password' }, + puppeteer: { + // args: ['--proxy-server=proxy-server-that-requires-authentication.example.com'], + headless: false + } }); client.initialize(); diff --git a/index.d.ts b/index.d.ts index 23ba35cd458..38d2ebbd50d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -387,7 +387,9 @@ declare namespace WAWebJS { userAgent?: string /** Ffmpeg path to use when formating videos to webp while sending stickers * @default 'ffmpeg' */ - ffmpegPath?: string + ffmpegPath?: string, + /** Object with proxy autentication requirements @default: undefined */ + proxyAuthentication?: {username: string, password: string} | undefined } /** diff --git a/src/Client.js b/src/Client.js index d0c949c5d23..fef8e4c456d 100644 --- a/src/Client.js +++ b/src/Client.js @@ -29,6 +29,7 @@ const NoAuth = require('./authStrategies/NoAuth'); * @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers * @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy. + * @param {object} options.proxyAuthentication - Proxy Authentication object. * * @fires Client#qr * @fires Client#authenticated @@ -102,6 +103,10 @@ class Client extends EventEmitter { browser = await puppeteer.launch({...puppeteerOpts, args: browserArgs}); page = (await browser.pages())[0]; } + + if (this.options.proxyAuthentication !== undefined) { + await page.authenticate(this.options.proxyAuthentication); + } await page.setUserAgent(this.options.userAgent); if (this.options.bypassCSP) await page.setBypassCSP(true); diff --git a/src/util/Constants.js b/src/util/Constants.js index 97512c1b4d1..aa1005d1550 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -13,7 +13,8 @@ exports.DefaultOptions = { takeoverTimeoutMs: 0, 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 + bypassCSP: false, + proxyAuthentication: undefined }; /** From 081b455fa513758fb06de577973179ee1c82a04a Mon Sep 17 00:00:00 2001 From: tofers Date: Fri, 19 May 2023 19:25:54 +0300 Subject: [PATCH 129/430] hotfix: newId and deviceType (#2196) * update method generate Msg id, newId to newIdV2 * replace newId and await in version WA 2.2321.6 * fix deviceType --- src/structures/Message.js | 3 +-- src/util/Injected.js | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index d16e5ca1f1c..a3b311796ea 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -89,8 +89,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' && data.id.id.length > 21 ? 'android' : typeof data.id.id === 'string' && data.id.id.substring(0, 2) === '3A' ? 'ios' : 'web'; /** * Indicates if the message was forwarded * @type {boolean} diff --git a/src/util/Injected.js b/src/util/Injected.js index cec31434a5d..76d134abe01 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -245,11 +245,12 @@ exports.LoadUtils = () => { const meUser = window.Store.User.getMaybeMeUser(); const isMD = window.Store.MDBackend; - + const newId = await window.Store.MsgKey.newId(); + const newMsgId = new window.Store.MsgKey({ from: meUser, to: chat.id, - id: window.Store.MsgKey.newId(), + id: newId, participant: isMD && chat.id.isGroup() ? meUser : undefined, selfDir: 'out', }); From 2b8eb518ede9f3a5aa165d16e404b63546d25d16 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Fri, 19 May 2023 22:17:56 +0000 Subject: [PATCH 130/430] 1.20.0-alpha.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 012bff6717a..f272b46e3b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.19.5", + "version": "1.20.0-alpha.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 915763a8d04c37c2ddcb93faa512cfe208f1798e Mon Sep 17 00:00:00 2001 From: Pedro S Lopez Date: Fri, 19 May 2023 23:58:10 -0400 Subject: [PATCH 131/430] chore: mark version v1.20.0 --- docs/Base.html | 8 +- docs/BaseAuthStrategy.html | 8 +- docs/BusinessContact.html | 8 +- docs/Buttons.html | 8 +- docs/Call.html | 8 +- docs/Chat.html | 22 +- docs/Client.html | 303 +- docs/Client.js.html | 113 +- docs/ClientInfo.html | 8 +- docs/Contact.html | 8 +- docs/GroupChat.html | 92 +- docs/GroupNotification.html | 8 +- docs/InterfaceController.html | 8 +- docs/Label.html | 8 +- docs/LegacySessionAuth.html | 8 +- docs/List.html | 8 +- docs/LocalAuth.html | 8 +- docs/Location.html | 8 +- docs/Message.html | 38 +- docs/MessageMedia.html | 8 +- docs/NoAuth.html | 8 +- docs/Order.html | 8 +- docs/PrivateChat.html | 24 +- docs/PrivateContact.html | 8 +- docs/Product.html | 8 +- docs/Reaction.html | 8 +- docs/RemoteAuth.html | 8 +- docs/Util.html | 8 +- docs/authStrategies_BaseAuthStrategy.js.html | 8 +- docs/authStrategies_LegacySessionAuth.js.html | 8 +- docs/authStrategies_LocalAuth.js.html | 8 +- docs/authStrategies_NoAuth.js.html | 8 +- docs/authStrategies_RemoteAuth.js.html | 8 +- docs/global.html | 152 +- docs/index.html | 6525 +++++++++-------- docs/structures_Base.js.html | 8 +- docs/structures_BusinessContact.js.html | 8 +- docs/structures_Buttons.js.html | 8 +- docs/structures_Call.js.html | 8 +- docs/structures_Chat.js.html | 14 +- docs/structures_ClientInfo.js.html | 8 +- docs/structures_Contact.js.html | 8 +- docs/structures_GroupChat.js.html | 33 +- docs/structures_GroupNotification.js.html | 8 +- docs/structures_Label.js.html | 8 +- docs/structures_List.js.html | 8 +- docs/structures_Location.js.html | 8 +- docs/structures_Message.js.html | 81 +- docs/structures_MessageMedia.js.html | 8 +- docs/structures_Order.js.html | 8 +- docs/structures_Payment.js.html | 8 +- docs/structures_PrivateChat.js.html | 8 +- docs/structures_PrivateContact.js.html | 8 +- docs/structures_Product.js.html | 8 +- docs/structures_ProductMetadata.js.html | 8 +- docs/structures_Reaction.js.html | 8 +- docs/util_Constants.js.html | 16 +- docs/util_InterfaceController.js.html | 14 +- docs/util_Util.js.html | 8 +- package.json | 2 +- 60 files changed, 4356 insertions(+), 3441 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 8b72b80521c..c8c8fdbfc66 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Base + whatsapp-web.js 1.20.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 45b4f5d15db..ad240e70780 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: BaseAuthStrategy + whatsapp-web.js 1.20.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 8ca34628a7a..9bb1f769896 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: BusinessContact + whatsapp-web.js 1.20.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index db66dc31f4c..646c69c48bd 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Buttons + whatsapp-web.js 1.20.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 2ed0b0d76a7..9f6d2877c63 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Call + whatsapp-web.js 1.20.0 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@

reject<
diff --git a/docs/Chat.html b/docs/Chat.html index 48ef3299c2b..f8d8d21af1c 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Chat + whatsapp-web.js 1.20.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -58,19 +58,22 @@

Properties

isReadOnly
-
muteExpiration
+
lastMessage
-
name
+
muteExpiration
-
pinned
+
name

+
pinned
+
+
timestamp
@@ -185,6 +188,11 @@

isReadOnly

+

lastMessage +  Message

+

Last message fo chat

+
+

muteExpiration  number

Unix timestamp for when the mute expires

@@ -497,7 +505,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 01ef7bb4a6d..fcbbad8d301 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Client + whatsapp-web.js 1.20.0 » Class: Client @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@

+
group_admin_changed
+
+
+
group_join
+
+
group_leave
@@ -447,6 +465,20 @@

Parameters

Sets bypassing of page's Content-Security-Policy.

+ + +

proxyAuthentication

+ + +

 

+ + +

 

+ + +

Proxy Authentication object.

+ + @@ -473,6 +505,8 @@

Parameters

Client#event:group_update
Client#event:disconnected
Client#event:change_state
+
Client#event:contact_changed
+
Client#event:group_admin_changed
@@ -638,6 +672,17 @@

Parameters

async
+

deleteProfilePicture() → Promise containing boolean

+

Deletes the current user's profile picture.

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the picture was properly deleted.

+

+
+
+
async

destroy()

Closes the client

@@ -1515,6 +1560,45 @@

Parameter

async
+

setProfilePicture(media) → Promise containing boolean

+

Sets the current user's profile picture.

+
+

Parameter

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

media

+
+

MessageMedia

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the picture was properly updated.

+

+
+
+
async

setStatus(status)

Sets the current user's status message

@@ -1749,6 +1833,172 @@

Parameter

+

chat_archived

+

Emitted when a chat is archived/unarchived

+
+

Parameters

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

chat

+
+

Chat

+
+

 

+
+
+

currState

+
+

boolean

+
+

 

+
+
+

prevState

+
+

boolean

+
+

 

+
+
+
+
+
+

chat_removed

+

Emitted when a chat is removed

+
+

Parameter

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

chat

+
+

Chat

+
+

 

+
+
+
+
+
+

contact_changed

+

Emitted when a contact or a group participant changes their phone number.

+
+

Parameters

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

message

+
+

Message

+
+

 

+
+

Message with more information about the event.

+
+

oldId

+
+

String

+
+

 

+
+

The user's id (an old one) who changed their phone number + and who triggered the notification.

+
+

newId

+
+

String

+
+

 

+
+

The user's new id after the change.

+
+

isContact

+
+

Boolean

+
+

 

+
+

Indicates if a contact or a group participant changed their phone number.

+
+
+
+

disconnected

Emitted when the client has been disconnected

@@ -1782,6 +2032,39 @@

Parameter

+

group_admin_changed

+

Emitted when a current user is promoted to an admin or demoted to a regular user.

+
+

Parameter

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

notification

+
+

GroupNotification

+
+

 

+
+

GroupNotification with more information about the action

+
+
+
+

group_join

Emitted when a user joins the chat via invite link or is added by an admin.

@@ -2486,7 +2769,7 @@

ready

diff --git a/docs/Client.js.html b/docs/Client.js.html index 6a180d7c51d..80f345bd898 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: Client.js + whatsapp-web.js 1.20.0 » Source: Client.js @@ -15,7 +15,7 @@ @@ -41,7 +41,7 @@

Source: Client.js

const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction } = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction, Chat } = require('./structures'); const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); const NoAuth = require('./authStrategies/NoAuth'); @@ -60,6 +60,7 @@

Source: Client.js

* @param {string} options.userAgent - User agent to use in puppeteer * @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers * @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy. + * @param {object} options.proxyAuthentication - Proxy Authentication object. * * @fires Client#qr * @fires Client#authenticated @@ -76,6 +77,8 @@

Source: Client.js

* @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state + * @fires Client#contact_changed + * @fires Client#group_admin_changed */ class Client extends EventEmitter { constructor(options = {}) { @@ -131,6 +134,10 @@

Source: Client.js

browser = await puppeteer.launch({...puppeteerOpts, args: browserArgs}); page = (await browser.pages())[0]; } + + if (this.options.proxyAuthentication !== undefined) { + await page.authenticate(this.options.proxyAuthentication); + } await page.setUserAgent(this.options.userAgent); if (this.options.bypassCSP) await page.setBypassCSP(true); @@ -348,6 +355,13 @@

Source: Client.js

* @param {GroupNotification} notification GroupNotification with more information about the action */ this.emit(Events.GROUP_LEAVE, notification); + } else if (msg.subtype === 'promote' || msg.subtype === 'demote') { + /** + * Emitted when a current user is promoted to an admin or demoted to a regular user. + * @event Client#group_admin_changed + * @param {GroupNotification} notification GroupNotification with more information about the action + */ + this.emit(Events.GROUP_ADMIN_CHANGED, notification); } else { /** * Emitted when group settings are updated, such as subject, description or picture. @@ -407,6 +421,36 @@

Source: Client.js

last_message = msg; } + /** + * The event notification that is received when one of + * the group participants changes thier phone number. + */ + const isParticipant = msg.type === 'gp2' &amp;&amp; msg.subtype === 'modify'; + + /** + * The event notification that is received when one of + * the contacts changes thier phone number. + */ + const isContact = msg.type === 'notification_template' &amp;&amp; msg.subtype === 'change_number'; + + if (isParticipant || isContact) { + /** {@link GroupNotification} object does not provide enough information about this event, so a {@link Message} object is used. */ + const message = new Message(this, msg); + + const newId = isParticipant ? msg.recipients[0] : msg.to; + const oldId = isParticipant ? msg.author : msg.templateParams.find(id => id !== newId); + + /** + * Emitted when a contact or a group participant changes their phone number. + * @event Client#contact_changed + * @param {Message} message Message with more information about the event. + * @param {String} oldId The user's id (an old one) who changed their phone number + * and who triggered the notification. + * @param {String} newId The user's new id after the change. + * @param {Boolean} isContact Indicates if a contact or a group participant changed their phone number. + */ + this.emit(Events.CONTACT_CHANGED, message, oldId, newId, isContact); + } }); await page.exposeFunction('onRemoveMessageEvent', (msg) => { @@ -438,6 +482,15 @@

Source: Client.js

}); + await page.exposeFunction('onChatUnreadCountEvent', async (data) =>{ + const chat = await this.getChatById(data.id); + + /** + * Emitted when the chat unread count changes + */ + this.emit(Events.UNREAD_COUNT, chat); + }); + await page.exposeFunction('onMessageMediaUploadedEvent', (msg) => { const message = new Message(this, msg); @@ -538,6 +591,26 @@

Source: Client.js

} }); + await page.exposeFunction('onRemoveChatEvent', (chat) => { + /** + * Emitted when a chat is removed + * @event Client#chat_removed + * @param {Chat} chat + */ + this.emit(Events.CHAT_REMOVED, new Chat(this, chat)); + }); + + await page.exposeFunction('onArchiveChatEvent', (chat, currState, prevState) => { + /** + * Emitted when a chat is archived/unarchived + * @event Client#chat_archived + * @param {Chat} chat + * @param {boolean} currState + * @param {boolean} prevState + */ + this.emit(Events.CHAT_ARCHIVED, new Chat(this, chat), currState, prevState); + }); + await page.evaluate(() => { window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); }); window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); }); @@ -547,6 +620,8 @@

Source: Client.js

window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); }); window.Store.Call.on('add', (call) => { window.onIncomingCall(call); }); + window.Store.Chat.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WWebJS.getChatModel(chat)); }); + window.Store.Chat.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WWebJS.getChatModel(chat), currState, prevState); }); window.Store.Msg.on('add', (msg) => { if (msg.isNewMsg) { if(msg.type === 'ciphertext') { @@ -557,7 +632,8 @@

Source: Client.js

} } }); - + window.Store.Chat.on('change:unreadCount', (chat) => {window.onChatUnreadCountEvent(chat);}); + { const module = window.Store.createOrUpdateReactionsModule; const ogMethod = module.createOrUpdateReactions; @@ -1209,6 +1285,31 @@

Source: Client.js

return blockedContacts.map(contact => ContactFactory.create(this.client, contact)); } + + /** + * Sets the current user's profile picture. + * @param {MessageMedia} media + * @returns {Promise&lt;boolean>} Returns true if the picture was properly updated. + */ + async setProfilePicture(media) { + const success = await this.pupPage.evaluate((chatid, media) => { + return window.WWebJS.setPicture(chatid, media); + }, this.info.wid._serialized, media); + + return success; + } + + /** + * Deletes the current user's profile picture. + * @returns {Promise&lt;boolean>} Returns true if the picture was properly deleted. + */ + async deleteProfilePicture() { + const success = await this.pupPage.evaluate((chatid) => { + return window.WWebJS.deletePicture(chatid); + }, this.info.wid._serialized); + + return success; + } } module.exports = Client; @@ -1222,7 +1323,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 02211359be8..9e3ec10a70b 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: ClientInfo + whatsapp-web.js 1.20.0 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index 29a9d00552e..e6fd4f8c893 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Contact + whatsapp-web.js 1.20.0 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index a27f22dedc2..3065d2ec7fc 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: GroupChat + whatsapp-web.js 1.20.0 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -64,19 +64,22 @@

Properties

isReadOnly
-
muteExpiration
+
lastMessage
-
name
+
muteExpiration
-
owner
+
name

+
owner
+
+
participants
@@ -113,6 +116,9 @@

Methods

delete()
+
deletePicture()
+
+
demoteParticipants(participantIds)
@@ -125,13 +131,13 @@

Methods

getInviteCode()
-
getLabels()
-
-
+
getLabels()
+
+
leave()
@@ -159,13 +165,13 @@

Methods

sendSeen()
-
sendStateRecording()
-
-
+
sendStateRecording()
+
+
sendStateTyping()
@@ -178,6 +184,9 @@

Methods

setMessagesAdminsOnly([adminsOnly])
+
setPicture(media)
+
+
setSubject(subject)
@@ -250,6 +259,13 @@

isReadOnlyChat#isReadOnly

+

lastMessage +  unknown

+

Last message fo chat

+
+
Inherited from
+
Chat#lastMessage
+

muteExpiration  unknown

Unix timestamp for when the mute expires

@@ -372,6 +388,17 @@

delete<
async
+

deletePicture() → Promise containing boolean

+

Deletes the group's picture.

+
+
Returns
+
+

Promise containing boolean  +

Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions.

+

+
+
+
async

demoteParticipants(participantIds) → Promise containing {status: number}

Demotes participants by IDs to regular users

@@ -868,6 +895,45 @@

Parameter

async
+

setPicture(media) → Promise containing boolean

+

Sets the group's picture.

+
+

Parameter

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

media

+
+

MessageMedia

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions.

+

+
+
+
async

setSubject(subject) → Promise containing boolean

Updates the group subject

@@ -941,7 +1007,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 739b7a2e7ce..b26ef118c22 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: GroupNotification + whatsapp-web.js 1.20.0 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 862364ce497..9826824cf90 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: InterfaceController + whatsapp-web.js 1.20.0 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index da6fac55466..ddbe7fc2d32 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Label + whatsapp-web.js 1.20.0 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/LegacySessionAuth.html b/docs/LegacySessionAuth.html index b248e58d574..6fdde0bc07a 100644 --- a/docs/LegacySessionAuth.html +++ b/docs/LegacySessionAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: LegacySessionAuth + whatsapp-web.js 1.20.0 » Class: LegacySessionAuth @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

Parameters

diff --git a/docs/List.html b/docs/List.html index f2c4affe3d7..d1190a51908 100644 --- a/docs/List.html +++ b/docs/List.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: List + whatsapp-web.js 1.20.0 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index 1a4f18a4b1a..e722be24c32 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: LocalAuth + whatsapp-web.js 1.20.0 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index 0c80012040a..012a74af7b7 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Location + whatsapp-web.js 1.20.0 » Class: Location @@ -15,7 +15,7 @@ @@ -149,7 +149,7 @@

longitude diff --git a/docs/Message.html b/docs/Message.html index d528a725d33..6d47a76a353 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Message + whatsapp-web.js 1.20.0 » Class: Message @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@

+
location
+
+
mediaKey
@@ -180,13 +183,16 @@

Methods

getQuotedMessage()
-
react(reaction)
+
getReactions()
+
react(reaction)
+
+
reload()
@@ -270,6 +276,11 @@

hasQuotedMsgIndicates if the message was sent as a reply to another message.

+

hasReaction +  boolean

+

Indicates whether there are reactions to the message

+
+

id  object

ID that represents the message

@@ -518,6 +529,15 @@

getQuotedMessage

async
+

getReactions() → Promise containing Array of ReactionList

+

Gets the reactions associated with the given message

+
+
Returns
+
+

Promise containing Array of ReactionList 

+
+
+
async

react(reaction) → Promise

React to this message with an emoji

@@ -650,7 +670,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 17046c40775..5d617b8a49e 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: MessageMedia + whatsapp-web.js 1.20.0 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 1ee676e0483..d112cbc823a 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: NoAuth + whatsapp-web.js 1.20.0 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index a116147fe34..f63b6d44692 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Order + whatsapp-web.js 1.20.0 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index d903c672467..19e1e479d00 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: PrivateChat + whatsapp-web.js 1.20.0 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -58,19 +58,22 @@

Properties

isReadOnly
-
muteExpiration
+
lastMessage
-
name
+
muteExpiration
-
pinned
+
name

+
pinned
+
+
timestamp
@@ -195,6 +198,13 @@

isReadOnlyChat#isReadOnly

+

lastMessage +  unknown

+

Last message fo chat

+
+
Inherited from
+
Chat#lastMessage
+

muteExpiration  unknown

Unix timestamp for when the mute expires

@@ -533,7 +543,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index b41f3e9cb20..20d0e9e089b 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: PrivateContact + whatsapp-web.js 1.20.0 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 549ce626f07..9212e025ccf 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Product + whatsapp-web.js 1.20.0 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index ade180ce7e4..b56459f3f6c 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Reaction + whatsapp-web.js 1.20.0 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 077388e30b6..4003fc49ad5 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: RemoteAuth + whatsapp-web.js 1.20.0 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index ca629bade46..3c6ea6b07ae 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Class: Util + whatsapp-web.js 1.20.0 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 2d02c68cc42..d8b4b2d842b 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.20.0 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LegacySessionAuth.js.html b/docs/authStrategies_LegacySessionAuth.js.html index 3c9e0d3e95b..44642fd748c 100644 --- a/docs/authStrategies_LegacySessionAuth.js.html +++ b/docs/authStrategies_LegacySessionAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/LegacySessionAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/LegacySessionAuth.js @@ -15,7 +15,7 @@ @@ -111,7 +111,7 @@

Source: authStrategies/LegacySessionAuth.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 9b370062d22..58688aba185 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -91,7 +91,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 6321c1d00f6..97d65519f58 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index b4a777fc2e3..c42fea6d51f 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.20.0 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index 50c2cb31a2a..206a6ffdb0f 100644 --- a/docs/global.html +++ b/docs/global.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Globals + whatsapp-web.js 1.20.0 » Globals @@ -15,7 +15,7 @@ @@ -94,6 +94,9 @@

Abstract types

+
ReactionList
+
+
StickerMetadata
@@ -220,6 +223,32 @@

Properties

+ + +

CHAT_REMOVED

+ + +

 

+ + +

 

+ + + + + + +

CHAT_ARCHIVED

+ + +

 

+ + +

 

+ + + +

MESSAGE_RECEIVED

@@ -285,6 +314,19 @@

Properties

+ + +

UNREAD_COUNT

+ + +

 

+ + +

 

+ + + +

MESSAGE_REACTION

@@ -311,6 +353,19 @@

Properties

+ + +

CONTACT_CHANGED

+ + +

 

+ + +

 

+ + + +

GROUP_JOIN

@@ -337,6 +392,19 @@

Properties

+ + +

GROUP_ADMIN_CHANGED

+ + +

 

+ + +

 

+ + + +

GROUP_UPDATE

@@ -1950,6 +2018,82 @@

Properties

+

ReactionList +  Object

+

Reaction List

+
+

Properties

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

id

+
+

string

+
+

 

+
+

Original emoji

+
+

aggregateEmoji

+
+

string

+
+

 

+
+

aggregate emoji

+
+

hasReactionByMe

+
+

boolean

+
+

 

+
+

Flag who sent the reaction

+
+

senders

+
+

Array of Reaction

+
+

 

+
+

Reaction senders, to this message

+
+
+
+

StickerMetadata  Object

Sticker metadata.

@@ -2019,7 +2163,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index 17e9fb84029..8fa8a46861a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,53 +1,52 @@ - - - - - whatsapp-web.js 1.19.5 » Home - - - - - - - - + +
+
+
+ +
+ + +

npm Depfu WhatsApp_Web 2.2306.7 Discord Chat

+

whatsapp-web.js

+

A WhatsApp API client that connects through the WhatsApp Web browser app

+

It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocked.

+

NOTE: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.

+

Quick Links

+ +

Installation

+

The module is now available on npm! npm i whatsapp-web.js

+

Please note that Node v12+ is required.

+

Example usage

+
const { Client } = require('whatsapp-web.js');
 
 const client = new Client();
 
@@ -68,3229 +67,3427 @@ 

Example usage

client.initialize();
-

Take a look at example.js for another example with more use cases.

-

For more information on saving and restoring sessions, check out the available Authentication Strategies.

-

Supported features

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureStatus
Multi Device
Send messages
Receive messages
Send media (images/audio/documents)
Send media (video)(requires google chrome)
Send stickers
Receive media (images/audio/video/documents)
Send contact cards
Send location
Send buttons
Send lists✅ (business accounts not supported)
Receive location
Message replies
Join groups by invite
Get invite for group
Modify group info (subject, description)
Modify group settings (send messages, edit info)
Add group participants
Kick group participants
Promote/demote group participants
Mention users
Mute/unmute chats
Block/unblock contacts
Get contact info
Get profile pictures
Set user status message
React to messages
-

Something missing? Make an issue and let us know!

-

Contributing

-

Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

-

Supporting the project

-

You can support the maintainer of this project through the links below

- -

Disclaimer

-

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

-

License

-

Copyright 2019 Pedro S Lopez

-

Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this project except in compliance with the License. - You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

-

Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License.

-
-
-
-
+

Take a look at example.js for another example with more use cases.

+

For more information on saving and restoring sessions, check out the available Authentication Strategies.

+

Supported features

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureStatus
Multi Device
Send messages
Receive messages
Send media (images/audio/documents)
Send media (video)(requires google chrome)
Send stickers
Receive media (images/audio/video/documents)
Send contact cards
Send location
Send buttons
Send lists✅ (business accounts not supported)
Receive location
Message replies
Join groups by invite
Get invite for group
Modify group info (subject, description)
Modify group settings (send messages, edit info)
Add group participants
Kick group participants
Promote/demote group participants
Mention users
Mute/unmute chats
Block/unblock contacts
Get contact info
Get profile pictures
Set user status message
React to messages
+

Something missing? Make an issue and let us know!

+

Contributing

+

Pull requests are welcome! If you see something you'd like to add, please do. For drastic changes, please open an issue first.

+

Supporting the project

+

You can support the maintainer of this project through the links below

+ +

Disclaimer

+

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.

+

License

+

Copyright 2019 Pedro S Lopez

+

Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this project except in compliance with the License. +You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

+

Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.

+ +
+
+

Base

-
-
-
- Base() -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ Base() +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

BaseAuthStrategy

-
-
-
- BaseAuthStrategy() -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ BaseAuthStrategy() +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

BusinessContact

- - - + + + + + +
-
-
-
-
+
+
+
+

Buttons

- -
-
-
- Buttons#body -
-
-
-
- Buttons#buttons -
-
-
-
-
-
-
-
- Buttons#footer -
-
-
-
- Buttons#title -
-
-
-
-
+ + +
+
+
+ Buttons#body +
+
+
+
+ Buttons#buttons +
+
+
+
+
+ +
+
+
+ Buttons#footer +
+
+
+
+ Buttons#title +
+
+
+
+
+
-
-
-
-
+
+
+
+

Call

-
-
-
- Call() -
-
-
-
- Call#canHandleLocally -
-
-
-
- Call#from -
-
-
-
- Call#fromMe -
-
-
-
-
-
-
-
- Call#id -
-
-
-
- Call#isGroup -
-
-
-
- Call#isVideo -
-
-
-
- Call#participants -
-
-
-
-
-
-
-
- Call#reject() -
-
-
-
- Call#timestamp -
-
-
-
- Call#webClientShouldHandle -
-
-
-
-
+
+
+
+ Call() +
+
+
+
+ Call#canHandleLocally +
+
+
+
+ Call#from +
+
+
+
+ Call#fromMe +
+
+
+
+
+ +
+
+
+ Call#id +
+
+
+
+ Call#isGroup +
+
+
+
+ Call#isVideo +
+
+
+
+ Call#participants +
+
+
+
+
+ +
+
+
+ Call#reject() +
+
+
+
+ Call#timestamp +
+
+
+
+ Call#webClientShouldHandle +
+
+
+
+
+
-
-
-
-
+
+
+
+

Chat

-
-
-
- Chat() -
-
-
-
- Chat#archive() -
-
-
-
- Chat#archived -
-
-
-
- Chat#clearMessages() -
-
-
-
- Chat#clearState() -
-
-
-
- Chat#delete() -
-
-
-
- Chat#fetchMessages(searchOptions) -
-
-
-
- Chat#getContact() -
-
-
-
- Chat#getLabels() -
-
-
-
- Chat#id -
-
-
-
-
-
-
-
- Chat#isGroup -
-
-
-
- Chat#isMuted -
-
-
-
- Chat#isReadOnly -
-
-
-
- Chat#markUnread() -
-
-
-
- Chat#mute(unmuteDate) -
-
-
-
- Chat#muteExpiration -
-
-
-
- Chat#name -
-
-
-
- Chat#pin() -
-
-
-
- Chat#pinned -
-
-
-
- Chat#sendMessage(content[, options]) -
-
-
-
-
-
-
-
- Chat#sendSeen() -
-
-
-
- Chat#sendStateRecording() -
-
-
-
- Chat#sendStateTyping() -
-
-
-
- Chat#timestamp -
-
-
-
- Chat#unarchive() -
-
-
-
- Chat#unmute() -
-
-
-
- Chat#unpin() -
-
-
-
- Chat#unreadCount -
-
-
-
-
+
+
+
+ Chat() +
+
+
+
+ Chat#archive() +
+
+
+
+ Chat#archived +
+
+
+
+ Chat#clearMessages() +
+
+
+
+ Chat#clearState() +
+
+
+
+ Chat#delete() +
+
+
+
+ Chat#fetchMessages(searchOptions) +
+
+
+
+ Chat#getContact() +
+
+
+
+ Chat#getLabels() +
+
+
+
+ Chat#id +
+
+
+
+
+ +
+
+
+ Chat#isGroup +
+
+
+
+ Chat#isMuted +
+
+
+
+ Chat#isReadOnly +
+
+
+
+ Chat#lastMessage +
+
+
+
+ Chat#markUnread() +
+
+
+
+ Chat#mute(unmuteDate) +
+
+
+
+ Chat#muteExpiration +
+
+
+
+ Chat#name +
+
+
+
+ Chat#pin() +
+
+
+
+ Chat#pinned +
+
+
+
+
+ + +
-
-
-
-
+
+
+
+

ChatTypes

-
-
-
- ChatTypes.GROUP -
-
-
-
-
-
-
-
- ChatTypes.SOLO -
-
-
-
-
-
-
-
- ChatTypes.UNKNOWN -
-
-
-
-
+
+
+
+ ChatTypes.GROUP +
+
+
+
+
+ +
+
+
+ ChatTypes.SOLO +
+
+
+
+
+ +
+
+
+ ChatTypes.UNKNOWN +
+
+
+
+
+
-
-
-
-
+
+
+
+

Client

- - - + + + + + +
-
-
-
-
+
+
+
+

ClientInfo

-
-
-
- ClientInfo() -
-
-
-
- ClientInfo#getBatteryStatus() -
-
-
-
- ClientInfo#me -
-
-
-
-
-
-
-
- ClientInfo#phone -
-
-
-
- ClientInfo#platform -
-
-
-
- ClientInfo#pushname -
-
-
-
-
-
-
-
- ClientInfo#wid -
-
-
-
-
+
+
+
+ ClientInfo() +
+
+
+
+ ClientInfo#getBatteryStatus() +
+
+
+
+ ClientInfo#me +
+
+
+
+
+ +
+
+
+ ClientInfo#phone +
+
+
+
+ ClientInfo#platform +
+
+
+
+ ClientInfo#pushname +
+
+
+
+
+ +
+
+
+ ClientInfo#wid +
+
+
+
+
+
-
-
-
-
+
+
+
+

Contact

- -
-
-
- Contact#id -
-
-
-
- Contact#isBlocked -
-
-
-
- Contact#isBusiness -
-
-
-
- Contact#isEnterprise -
-
-
-
- Contact#isGroup -
-
-
-
- Contact#isMe -
-
-
-
- Contact#isMyContact -
-
-
-
- Contact#isUser -
-
-
-
-
-
-
-
- Contact#isWAContact -
-
-
-
- Contact#name -
-
-
-
- Contact#number -
-
-
-
- Contact#pushname -
-
-
-
- Contact#shortName -
-
-
-
- Contact#unblock() -
-
-
-
-
+ + +
+
+
+ Contact#id +
+
+
+
+ Contact#isBlocked +
+
+
+
+ Contact#isBusiness +
+
+
+
+ Contact#isEnterprise +
+
+
+
+ Contact#isGroup +
+
+
+
+ Contact#isMe +
+
+
+
+ Contact#isMyContact +
+
+
+
+ Contact#isUser +
+
+
+
+
+ +
+
+
+ Contact#isWAContact +
+
+
+
+ Contact#name +
+
+
+
+ Contact#number +
+
+
+
+ Contact#pushname +
+
+
+
+ Contact#shortName +
+
+
+
+ Contact#unblock() +
+
+
+
+
+
-
-
-
-
+
+
+
+

Events

- - - + + + + + +
-
-
-
-
+
+
+
+

GroupChat

- - - + + + + + +
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+ -
-
-
+
+
+
+ -
-
-
+
+
+
+

Label

-
-
-
- Label(client, labelData) -
-
-
-
- Label#getChats() -
-
-
-
-
-
-
-
- Label#hexColor -
-
-
-
- Label#id -
-
-
-
-
-
-
-
- Label#name -
-
-
-
-
+
+
+
+ Label(client, labelData) +
+
+
+
+ Label#getChats() +
+
+
+
+
+ +
+
+
+ Label#hexColor +
+
+
+
+ Label#id +
+
+
+
+
+ +
+
+
+ Label#name +
+
+
+
+
+
-
-
-
-
+
+
+
+

LegacySessionAuth

-
-
-
- LegacySessionAuth(options) -
-
-
-
-
-
-
-
-
-
-
-
-
+ + +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

List

- -
-
-
- List#description -
-
-
-
- List#footer -
-
-
-
- List#sections -
-
-
-
-
-
-
-
- List#title -
-
-
-
-
+ + +
+
+
+ List#description +
+
+
+
+ List#footer +
+
+
+
+ List#sections +
+
+
+
+
+ +
+
+
+ List#title +
+
+
+
+
+
-
-
-
-
+
+
+
+

LocalAuth

-
-
-
- LocalAuth(options) -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ LocalAuth(options) +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Location

- -
-
-
- Location#latitude -
-
-
-
- Location#longitude -
-
-
-
-
-
-
-
-
+ + +
+
+
+ Location#latitude +
+
+
+
+ Location#longitude +
+
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Message

- - - + + + + +
+
+
+ Message#links +
+
+
+
+ Message#location +
+
+
+
+ Message#mediaKey +
+
+
+
+ Message#mentionedIds +
+
+
+
+ Message#orderId +
+
+
+
+ Message#rawData +
+
+
+
+ Message#react(reaction) +
+
+
+
+ Message#reload() +
+
+
+
+ Message#reply(content[, chatId][, options]) +
+
+
+
+ Message#star() +
+
+
+
+ Message#timestamp +
+
+
+
+ Message#to +
+
+
+
+ Message#token +
+
+
+
+ Message#type +
+
+
+
+ Message#unstar() +
+
+
+
+ Message#vCards +
+
+
+
+
+
-
-
-
-
+
+
+
+

MessageAck

-
-
-
- MessageAck.ACK_DEVICE -
-
-
-
- MessageAck.ACK_ERROR -
-
-
-
-
-
-
-
- MessageAck.ACK_PENDING -
-
-
-
- MessageAck.ACK_PLAYED -
-
-
-
-
-
-
-
- MessageAck.ACK_READ -
-
-
-
- MessageAck.ACK_SERVER -
-
-
-
-
+
+
+
+ MessageAck.ACK_DEVICE +
+
+
+
+ MessageAck.ACK_ERROR +
+
+
+
+
+ + + +
+
+
+ MessageAck.ACK_READ +
+
+
+
+ MessageAck.ACK_SERVER +
+
+
+
+
+
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+

MessageTypes

- - - + + + + + +
-
-
-
-
+
+
+
+

NoAuth

-
-
-
- NoAuth() -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ NoAuth() +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Order

-
-
-
- Order() -
-
-
-
- Order#createdAt -
-
-
-
-
-
-
-
- Order#currency -
-
-
-
- Order#subtotal -
-
-
-
-
-
-
-
- Order#total -
-
-
-
-
+
+
+
+ Order() +
+
+
+
+ Order#createdAt +
+
+
+
+
+ +
+
+
+ Order#currency +
+
+
+
+ Order#subtotal +
+
+
+
+
+ +
+
+
+ Order#total +
+
+
+
+
+
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+

PrivateChat

- - - + + + + + +
-
-
-
-
+
+
+
+

PrivateContact

- - - + + + + + +
-
-
-
-
+
+
+
+

Product

-
-
-
- Product() -
-
-
-
- Product#currency -
-
-
-
- Product#data -
-
-
-
-
-
-
-
- Product#id -
-
-
-
- Product#name -
-
-
-
- Product#price -
-
-
-
-
-
-
-
- Product#quantity -
-
-
-
- Product#thumbnailUrl -
-
-
-
-
+
+
+
+ Product() +
+
+
+
+ Product#currency +
+
+
+
+ Product#data +
+
+
+
+
+ +
+
+
+ Product#id +
+
+
+
+ Product#name +
+
+
+
+ Product#price +
+
+
+
+
+ +
+
+
+ Product#quantity +
+
+
+
+ Product#thumbnailUrl +
+
+
+
+
+
-
-
-
-
+
+
+
+

ProductMetadata

- - -
-
-
-
+ + + + +
+
+
+
+
-
-
-
-
+
+
+
+

Reaction

-
-
-
- Reaction() -
-
-
-
- Reaction#ack -
-
-
-
- Reaction#id -
-
-
-
- Reaction#msgId -
-
-
-
-
-
-
-
- Reaction#orphan -
-
-
-
- Reaction#orphanReason -
-
-
-
- Reaction#reaction -
-
-
-
- Reaction#read -
-
-
-
-
-
-
-
- Reaction#senderId -
-
-
-
- Reaction#timestamp -
-
-
-
-
+
+
+
+ Reaction() +
+
+
+
+ Reaction#ack +
+
+
+
+ Reaction#id +
+
+
+
+ Reaction#msgId +
+
+
+
+
+ +
+
+
+ Reaction#orphan +
+
+
+
+ Reaction#orphanReason +
+
+
+
+ Reaction#reaction +
+
+
+
+ Reaction#read +
+
+
+
+
+ +
+
+
+ Reaction#senderId +
+
+
+
+ Reaction#timestamp +
+
+
+
+
+
-
-
-
-
+
+
+
+

RemoteAuth

-
-
-
- RemoteAuth(options) -
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ RemoteAuth(options) +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
-
-
-
-
+
+
+
+

Status

-
-
-
- Status.AUTHENTICATING -
-
-
-
-
-
-
-
- Status.INITIALIZING -
-
-
-
-
-
-
-
- Status.READY -
-
-
-
-
+
+
+
+ Status.AUTHENTICATING +
+
+
+
+
+ +
+
+
+ Status.INITIALIZING +
+
+
+
+
+ +
+
+
+ Status.READY +
+
+
+
+
+
-
-
-
-
+
+
+
+ -
-
-
+
+
+
+

WAState

-
-
-
- WAState.CONFLICT -
-
-
-
- WAState.CONNECTED -
-
-
-
- WAState.DEPRECATED_VERSION -
-
-
-
- WAState.OPENING -
-
-
-
-
-
-
-
- WAState.PAIRING -
-
-
-
- WAState.PROXYBLOCK -
-
-
-
- WAState.SMB_TOS_BLOCK -
-
-
-
- WAState.TIMEOUT -
-
-
-
-
-
-
-
- WAState.TOS_BLOCK -
-
-
-
- WAState.UNLAUNCHED -
-
-
-
- WAState.UNPAIRED -
-
-
-
- WAState.UNPAIRED_IDLE -
-
-
-
-
+
+
+
+ WAState.CONFLICT +
+
+
+
+ WAState.CONNECTED +
+
+
+
+ WAState.DEPRECATED_VERSION +
+
+
+
+ WAState.OPENING +
+
+
+
+
+ +
+
+
+ WAState.PAIRING +
+
+
+
+ WAState.PROXYBLOCK +
+
+
+
+ WAState.SMB_TOS_BLOCK +
+
+
+
+ WAState.TIMEOUT +
+
+
+
+
+ +
+
+
+ WAState.TOS_BLOCK +
+
+
+
+ WAState.UNLAUNCHED +
+
+
+
+ WAState.UNPAIRED +
+
+
+
+ WAState.UNPAIRED_IDLE +
+
+
+
+
+
-
-
-
-
-

- -

- -
- -
- - - - - - - - - \ No newline at end of file + + + + + + + + + +
+ +
+ + + + + + + + diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 92989987396..d43cdbadbc2 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Base.js + whatsapp-web.js 1.20.0 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 3b5feb76e9c..1912469bd0c 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/BusinessContact.js + whatsapp-web.js 1.20.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 7637c6ca051..96a7203c7f4 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Buttons.js + whatsapp-web.js 1.20.0 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index 09504d6944b..98dfdfff87f 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Call.js + whatsapp-web.js 1.20.0 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index e470070c975..9baaa840a21 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Chat.js + whatsapp-web.js 1.20.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -106,6 +106,12 @@

Source: structures/Chat.js

*/ this.muteExpiration = data.muteExpiration; + /** + * Last message fo chat + * @type {Message} + */ + this.lastMessage = data.lastMessage ? new Message(super.client, data.lastMessage) : undefined; + return super._patch(data); } @@ -299,7 +305,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 5c59f8448d5..d7878b8e701 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/ClientInfo.js + whatsapp-web.js 1.20.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 9659220f026..bce1f316d58 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Contact.js + whatsapp-web.js 1.20.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -245,7 +245,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 03ef7ee6acb..737830fd4cc 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/GroupChat.js + whatsapp-web.js 1.20.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -244,6 +244,31 @@

Source: structures/GroupChat.js

return true; } + /** + * Deletes the group's picture. + * @returns {Promise&lt;boolean>} Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions. + */ + async deletePicture() { + const success = await this.client.pupPage.evaluate((chatid) => { + return window.WWebJS.deletePicture(chatid); + }, this.id._serialized); + + return success; + } + + /** + * Sets the group's picture. + * @param {MessageMedia} media + * @returns {Promise&lt;boolean>} Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions. + */ + async setPicture(media) { + const success = await this.client.pupPage.evaluate((chatid, media) => { + return window.WWebJS.setPicture(chatid, media); + }, this.id._serialized, media); + + return success; + } + /** * Gets the invite code for a specific group * @returns {Promise&lt;string>} Group's invite code @@ -294,7 +319,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 8885d690d38..4c3a80c695e 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/GroupNotification.js + whatsapp-web.js 1.20.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 0085387f54b..e30b9a3f608 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Label.js + whatsapp-web.js 1.20.0 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 4939fa15bd0..a258dd4b463 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/List.js + whatsapp-web.js 1.20.0 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 2e263b664b9..cb490a8dbed 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Location.js + whatsapp-web.js 1.20.0 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -71,7 +71,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 42962cb01ab..e86248cfbb7 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Message.js + whatsapp-web.js 1.20.0 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -36,7 +36,8 @@

Source: structures/Message.js

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 @@

Source: structures/Message.js

* 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 @@

Source: structures/Message.js

* 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 @@

Source: structures/Message.js

*/ 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 @@

Source: structures/Message.js

* @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 @@

Source: structures/Message.js

* 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 @@

Source: structures/Message.js

* 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 @@

Source: structures/Message.js

} 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 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 5648e76c258..eac0353eff9 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/MessageMedia.js + whatsapp-web.js 1.20.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 3da4befad2b..ab36e6683d0 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Order.js + whatsapp-web.js 1.20.0 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index 2392de09973..197016bc381 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Payment.js + whatsapp-web.js 1.20.0 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 46d5c2ee8e8..a247712941d 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/PrivateChat.js + whatsapp-web.js 1.20.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 0bf52689eb2..d30f3c34538 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/PrivateContact.js + whatsapp-web.js 1.20.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index 6a42dbf231b..c991bc96156 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Product.js + whatsapp-web.js 1.20.0 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index be6fa76ff5e..e370c26f776 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.20.0 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index e4e4b009a02..2af40deb866 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: structures/Reaction.js + whatsapp-web.js 1.20.0 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 9389185d781..2d155800c62 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: util/Constants.js + whatsapp-web.js 1.20.0 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -44,7 +44,8 @@

Source: util/Constants.js

takeoverTimeoutMs: 0, 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 + bypassCSP: false, + proxyAuthentication: undefined }; /** @@ -67,15 +68,20 @@

Source: util/Constants.js

AUTHENTICATED: 'authenticated', AUTHENTICATION_FAILURE: 'auth_failure', READY: 'ready', + CHAT_REMOVED: 'chat_removed', + CHAT_ARCHIVED: 'chat_archived', MESSAGE_RECEIVED: 'message', MESSAGE_CREATE: 'message_create', MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone', MESSAGE_REVOKED_ME: 'message_revoke_me', MESSAGE_ACK: 'message_ack', + UNREAD_COUNT: 'unread_count', MESSAGE_REACTION: 'message_reaction', MEDIA_UPLOADED: 'media_uploaded', + CONTACT_CHANGED: 'contact_changed', GROUP_JOIN: 'group_join', GROUP_LEAVE: 'group_leave', + GROUP_ADMIN_CHANGED: 'group_admin_changed', GROUP_UPDATE: 'group_update', QR_RECEIVED: 'qr', LOADING_SCREEN: 'loading_screen', @@ -200,7 +206,7 @@

Source: util/Constants.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index 17abf6d5992..eb5aea6ad67 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: util/InterfaceController.js + whatsapp-web.js 1.20.0 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -81,7 +81,9 @@

Source: util/InterfaceController.js

async openChatWindowAt(msgId) { await this.pupPage.evaluate(async msgId => { let msg = await window.Store.Msg.get(msgId); - await window.Store.Cmd.openChatAt(msg.chat, msg.chat.getSearchContext(msg)); + let chat = await window.Store.Chat.find(msg.id.remote); + let searchContext = await window.Store.SearchContext(chat,msg); + await window.Store.Cmd.openChatAt(chat, searchContext); }, msgId); } @@ -101,7 +103,7 @@

Source: util/InterfaceController.js

*/ async closeRightDrawer() { await this.pupPage.evaluate(async () => { - await window.Store.Cmd.closeDrawerRight(); + await window.Store.DrawerManager.closeDrawerRight(); }); } @@ -164,7 +166,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index ee2b4b4c503..e852f0b1351 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -2,9 +2,9 @@ - + - whatsapp-web.js 1.19.5 » Source: util/Util.js + whatsapp-web.js 1.20.0 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/package.json b/package.json index f272b46e3b9..e951c56df0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.20.0-alpha.0", + "version": "1.20.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "typings": "./index.d.ts", From 8ae0c0d4843993a25f6ec0e50e337ddc5e4e6219 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Mon, 29 May 2023 02:31:03 -0400 Subject: [PATCH 132/430] feat(reliability): WhatsApp Web version caching (#1847) * feat: use specific whatsapp web version * add constants to version updater * configurable caches * rename * typings * rm extraneous export * missing from the rename * rm version resolver * match readme version * use try-catch * only persist if cache miss --- .gitignore | 5 +++- index.d.ts | 22 ++++++++++++++ src/Client.js | 33 +++++++++++++++++++++ src/util/Constants.js | 4 +++ src/webCache/LocalWebCache.js | 43 ++++++++++++++++++++++++++++ src/webCache/RemoteWebCache.js | 40 ++++++++++++++++++++++++++ src/webCache/WebCache.js | 14 +++++++++ src/webCache/WebCacheFactory.js | 20 +++++++++++++ tools/version-checker/update-version | 25 ++++++++++------ 9 files changed, 197 insertions(+), 9 deletions(-) create mode 100644 src/webCache/LocalWebCache.js create mode 100644 src/webCache/RemoteWebCache.js create mode 100644 src/webCache/WebCache.js create mode 100644 src/webCache/WebCacheFactory.js diff --git a/.gitignore b/.gitignore index 79f64679f2d..12b53d4ca55 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,7 @@ typings/ # Test sessions *session.json -.wwebjs_auth/ \ No newline at end of file +.wwebjs_auth/ + +# local version cache +.wwebjs_cache/ diff --git a/index.d.ts b/index.d.ts index 38d2ebbd50d..4b686a69dd9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -365,6 +365,10 @@ declare namespace WAWebJS { puppeteer?: puppeteer.PuppeteerNodeLaunchOptions & puppeteer.ConnectOptions /** Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. */ authStrategy?: AuthStrategy, + /** The version of WhatsApp Web to use. Use options.webVersionCache to configure how the version is retrieved. */ + webVersion?: string, + /** Determines how to retrieve the WhatsApp Web version specified in options.webVersion. */ + webVersionCache?: WebCacheOptions, /** How many times should the qrcode be refreshed before giving up * @default 0 (disabled) */ qrMaxRetries?: number, @@ -392,6 +396,24 @@ declare namespace WAWebJS { proxyAuthentication?: {username: string, password: string} | undefined } + export interface LocalWebCacheOptions { + type: 'local', + path?: string, + strict?: boolean + } + + export interface RemoteWebCacheOptions { + type: 'remote', + remotePath: string, + strict?: boolean + } + + export interface NoWebCacheOptions { + type: 'none' + } + + export type WebCacheOptions = NoWebCacheOptions | LocalWebCacheOptions | RemoteWebCacheOptions; + /** * Base class which all authentication strategies extend */ diff --git a/src/Client.js b/src/Client.js index fef8e4c456d..d59bac6fde1 100644 --- a/src/Client.js +++ b/src/Client.js @@ -10,6 +10,7 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./util/Constan const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); +const WebCacheFactory = require('./webCache/WebCacheFactory'); const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction, Chat } = require('./structures'); const LegacySessionAuth = require('./authStrategies/LegacySessionAuth'); const NoAuth = require('./authStrategies/NoAuth'); @@ -19,6 +20,8 @@ const NoAuth = require('./authStrategies/NoAuth'); * @extends {EventEmitter} * @param {object} options - Client options * @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. + * @param {string} options.webVersion - The version of WhatsApp Web to use. Use options.webVersionCache to configure how the version is retrieved. + * @param {object} options.webVersionCache - Determines how to retrieve the WhatsApp Web version. Defaults to a local cache (LocalWebCache) that falls back to latest if the requested version is not found. * @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer * @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ * @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up @@ -115,6 +118,7 @@ class Client extends EventEmitter { this.pupPage = page; await this.authStrategy.afterBrowserInitialized(); + await this.initWebVersionCache(); await page.goto(WhatsWebURL, { waitUntil: 'load', @@ -638,6 +642,35 @@ class Client extends EventEmitter { }); } + async initWebVersionCache() { + const { type: webCacheType, ...webCacheOptions } = this.options.webVersionCache; + const webCache = WebCacheFactory.createWebCache(webCacheType, webCacheOptions); + + const requestedVersion = this.options.webVersion; + const versionContent = await webCache.resolve(requestedVersion); + + if(versionContent) { + await this.pupPage.setRequestInterception(true); + this.pupPage.on('request', async (req) => { + if(req.url() === WhatsWebURL) { + req.respond({ + status: 200, + contentType: 'text/html', + body: versionContent + }); + } else { + req.continue(); + } + }); + } else { + this.pupPage.on('response', async (res) => { + if(res.ok() && res.url() === WhatsWebURL) { + await webCache.persist(await res.text()); + } + }); + } + } + /** * Closes the client */ diff --git a/src/util/Constants.js b/src/util/Constants.js index aa1005d1550..96de7130d3d 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -7,6 +7,10 @@ exports.DefaultOptions = { headless: true, defaultViewport: null }, + webVersion: '2.2306.7', + webVersionCache: { + type: 'local', + }, authTimeoutMs: 0, qrMaxRetries: 0, takeoverOnConflict: false, diff --git a/src/webCache/LocalWebCache.js b/src/webCache/LocalWebCache.js new file mode 100644 index 00000000000..a377f559b54 --- /dev/null +++ b/src/webCache/LocalWebCache.js @@ -0,0 +1,43 @@ +const path = require('path'); +const fs = require('fs'); + +const { WebCache, VersionResolveError } = require('./WebCache'); + +/** + * LocalWebCache - Fetches a WhatsApp Web version from a local file store + * @param {object} options - options + * @param {string} options.path - Path to the directory where cached versions are saved, default is: "./.wwebjs_cache/" + * @param {boolean} options.strict - If true, will throw an error if the requested version can't be fetched. If false, will resolve to the latest version. + */ +class LocalWebCache extends WebCache { + constructor(options = {}) { + super(); + + this.path = options.path || './.wwebjs_cache/'; + this.strict = options.strict || false; + } + + async resolve(version) { + const filePath = path.join(this.path, `${version}.html`); + + try { + return fs.readFileSync(filePath, 'utf-8'); + } + catch (err) { + if (this.strict) throw new VersionResolveError(`Couldn't load version ${version} from the cache`); + return null; + } + } + + async persist(indexHtml) { + // extract version from index (e.g. manifest-2.2206.9.json -> 2.2206.9) + const version = indexHtml.match(/manifest-([\d\\.]+)\.json/)[1]; + if(!version) return; + + const filePath = path.join(this.path, `${version}.html`); + fs.mkdirSync(this.path, { recursive: true }); + fs.writeFileSync(filePath, indexHtml); + } +} + +module.exports = LocalWebCache; \ No newline at end of file diff --git a/src/webCache/RemoteWebCache.js b/src/webCache/RemoteWebCache.js new file mode 100644 index 00000000000..04da0f19ff1 --- /dev/null +++ b/src/webCache/RemoteWebCache.js @@ -0,0 +1,40 @@ +const fetch = require('node-fetch'); +const { WebCache, VersionResolveError } = require('./WebCache'); + +/** + * RemoteWebCache - Fetches a WhatsApp Web version index from a remote server + * @param {object} options - options + * @param {string} options.remotePath - Endpoint that should be used to fetch the version index. Use {version} as a placeholder for the version number. + * @param {boolean} options.strict - If true, will throw an error if the requested version can't be fetched. If false, will resolve to the latest version. Defaults to false. + */ +class RemoteWebCache extends WebCache { + constructor(options = {}) { + super(); + + if (!options.remotePath) throw new Error('webVersionCache.remotePath is required when using the remote cache'); + this.remotePath = options.remotePath; + this.strict = options.strict || false; + } + + async resolve(version) { + const remotePath = this.remotePath.replace('{version}', version); + + try { + const cachedRes = await fetch(remotePath); + if (cachedRes.ok) { + return cachedRes.text(); + } + } catch (err) { + console.error(`Error fetching version ${version} from remote`, err); + } + + if (this.strict) throw new VersionResolveError(`Couldn't load version ${version} from the archive`); + return null; + } + + async persist() { + // Nothing to do here + } +} + +module.exports = RemoteWebCache; \ No newline at end of file diff --git a/src/webCache/WebCache.js b/src/webCache/WebCache.js new file mode 100644 index 00000000000..44602183253 --- /dev/null +++ b/src/webCache/WebCache.js @@ -0,0 +1,14 @@ +/** + * Default implementation of a web version cache that does nothing. + */ +class WebCache { + async resolve() { return null; } + async persist() { } +} + +class VersionResolveError extends Error { } + +module.exports = { + WebCache, + VersionResolveError +}; \ No newline at end of file diff --git a/src/webCache/WebCacheFactory.js b/src/webCache/WebCacheFactory.js new file mode 100644 index 00000000000..2c4fda71ec5 --- /dev/null +++ b/src/webCache/WebCacheFactory.js @@ -0,0 +1,20 @@ +const RemoteWebCache = require('./RemoteWebCache'); +const LocalWebCache = require('./LocalWebCache'); +const { WebCache } = require('./WebCache'); + +const createWebCache = (type, options) => { + switch (type) { + case 'remote': + return new RemoteWebCache(options); + case 'local': + return new LocalWebCache(options); + case 'none': + return new WebCache(); + default: + throw new Error(`Invalid WebCache type ${type}`); + } +}; + +module.exports = { + createWebCache, +}; \ No newline at end of file diff --git a/tools/version-checker/update-version b/tools/version-checker/update-version index 3afbb275ed5..dc68d2381b6 100755 --- a/tools/version-checker/update-version +++ b/tools/version-checker/update-version @@ -18,15 +18,24 @@ const getCurrentVersion = () => { } }; +const updateInFile = (filePath, oldVersion, newVersion) => { + const originalFile = fs.readFileSync(filePath); + const newFile = originalFile.toString().replaceAll(oldVersion, newVersion); + + fs.writeFileSync(filePath, newFile); +}; + const updateVersion = async (oldVersion, newVersion) => { - const readmePath = '../../README.md'; - - const readme = fs.readFileSync(readmePath); - const newReadme = readme.toString().replaceAll(oldVersion, newVersion); - - fs.writeFileSync(readmePath, newReadme); - fs.writeFileSync('./.version', newVersion); - + const filesToUpdate = [ + '../../src/util/Constants.js', + '../../README.md', + ]; + + for (const file of filesToUpdate) { + updateInFile(file, oldVersion, newVersion); + } + + fs.writeFileSync('./.version', newVersion); }; (async () => { From 7cf4532258c85ab4c13996efef7a9f6855b174a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 02:31:25 -0400 Subject: [PATCH 133/430] Update supported WhatsApp Web version to v2.2322.15 (#2004) Co-authored-by: pedroslopez --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index adb1cfec916..2a7d39ce30a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2306.7](https://img.shields.io/badge/WhatsApp_Web-2.2306.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2322.15](https://img.shields.io/badge/WhatsApp_Web-2.2322.15-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index e7197d623dd..1a9d27c59f2 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2306.7 \ No newline at end of file +2.2322.15 \ No newline at end of file From 2574c9d4871f9f5e52aa1faaf0d953fadbf1e509 Mon Sep 17 00:00:00 2001 From: "Pedro S. Lopez" Date: Mon, 29 May 2023 02:31:42 -0400 Subject: [PATCH 134/430] Revert "Update supported WhatsApp Web version to v2.2322.15 (#2004)" (#2235) This reverts commit 7cf4532258c85ab4c13996efef7a9f6855b174a7. --- README.md | 2 +- tools/version-checker/.version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a7d39ce30a..adb1cfec916 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2322.15](https://img.shields.io/badge/WhatsApp_Web-2.2322.15-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2306.7](https://img.shields.io/badge/WhatsApp_Web-2.2306.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/tools/version-checker/.version b/tools/version-checker/.version index 1a9d27c59f2..e7197d623dd 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2322.15 \ No newline at end of file +2.2306.7 \ No newline at end of file From 1810852c0165ee05da5e400f1305626c3f1a9ebe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 02:33:06 -0400 Subject: [PATCH 135/430] Update supported WhatsApp Web version to v2.2322.15 (#2236) Co-authored-by: pedroslopez --- README.md | 2 +- src/util/Constants.js | 2 +- tools/version-checker/.version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index adb1cfec916..2a7d39ce30a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2306.7](https://img.shields.io/badge/WhatsApp_Web-2.2306.7-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) +[![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2322.15](https://img.shields.io/badge/WhatsApp_Web-2.2322.15-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4) # whatsapp-web.js A WhatsApp API client that connects through the WhatsApp Web browser app diff --git a/src/util/Constants.js b/src/util/Constants.js index 96de7130d3d..5a0efc7fc98 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -7,7 +7,7 @@ exports.DefaultOptions = { headless: true, defaultViewport: null }, - webVersion: '2.2306.7', + webVersion: '2.2322.15', webVersionCache: { type: 'local', }, diff --git a/tools/version-checker/.version b/tools/version-checker/.version index e7197d623dd..1a9d27c59f2 100644 --- a/tools/version-checker/.version +++ b/tools/version-checker/.version @@ -1 +1 @@ -2.2306.7 \ No newline at end of file +2.2322.15 \ No newline at end of file From 3dd4463478abb561efd83764abfbd88624dcf774 Mon Sep 17 00:00:00 2001 From: Humberto Zambrano Date: Mon, 29 May 2023 01:38:59 -0500 Subject: [PATCH 136/430] Fix caption in attached document sending messages (#2226) * Caption for attached document * Update Injected.js --------- Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com> Co-authored-by: Pedro S. Lopez --- src/util/Injected.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/Injected.js b/src/util/Injected.js index 76d134abe01..3f5aa96b5fe 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -119,7 +119,10 @@ exports.LoadUtils = () => { forceDocument: options.sendMediaAsDocument, forceGif: options.sendVideoAsGif }); - + + if (options.caption){ + attOptions.caption = options.caption; + } content = options.sendMediaAsSticker ? undefined : attOptions.preview; delete options.attachment; From 01d23e8dff7c5e8b9a1fe33aab88fe4ba1e3a536 Mon Sep 17 00:00:00 2001 From: Pedro S Lopez Date: Mon, 29 May 2023 02:46:45 -0400 Subject: [PATCH 137/430] chore: mark version v1.21.0 --- docs/Base.html | 6 +- docs/BaseAuthStrategy.html | 6 +- docs/BusinessContact.html | 6 +- docs/Buttons.html | 6 +- docs/Call.html | 6 +- docs/Chat.html | 6 +- docs/Client.html | 36 ++++- docs/Client.js.html | 39 ++++- docs/ClientInfo.html | 6 +- docs/Contact.html | 6 +- docs/GroupChat.html | 6 +- docs/GroupNotification.html | 6 +- docs/InterfaceController.html | 6 +- docs/Label.html | 6 +- docs/LegacySessionAuth.html | 6 +- docs/List.html | 6 +- docs/LocalAuth.html | 6 +- docs/LocalWebCache.html | 135 ++++++++++++++++++ docs/Location.html | 6 +- docs/Message.html | 6 +- docs/MessageMedia.html | 6 +- docs/NoAuth.html | 6 +- docs/Order.html | 6 +- docs/PrivateChat.html | 6 +- docs/PrivateContact.html | 6 +- docs/Product.html | 6 +- docs/Reaction.html | 6 +- docs/RemoteAuth.html | 6 +- docs/RemoteWebCache.html | 135 ++++++++++++++++++ docs/Util.html | 6 +- docs/WebCache.html | 65 +++++++++ docs/authStrategies_BaseAuthStrategy.js.html | 6 +- docs/authStrategies_LegacySessionAuth.js.html | 6 +- docs/authStrategies_LocalAuth.js.html | 6 +- docs/authStrategies_NoAuth.js.html | 6 +- docs/authStrategies_RemoteAuth.js.html | 6 +- docs/global.html | 6 +- docs/index.html | 91 +++++++++++- docs/scripts/jsdoc-toc.js | 2 +- docs/structures_Base.js.html | 6 +- docs/structures_BusinessContact.js.html | 6 +- docs/structures_Buttons.js.html | 6 +- docs/structures_Call.js.html | 6 +- docs/structures_Chat.js.html | 6 +- docs/structures_ClientInfo.js.html | 6 +- docs/structures_Contact.js.html | 6 +- docs/structures_GroupChat.js.html | 6 +- 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 | 6 +- docs/structures_MessageMedia.js.html | 6 +- docs/structures_Order.js.html | 6 +- docs/structures_Payment.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/util_Constants.js.html | 10 +- docs/util_InterfaceController.js.html | 6 +- docs/util_Util.js.html | 6 +- docs/webCache_LocalWebCache.js.html | 96 +++++++++++++ docs/webCache_RemoteWebCache.js.html | 93 ++++++++++++ docs/webCache_WebCache.js.html | 67 +++++++++ package.json | 2 +- 67 files changed, 919 insertions(+), 182 deletions(-) create mode 100644 docs/LocalWebCache.html create mode 100644 docs/RemoteWebCache.html create mode 100644 docs/WebCache.html create mode 100644 docs/webCache_LocalWebCache.js.html create mode 100644 docs/webCache_RemoteWebCache.js.html create mode 100644 docs/webCache_WebCache.js.html diff --git a/docs/Base.html b/docs/Base.html index c8c8fdbfc66..50d0054582b 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: Base + whatsapp-web.js 1.21.0 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index ad240e70780..f7e2e6b6010 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.21.0 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 9bb1f769896..c743d5374d2 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: BusinessContact + whatsapp-web.js 1.21.0 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index 646c69c48bd..71f3d22bbfd 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: Buttons + whatsapp-web.js 1.21.0 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index 9f6d2877c63..e93f9d216bb 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: Call + whatsapp-web.js 1.21.0 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@

reject<
diff --git a/docs/Chat.html b/docs/Chat.html index f8d8d21af1c..7fff01c1ae7 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: Chat + whatsapp-web.js 1.21.0 » Class: Chat @@ -15,7 +15,7 @@ @@ -505,7 +505,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index fcbbad8d301..7266ad5e0a4 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.20.0 » Class: Client + whatsapp-web.js 1.21.0 » Class: Client @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@