We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
`const hydraBot = require('hydra-bot'); const mime = require('mime-types'); const fs = require('fs');
(async () => {
let client; // start bot service const ev = await hydraBot.initServer({ puppeteerOptions: { headless: process.platform === 'linux' ? true : false , executablePath: process.platform === 'linux' ? "/usr/bin/google-chrome" : "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", args: ['--no-sandbox'], // Additional arguments to pass to the browser instance. adding any parameter you will replace the default args of the project } }); // return to current whatsapp interface ev.on('interfaceChange', (change) => { console.log("interfaceChange: ", change); }); // return qrcode parameters ev.on('qrcode', (qrcode) => { console.log('qrcode: ', qrcode); }); // return connection information ev.on('connection', async (conn) => { // browser information! if (conn.statusFind === 'browser') { console.log('info Browser: ', conn.text); } // Was connected to whatsapp chat if (conn.connect) { client = conn.client; // send a text message await client.sendMessage({ to: "0000000000@c.us", // you can pass the contact number or group number body: "hi i'm hydra bot", // message text options: { type: 'text', // shipping type } }).then((result) => { console.log(result); // message result }).catch((error) => { console.log(error); // message error }); } }); // return receive new messages ev.on('newMessage', async (newMsg) => { // when is received if (!newMsg.result.isSentByMe) { // message received! console.log('NewMessageReceived: ', newMsg.result); // dowload files if (newMsg.result.isMedia === true || newMsg.result.isMMS === true) { const buffer = await client.decryptFile(newMsg.result); // At this point you can do whatever you want with the buffer // Most likely you want to write it into a file const fileName = `some-file-name.${mime.extension(newMsg.result.mimetype)}`; fs.writeFile(fileName, buffer, (err) => { console.log(err); }); } } // when is it sent if (!!newMsg.result.isSentByMe) { // Message sent console.log('NewMessageSent: ', newMsg.result); } }); // returns the status of each message ev.on('newOnAck', async (event) => { console.log('id Message: ', event.id._serialized); // message id console.log('Status Message: ', event.ack); // -7 = MD_DOWNGRADE, -6 = INACTIVE, -5 = CONTENT_UNUPLOADABLE, -4 = CONTENT_TOO_BIG, -3 = CONTENT_GONE, -2 = EXPIRED, -1 = FAILED, 0 = CLOCK, 1 = SENT, 2 = RECEIVED, 3 = READ, 4 = PLAYED console.log('From Message: ', event.from); // from message console.log('To Message: ', event.to); // to message });
})();`
The text was updated successfully, but these errors were encountered:
Steps to repreduce:
When i removed the generated folder "token", then i saw the qr code again.
but the problem repeat himself when restart the browser.
Sorry, something went wrong.
any update?
It also important to mention that this bug repreduce when session is exists
fix: whatsapp startup error
1ea876c
No branches or pull requests
`const hydraBot = require('hydra-bot');
const mime = require('mime-types');
const fs = require('fs');
(async () => {
})();`
The text was updated successfully, but these errors were encountered: