Get and send messages

This commit is contained in:
Pedro Lopez
2019-02-17 04:18:16 -04:00
parent bcbd16f196
commit c166e24ea5
6 changed files with 100 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
const { Client } = require('./src')
const client = new Client();
const client = new Client({puppeteer: {headless: false}});
client.initialize();
@@ -14,6 +14,13 @@ client.on('authenticated', () => {
client.on('ready', () => {
console.log('READY');
client.destroy();
});
client.on('message', (msg) => {
console.log('MESSAGE RECEIVED', msg);
if (!msg.id.fromMe && msg.body == 'ping') {
client.sendMessage(msg.from, 'pong');
}
})