venom icon indicating copy to clipboard operation
venom copied to clipboard

Venom Connected, but not receiving messages

Open matheusbsant opened this issue 9 months ago • 6 comments

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)
})

}`

matheusbsant avatar May 03 '24 13:05 matheusbsant

Have you tried onAnyMessage() ?

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

ghayman avatar May 03 '24 20:05 ghayman

i've the same problem

Node: 18 Venom: 5.1.0

wapi

argordmel avatar May 04 '24 13:05 argordmel

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.

matheusbsant avatar May 06 '24 12:05 matheusbsant

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" ...

ghayman avatar May 06 '24 17:05 ghayman

same here

carnei-ro avatar May 17 '24 19:05 carnei-ro

@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);
    });

carnei-ro avatar May 20 '24 13:05 carnei-ro