-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathindex.js
60 lines (48 loc) · 1.57 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
55
56
57
58
59
60
require('colors');
const inquirer = require('inquirer');
const Bot = require('./src/Bot');
const Config = require('./src/Config');
const {
fetchProxies,
readLines,
selectProxySource,
} = require('./src/ProxyManager');
const { delay, displayHeader } = require('./src/utils');
async function main() {
displayHeader();
console.log(`Please wait...\n`.yellow);
await delay(1000);
const config = new Config();
const bot = new Bot(config);
const proxySource = await selectProxySource(inquirer);
let proxies = [];
if (proxySource.type === 'file') {
proxies = await readLines(proxySource.source);
} else if (proxySource.type === 'url') {
proxies = await fetchProxies(proxySource.source);
} else if (proxySource.type === 'none') {
console.log('No proxy selected. Connecting directly.'.cyan);
}
if (proxySource.type !== 'none' && proxies.length === 0) {
console.error('No proxies found. Exiting...'.red);
return;
}
console.log(
proxySource.type !== 'none'
? `Loaded ${proxies.length} proxies`.green
: 'Direct connection mode enabled.'.green
);
const userIDs = await readLines('uid.txt');
if (userIDs.length === 0) {
console.error('No user IDs found in uid.txt. Exiting...'.red);
return;
}
console.log(`Loaded ${userIDs.length} user IDs\n`.green);
const connectionPromises = userIDs.flatMap((userID) =>
proxySource.type !== 'none'
? proxies.map((proxy) => bot.connectToProxy(proxy, userID))
: [bot.connectDirectly(userID)]
);
await Promise.all(connectionPromises);
}
main().catch(console.error);