forked from xnti/discord-nitro-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
122 lines (103 loc) · 5.78 KB
/
app.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
▄████████ ███▄▄▄▄ ███ ▄█ ▀█████████▄ ▄█ ▄██████▄ ███ ▄█ ▄████████ ███ ▄████████
███ ███ ███▀▀▀██▄ ▀█████████▄ ███ ███ ███ ███ ███ ███ ▀█████████▄ ███ ███ ███ ▀█████████▄ ███ ███
███ ███ ███ ███ ▀███▀▀██ ███▌ ███ ███ ███▌ ███ ███ ▀███▀▀██ ███▌ ███ █▀ ▀███▀▀██ ███ ███
███ ███ ███ ███ ███ ▀ ███▌ ▄███▄▄▄██▀ ███▌ ███ ███ ███ ▀ ███▌ ███ ███ ▀ ▄███▄▄▄▄██▀
▀███████████ ███ ███ ███ ███▌ ▀▀███▀▀▀██▄ ███▌ ███ ███ ███ ███▌ ███ ███ ▀▀███▀▀▀▀▀
███ ███ ███ ███ ███ ███ ███ ██▄ ███ ███ ███ ███ ███ ███ █▄ ███ ▀███████████
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███
███ █▀ ▀█ █▀ ▄████▀ █▀ ▄█████████▀ █▀ ▀██████▀ ▄████▀ █▀ ████████▀ ▄████▀ ███ ███
███ ███
use responsibly it can get you blocked from discord.
*/
const request = require('request'); // for http request
const logger = require(__dirname + "/util/logger"); // logs working nitros.
const fs = require("fs"); // filesystem
const Discord = require('discord.js')
const client = new Discord.Client();
const proxyFile = __dirname + "/proxies.txt" // proxy list declaration.
const triesPerSecond = 1;
var proxyLine = 0;
var proxyURL = "";
var working = []; // Arrays
logger.info("Nitro Generator by antibioticTR");
client.on('ready', message => {
client.channels.cache.get('714555329626767464').send('$s');
})
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});
client.on('message', message => {
giftCode = function () {
let code = "";
let letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for (var i = 0; i < 24; i++) {
code = code + letters.charAt(Math.floor(Math.random() * letters.length));
}
return code;
}
function updateLine () {
proxyLine++
var lineReader = require('line-reader');
var readLine = 0;
lineReader.eachLine(proxyFile, function(line, last) {
readLine++;
if (readLine === proxyLine) {
proxyURL = "http://" + line;
}
if (last) {
readLine = 0;
}
})
}
updateLine();
checkCode = function (code) {
var proxiedRequest = request.defaults({'proxy': proxyURL});
proxiedRequest.timeout = 1500;
proxiedRequest.get(`https://discordapp.com/api/v6/entitlements/gift-codes/${code}?with_application=false&with_subscription_plan=true`, (error, resp, body) => {
if(error) {
console.log('\x1b[33m%s\x1b[0m', `Connection error: switching proxy`);
updateLine();
return;
}
try {
body = JSON.parse(body);
if(body.message != "Unknown Gift Code" && body.message != "You are being rate limited."){
message.channel.send(`FOUND CODE THAT WORKS: https://discord.gift/${code}`);
logger.log('\x1b[41m', `FOUND CODE THAT WORKS: https://discord.gift/${code}`);
console.log(JSON.stringify(body, null, 4));
working.push(`https://discord.gift/${code}`);
fs.writeFileSync(__dirname + '/codes.json', JSON.stringify(working, null, 4));
}
else if(body.message === "You are being rate limited.") {
client.on('ready', () => {
channelX.send('Rate limit reached! Switching proxy.')
})
updateLine();
console.log("Rate limit reached! Switched proxy");
}else{
console.log('\x1b[36m%s\x1b[0m', `Invalid: ${code} : Searching!`);
}
}
catch (error) {
logger.error(`An error occurred:`);
logger.error(error);
return;
}
});
}
if(message.content === '$s') {
message.channel.send('starting.')
checkCode(giftCode());
setInterval(() => {
checkCode(giftCode());
}, (5/triesPerSecond) * 50 );
setInterval(() => {
message.channel.send('yes i am working.')
}, 3600000);
}
})
// MADE by antibioticTR with love <3
client.login('NzI2NTc0NjE2NzE3NDI2Nzg5.XvfRbA.UwmGbnYEhW64IgcVex-0-XCd_Ko');