orkestral / venom

Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
https://orkestral.io
Apache License 2.0
5.88k stars 1.1k forks source link

Venom Connected, but not receiving messages #2733

Open matheusbsant opened 2 months ago

matheusbsant commented 2 months ago

I'm having a problem where I can connect to Venom. But when it's time to read the messages it doesn't do it, anyone with the same problem? Would someone have any idea how to solve it?

Version: 5.1.0

Even with this basic code, it does not recognize messages:

`import { Message, Whatsapp, create } from "venom-bot"

create({ session: "venom-bot", disableWelcome: true, }) .then(async (client: Whatsapp) => await start(client)) .catch((err) => { console.log(err) })

async function start(client: Whatsapp) { client.onMessage(async (message: Message) => { if (!message.body || message.isGroupMsg) return

    const response = `Hello!`

    await client.sendText(message.from, response)
})

}`

ghayman commented 2 months ago

Have you tried onAnyMessage() ?

Are you sure your if clause is matching? (sorry, have to ask)

argordmel commented 2 months ago

i've the same problem

Node: 18 Venom: 5.1.0

wapi

matheusbsant commented 2 months ago

Are you sure your if clause is matching? (sorry, have to ask)

Even with onAnyMessage, it connects but does not recognize the message. Yes, with the "if" everything is fine.

ghayman commented 2 months ago

There have been a number of updates committed to the repo that have not been officially released yet.

You could try installing directly from the repo ... "venom-bot: "github:orkestral/venoml#master" ...

carnei-ro commented 1 month ago

same here

carnei-ro commented 1 month ago

@matheusbsant, maybe it is just on my machine, but it has been working since I added this line:

  venom
    .create({
      session: 'carneiro-wpp-bot1',
+     defaultOptions: { ...defaultOptions },
    })
    .then((client) => start(client))
    .catch((erro) => {
      console.log(erro);
    });