Closed ZerXus closed 1 year ago
Thank you for joining our community, happy. We are currently fixing this bug, our new version will be released soon.
Working with Love!
you must use the onAnyMessage is working normally! If it takes too long, it may be that you are running on a machine that is already using all the resources!
client.onAnyMessage((msg) => {
console.log('Msg: ', msg);
});
Its dont working on my wa
put your code here for us to see?
import { create, Whatsapp as WhatsappVenom } from 'venom-bot'; import fs from "fs";
import paths from "../utilities/paths.js"; import Database from "../database/database.js"; import whatsappMessage from "../whatsappMessage/whatsappMessage.js";
export default class Whatsapp { constructor(manager) { this.manager = manager; this.options = { session: this.manager, headless: false, // mkdirFolderToken: './data', disableWelcome: true, updatesLog: false, devtools: false, // Open devtools by default debug: false, // Opens a debug session, }; this.db = Database; }
startClient() {
create(this.options)
.then(client => {
this.tryCatchSIGINT(client, () => this.onMessageEvent(client));
})
.catch(error => {
if (!error) return;
console.log(error);
});
}
tryCatchSIGINT(client, callback) {
process.on('SIGINT', () => {
console.log("Stopping WA-Bot");
client.close();
});
try {
this.client = client;
callback();
} catch (error) {
console.log(error);
this.client.close();
}
}
onMessageEvent() {
this.client.onAnyMessage(incomingMessage => {
console.log(incomingMessage);
// if (incomingMessage.chatId === 'status@broadcast') return;
//
// new whatsappMessage(incomingMessage, { client: this.client, manager: this.manager }).parse()
// .then(message => {
// this.db.storeMessage(message);
// });
})
// this.client.onMessageEvent(msg => console.log(msg));
}
}
try to run like this!
import { create } from 'venom-bot';
(async () => { create({ session: 'session-name', //name of session headless: false }) .then((client) => start(client)) .catch((erro) => { console.log(erro); });
function start(client) { client.onAnyMessage((msg) => { console.log('Msg: ', msg); }); }
})();
solved?
Haven't checked yet, I'll answer when I check
пт, 5 мая 2023 г., 19:35 Jónalan de Lima @.***>:
solved?
— Reply to this email directly, view it on GitHub https://github.com/orkestral/venom/issues/2256#issuecomment-1536357040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7PMFQFDZKXBYQISR6VA3TXEUF45ANCNFSM6AAAAAAXURL2A4 . You are receiving this because you authored the thread.Message ID: @.***>
Hello! This one dont work too
and sessions dont save, i cant ctrl+c and then re-login again without qr-code
solved?
Cant find any listener that work well to recieve incoming and outcoming messages