This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
54 lines (50 loc) · 1.4 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const DiscoveryQueue = require('./lib/CDiscoveryQueue');
const Steam = require('./lib/steam');
const master = require('./cfg.json').admin
const bots = require('./cfg.json').profiles;
bots.forEach(obj => {
let steam = new Steam(obj.username, obj.password, obj.secrets.shared, obj.secrets.identity, master), discovery;
steam.on('ready', (u, sessionID, cookies) => {
if(u === obj.username){
discovery = new DiscoveryQueue(sessionID, cookies);
farm();
}
});
function farm(){
let c = !1;
discovery.checkCardsLeft()
.then(moar => {
if(moar){
discovery.generateNewQueue()
.then((apps) => {
log(`Going through ${apps.length} apps...`);
return discovery.queue(apps);
})
.then(() => {
log('Done with apps, checking for more...');
// Set a small break, so that FBI doesn't show up.
c = !0;
return setTimeout(farm, 5e3);
})
.catch(e => {
if(!c)
log(e);
});
} else {
log('No cards left.');
log('Sending trade-offer...');
c = !0;
steam.withdraw();
}
})
.catch(e => {
if(!c)
log(`Failed to check if there are any cards left. ${e}`);
});
// Call the farm function again an hour later.
return setTimeout(farm, 36e5);
}
function log(txt){
console.log(`[${obj.username}] - ${txt}`);
}
});