open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.14k stars 600 forks source link

onMessage not working ? [ onAnyMessage working ] #742

Closed jesusvalverde closed 4 years ago

jesusvalverde commented 4 years ago

Describe the bug onMessage seem not to work on recived a text, but onAnyMessage works.

Steps to Reproduce node test.ts My test file...over a clean an controled whtasapp.

create() code const wa = require('@open-wa/wa-automate'); wa.create('test',{ disableSpins: true, }).then(client => start(client)); async function start(client) { console.log("1 de 4 - Enviando texto " + await client.sendText('506xxxxxx0@c.us', 'Hello la prueba llega'));

client.onAck(message => { console.log(' --> Check de '+message.id+" status "+ message.ack); });

client.onAnyMessage(message=>{ console.log("Any "+message.body); })

client.onMessage(message=>{ console.log("Single "+message.body); }) }

Expected behavior a list of incoming text on onMessage

DEBUG INFO WA_VERSION │ '2.2033.7' │ │ PAGE_UA │ 'WhatsApp/2.2029.4 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36' │ │ WA_AUTOMATE_VERSION │ '2.0.2' │ │ BROWSER_VERSION │ 'HeadlessChrome/83.0.4103.0'

[Should be a line -- 'Single test ']

Screenshots If applicable, add screenshots to help explain your problem. Use headless: false to get screenshots

Host (please complete the following information):

Additional context Add any other context about the problem here.

smashah commented 4 years ago

@jesusvalverde can you add the rest of the logs please. onMessage has been redesigned and now memory efficient. The code for onMessage is injected as a patch so as long as the patches are installed it should work.

jesusvalverde commented 4 years ago

npm available! 6.14.7 → 6.14.8 ..once upgraded all worked....

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ ┃ @open-wa/wa-automate ┃ ┃ 💬 🤖 The most reliable NodeJS whatsapp library for chatbots with advanced features. ┃ ┃ Version: 2.0.2 ┃ ┃ Check out the latest changes: https://github.com/open-wa/wa-automate-nodejs#latest-changes ┃ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Thanks for you quick response !!