forked from BeepIsla/csgo-commend-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparseAccountList.js
54 lines (46 loc) · 1.29 KB
/
parseAccountList.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 AppendToFile = true; // Set this to "false" if you want to fully override the account list in accounts.json instead of appending to it
// Actual stuff
const fs = require("fs");
var accounts =
AppendToFile === true ? JSON.parse(fs.readFileSync("./accounts.json")) : [];
fs.readFile("./input.txt", (err, data) => {
if (err) {
throw err;
}
data = data.toString();
data.split("\n").forEach(a => {
accpw = [];
accpw.push(a.trim().slice(0, a.indexOf(":")));
accpw.push(a.trim().slice(a.indexOf(":") + 1));
//Check if account is already present in our list
var repeated = 0;
for (var i = 0; i < accounts.length; i++) {
if (accounts[i]["username"] === accpw[0]) {
repeated = 1;
break;
}
}
console.log(accpw[0]);
if (!repeated) {
accounts.push({
username: accpw[0],
password: accpw[1],
sharedSecret: "",
operational: true,
lastCommend: -1,
lastReport: -1,
lastServerReport: -1,
requiresSteamGuard: false,
commended: []
});
} else {
console.log("Account already present : " + accpw[0]);
}
});
fs.writeFile("./accounts.json", JSON.stringify(accounts, null, 4), err => {
if (err) {
throw err;
}
console.log("Done");
});
});