-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemp.js
27 lines (20 loc) · 887 Bytes
/
temp.js
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
const qrcode = require('qrcode-terminal');
const { Client, MessageMedia } = require('whatsapp-web.js');
const client = new Client();
client.on('qr', qr => {
qrcode.generate(qr, { small: true });
});
client.on('ready', () => {
console.log('Client is ready!');
client.sendMessage("[email protected]", "Hello world from bot");
client.sendMessage("[email protected]", "Hello world from bot");
client.sendMessage("[email protected]", MessageMedia.fromFilePath("C:\\Users\\patel\\Downloads\\bot.jpg"), { caption: "Image from bot" });
client.sendMessage("[email protected]", MessageMedia.fromFilePath("C:\\Users\\patel\\Downloads\\bot.jpg"), { caption: "Image from bot" });
});
client.on('message', message => {
if (message.body === '!ping') {
console.log(message.from);
client.sendMessage(message.from, 'pong');
}
});
client.initialize();