whatsapp-web.js
whatsapp-web.js copied to clipboard
Event after QR scanned
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
Hey, this feature is already being developed on a PR
Please check https://github.com/pedroslopez/whatsapp-web.js/pull/1563
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) **" ); }); };`
You can use loading message