-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (34 loc) · 963 Bytes
/
Copy pathindex.js
File metadata and controls
41 lines (34 loc) · 963 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
34
35
36
37
38
39
40
41
const wbm = require('wbm');
const config = require('./config')
const fs = require('fs')
let startTime, endTime
const getContact = (path) => {
const contact = fs.readFileSync(path, {encoding: 'utf-8'})
return contact;
}
const getContent = (path) => {
const content = fs.readFileSync(path, {encoding: 'utf-8'})
return content;
}
function starttimer() {
startTime = new Date();
}
function endtimer() {
endTime = new Date();
var timeDiff = endTime - startTime; //in ms
// strip the ms
timeDiff /= 1000;
// get seconds
var seconds = Math.round(timeDiff);
console.log("Time Elapsed: " + seconds + " seconds");
}
starttimer()
wbm.start().then(async () => {
let contactlist = getContact(config.contact)
const phones = contactlist.split(/\r?\n/)
const precontent = getContent(config.content)
const message = (precontent)
await wbm.send(phones, message);
await wbm.end();
endtimer()
}).catch(err => console.log(err));