Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onAnyMessage and is not working #2784

Open
PolonioDev opened this issue Jul 17, 2024 · 0 comments
Open

onAnyMessage and is not working #2784

PolonioDev opened this issue Jul 17, 2024 · 0 comments
Labels
bug Something isn't working needs triage Needs avaliation

Comments

@PolonioDev
Copy link

Description

I see that onAnyMessage exists in the documentation examples but it doesn't work at the moment.
even if I use the same example in the documentation changing only "onMessage" to "onAnyMessage"...
I'm trying to catch all my messages, but I'm running into this problem.
I'm also not entirely sure if Venom is picking up on the replied messages.

The official documentation page probably explains how I can capture my own messages, but where is it?
Is there anything I can contribute to solve this? I just found out about this project and I really like it.

Environment

  • Venom version(s): 5.1.0
  • OS: Windows 10
  • Node version: Node v20.3.1

Code to Reproduce

// Supports ES6
// import { create, Whatsapp } from 'venom-bot';
const venom = require('venom-bot');

venom
  .create({
    session: 'session-name' //name of session
  })
  .then((client) => start(client))
  .catch((erro) => {
    console.log(erro);
  });

function start(client) {
  client.onAnyMessage((message) => {
    if (message.body === 'Hi' && message.isGroupMsg === false) {
      client
        .sendText(message.from, 'Welcome Venom 🕷')
        .then((result) => {
          console.log('Result: ', result); //return object success
        })
        .catch((erro) => {
          console.error('Error when sending: ', erro); //return object error
        });
    }
  });
}

Additional context

While browsing the repository, I noticed a document that should possibly include logic to capture any messages, but it is empty.
I haven't done enough research to confirm this, but I think this document should include the code that runs in the browser and transmits the captured messages to Venom.
The path of the document in question is the following:
src/lib/wapi/listeners/add-all-new-messages.js

@PolonioDev PolonioDev added bug Something isn't working needs triage Needs avaliation labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Needs avaliation
Projects
None yet
Development

No branches or pull requests

1 participant