-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcheckVanity.js
33 lines (31 loc) · 1.4 KB
/
checkVanity.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
const delay = ms => new Promise(res => setTimeout(res, ms));
const axios = require('axios')
const chalk = require('chalk');
const config = require('./config.json')
const httpsProxyAgent = require('https-proxy-agent');
const workerData = require('worker_threads');
const fs = require('fs');
(async function () {
try {
let finalProxies = workerData.workerData.finalProxies
let vanitys = workerData.workerData.vanitys
for(let i = 0; i < vanitys.length; i++) {
let proxy = finalProxies[Math.floor(Math.random() * finalProxies.length)];
let vanity = vanitys[i]
await delay(config.vanityCheckDelay)
const agent = new httpsProxyAgent(`http://${proxy.split(':')[0]}:${parseInt(proxy.split(':')[1])}`);
await axios.get(`http://discord.com/api/v9/invites/${vanity}`, {
httpsAgent: agent,
timeout: config.finalTimeoutAxios,
}).then(res => {
fs.appendFile('taken.txt', vanity + '\n', (err) => { if (err) throw err; })
console.log(chalk.red.bold(`${vanity}`))
}).catch(err => {
fs.appendFile('available.txt', vanity + '\n', (err) => { if (err) throw err; })
console.log(chalk.green.bold(`${vanity}`))
})
}
} catch (error) {
console.log(error)
}
})()