-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
36 lines (30 loc) · 1023 Bytes
/
index.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
28
29
30
31
32
33
34
35
36
const { Client, MessageMedia } = require('whatsapp-web.js');
const qrcode = require('qrcode-terminal');
const client = new Client();
const phoneNumbers = [
"[email protected]", // Internacional format, and add "@c.us" after the number
]
// Get numbers
async function sendPeople(){
for (var x = 0; x < phoneNumbers.length; x++){
await sendToChat(phoneNumbers[x]);
}
}
// Senad all mesagges for one number
async function sendToChat(chatID){
let lastNum = 20;
var sound = MessageMedia.fromFilePath("./sources/sound.mp3");
await client.sendMessage(chatID, `*== Transformaciones de Goku del 1 al ${lastNum} ==*`);
await client.sendMessage(chatID, sound);
for (var x = 1; x <= lastNum; x++){
let media = MessageMedia.fromFilePath(`./sources/images/ssj${x}.jpg`)
await client.sendMessage(chatID, media, { caption: `SSJ ${x}` })
}
}
// Login QR
client.on('qr', qr => {
qrcode.generate(qr, {small: true});
});
client.on('ready', () => sendPeople());
client.initialize();