-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (29 loc) · 695 Bytes
/
Copy pathindex.js
File metadata and controls
33 lines (29 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Bree = require('bree');
const { Client, LocalAuth } = require('whatsapp-web.js');
const { resolve } = require('node:path');
const qrcode = require('qrcode-terminal');
const client = new Client({
authStrategy: new LocalAuth(),
puppeteer: {
headless: true
}
});
const bree = new Bree({
logger: false,
jobs: [
{
name: 'main',
path: resolve('./jobs/main.js'),
interval: 'every 5 seconds'
}
]
});
client.on('qr', (qr) => {
qrcode.generate(qr, { small: true });
console.log(`Please scan the above QR code to log into whatsapp`);
});
client.on('ready', () => {
console.log('Whatsapp Client logged in');
require('./jobs/index')(bree, client);
});
client.initialize();