-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
40 lines (35 loc) · 810 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
37
38
39
40
const SteamUser = require('./user.js');
(async () => {
try {
const User = require('./config.json');
for (let i of User) {
await getClient(i);
await sleep(10); // sleep prevent steam temporary ban connection
}
}
catch (err) {
if (err.message.search('Cannot find module') != -1) {
console.log('No config file, using standard input');
new SteamUser();
}
else {
console.error(err.message);
}
}
})();
function getClient(data) {
return new Promise(resolve => {
const user = new SteamUser(data);
const timer = setInterval(() => {
if (user.end) {
clearInterval(timer);
resolve();
}
}, 250);
});
}
function sleep(second) {
return new Promise(resolve => {
setTimeout(resolve, second * 1000);
});
}