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.91k stars 1.11k forks source link

Error after authentication #13

Closed felipedks closed 4 years ago

felipedks commented 4 years ago

Im start the node.js and type the code

const venom = require('venom-bot');

venom.create().then((client) => start(client));

function start(client) {
  client.onMessage((message) => {
    if (message.body === 'Hi') {
      client.sendText(message.from, 'Welcome Venom 🕷');
    }
  });
}

After this, the script run, and show me the QR code. I scan, get sucess message, and error in next.

See:

√ Checking for updates
√ ���Compilation Mutation���
√ Starting With Success!

(node:20168) UnhandledPromiseRejectionWarning: ReferenceError: start is not defined
    at repl:1:33
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:20168) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:20168) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
orkestral commented 4 years ago
 async function start(client){
client.onMessage((message) => {
    if (message.body === 'Hi') {
      await client.sendText(message.from, 'Welcome Venom 🕷');
    }
  });
}

use the async and wait

felipedks commented 4 years ago

The error continues. If possible i installed wrong? I need change the name in json file to "name": "venombot", without the - Because before i get error "npm ERR! Refusing to install package with name"

I try here with many options, and every ways i go to this same error i talk about before ;/

orkestral commented 4 years ago

npm install venom-bot is correct

felipedks commented 4 years ago

I try this: https://github.com/pedroslopez/whatsapp-web.js And works here.

But vennon not working. I get the same error every time. You have another solution? Because i'm develloping a project based on sulla, and i think venom is the best way to use without sulla.


Você é BR? To digitando em inglês atoa? rs

orkestral commented 4 years ago

sim, atualize para a versão 1.0.2 e veja se funciona

felipedks commented 4 years ago

Executei ele e apareceu a mensagem sobre a atualização para versão 1.0.3 Então executei o código npm update @s2click/venom Mas ele continuou exibindo a mensagem de que preciso atualizar, então não sei se atualizou. Por garantia, tentei reinstalar ele, atualizar, etc. Mas em todos os casos, continuou aparecendo a mensagem abaixo

┌────────────────────────────────────────────────────┐ │ │ │ There is a new version of Venom 1.0.0 ➜ 1.0.3 │ │ Update your package by running: │ │ │ │ > npm update @s2click/venom │ │ │ └────────────────────────────────────────────────────┘ For more info visit: https://github.com/s2click/venom/blob/master/UPDATES.md

Tentei aceesar esse link também e deu como invalido.

Tentei executar o codigo com e sem o async, e não foi também.


Criei uma instancia no visual studio code, institulei de xx.js e coloquei o codigo do venom dentro. Ele funcionou. Estranho. Direto pelo node não vai, mas pelo VC foi.

orkestral commented 4 years ago

e que estava errado arrumamos o comando e npm i venom-bot