最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Whatsapp-web js doesn't fire ready event - Stack Overflow

programmeradmin0浏览0评论

Whatsapp-web js doesn’t fire ready event and other only fire Qr event. I alos scan and authenticate the whatsapp correctly. but not working ready event.

const { Client } = require('whatsapp-web.js');
var qrcode = require('qrcode-terminal');
const client = new Client();

client.on('qr', (qr) => {
qrcode.generate(qr, { small: true });
console.log('QR RECEIVED');
});

client.on('ready', () => {
console.log('Client is ready!');
});

client.initialize();

Whatsapp-web js doesn’t fire ready event and other only fire Qr event. I alos scan and authenticate the whatsapp correctly. but not working ready event.

const { Client } = require('whatsapp-web.js');
var qrcode = require('qrcode-terminal');
const client = new Client();

client.on('qr', (qr) => {
qrcode.generate(qr, { small: true });
console.log('QR RECEIVED');
});

client.on('ready', () => {
console.log('Client is ready!');
});

client.initialize();
Share Improve this question asked Aug 25, 2023 at 3:23 Tharuka DananjayaTharuka Dananjaya 4961 gold badge5 silver badges15 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 13

This was fixed my issue

npm r whatsapp-web.js

set this version in package.json "whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7"

npm install

I found in the official github the fix the issue, the solution is here: in summary you need to modify the file client.js in the node_modules/whatsapp-web.js/src/client.js

change the line 175 replace this:

 const INTRO_IMG_SELECTOR = 'div[role=\'textbox\']'; //'[data-icon=\'chat\']';

https://github.com/pedroslopez/whatsapp-web.js/issues/2473

发布评论

评论列表(0)

  1. 暂无评论