Get and send messages
This commit is contained in:
parent
bcbd16f196
commit
c166e24ea5
6 changed files with 100 additions and 3 deletions
11
example.js
11
example.js
|
|
@ -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');
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue