whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

Event after QR scanned

Open janke184 opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe.

It's not a problem, it's would be a really appreciate feature

Describe the solution you'd like.

After the QR code is scanned trigger an event named: "QR_SCANNED" (or something like that).

This event will be useful because sometimes take many seconds between the QR is scanned and ready state is triggered.

The event name could be "LOADING" and it could be triggered while Web WhatsApp organize your messages.

Describe an alternate solution.

No response

Additional context

No response

janke184 avatar Jul 12 '22 11:07 janke184

Hey, this feature is already being developed on a PR

Please check https://github.com/pedroslopez/whatsapp-web.js/pull/1563

jtouris avatar Jul 12 '22 15:07 jtouris

I have been able to do it with chalk and ora

` import ora from "ora"; import chalk from "chalk";

const withSession = () => { // Si existe el archivo de sesion const spinner = ora( Cargando ${chalk.yellow("Validando session con Whatsapp ... ")} ).start(); const type = "withSession";

client = new Client({ authStrategy: new LocalAuth(), restartOnAuthFail: true, puppeteer: { headless: true, args: ["--no-sandbox"], }, clientId: "client-one", });

client.on("ready", () => { spinner.stop(); console.log("Listo para escuchas mensajes"); console.log("Client is ready!"); console.log("Escribe: hola"); });

client.on("auth_failure", () => { spinner.stop(); console.log("Auth failure!", err); console.log( "** Error de autentificacion vuelve a generar el QRCODE (Borrar el archivo .wwebjs_auth) **" ); }); };`

DiegoAlonso27 avatar Jul 23 '22 21:07 DiegoAlonso27

You can use loading message

shirser121 avatar Aug 04 '23 14:08 shirser121