-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
146 lines (118 loc) · 5.71 KB
/
index.js
File metadata and controls
146 lines (118 loc) · 5.71 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
const clients = [];
const fs = require('node:fs');
const crypto = require('node:crypto');
const buyers = require('./src/Manager/buyers.json');
const { Selfbot } = require('./src/structures/Client');
const { loadCommands, loadEvents } = require('./src/structures/Handlers');
const { Client, GatewayIntentBits, Partials, ActivityType, DefaultWebSocketManagerOptions } = require('discord.js');
global.clients = {};
global.decrypt = text => decrypt(text, 'megalovania');
global.encrypt = text => encrypt(text, 'megalovania');
global.loadSelfbot = token => loadSelfbot(token);
global.loadEvents = (client, dir) => loadEvents(client, dir);
global.loadCommands = (client, dir) => loadCommands(client, dir);
const bot = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildModeration, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildWebhooks, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.GuildScheduledEvents, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent],
partials: [Partials.Channel, Partials.GuildMember, Partials.GuildScheduledEvent, Partials.Message, Partials.Reaction, Partials.ThreadMember, Partials.User],
restTimeOffset: 0,
failIfNotExists: false,
presence: {
activities: [{
name: `discord.gg/discord`,
type: ActivityType.Playing,
url: "https://www.twitch.tv/discord"
}],
status: "online",
},
allowedMentions: {
parse: ["roles", "users", "everyone"],
repliedUser: false
}
});
const { identifyProperties } = DefaultWebSocketManagerOptions;
Object.defineProperty(identifyProperties, 'browser', {
value: "Discord Android",
writable: true,
enumerable: true,
configurable: true
});
bot.codes = require('./codes.json');
bot.config = require('./config.json');
if (bot.config.manager && bot.config.manager.includes('.')) {
bot.config.manager = encrypt(bot.config.manager, 'megalovania');
fs.writeFileSync('./config.json', JSON.stringify(bot.config, null, 4))
}
bot.login(bot.config.manager.includes('.') ? bot.config.manager : decrypt(bot.config.manager, 'megalovania')).catch(() => false);
bot.decrypt = text => decrypt(text, 'megalovania');
bot.encrypt = text => encrypt(text, 'megalovania');
bot.load = token => loadSelfbot(token);
bot.ms = temps => {
const match = temps.match(/(\d+)([smhdwy])/);
if (!match) return null;
const value = parseInt(match[1]);
const unit = match[2];
switch (unit) {
case 's': return value * 1000;
case 'm': return value * 60 * 1000;
case 'h': return value * 60 * 60 * 1000;
case 'd': return value * 24 * 60 * 60 * 1000;
case 'w': return value * 7 * 24 * 60 * 60 * 1000;
case 'y': return value * 365 * 24 * 60 * 60 * 1000;
default: return null;
}
}
bot.save = () => fs.writeFileSync('./config.json', JSON.stringify(bot.config, null, 4));
bot.saveCode = () => fs.writeFileSync('./codes.json', JSON.stringify(bot.codes, null, 4));
loadEvents(bot, "./src/Manager/events");
loadCommands(bot, "./src/Manager/commands");
for (const token of bot.config.tokens.values()) {
let newToken = token;
if (!token.includes('.')) newToken = decrypt(token, 'megalovania');
const userId = Buffer.from(newToken.split('.')[0], 'base64').toString();
if (!buyers[userId]) {
buyers[userId] = { expiration: Date.now() + 1000 * 60 * 60 * 24 * 30, enable: true };
fs.writeFileSync('./src/Manager/buyers.json', JSON.stringify(buyers, null, 4));
}
if (buyers[userId].expiration <= Date.now() || !buyers[userId].enable) continue;
loadSelfbot(newToken);
};
function loadSelfbot(token) {
if (bot.config.tokens.includes(token)) {
bot.config.tokens = bot.config.tokens.filter(t => t !== t);
fs.writeFileSync('./config.json', JSON.stringify(bot.config, null, 4));
}
const userId = Buffer.from(token.split('.')[0], 'base64').toString();
if (clients[userId]) return;
if (!buyers[userId]) {
buyers[userId] = { expiration: Date.now() + 1000 * 60 * 60 * 24 * 30, enable: true };
fs.writeFileSync('./src/Manager/buyers.json', JSON.stringify(buyers, null, 4));
}
const client = new Selfbot({ token });
client.connect();
loadCommands(client, "./src/Selfbot/commands");
loadEvents(client, "./src/Selfbot/events");
}
function decrypt(encryptedData, password) {
const key = crypto.pbkdf2Sync(password, 'selUnique', 100000, 32, 'sha256');
const iv = crypto.pbkdf2Sync(password, 'selUnique', 100000, 16, 'sha256');
const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv)
let decrypted = decipher.update(encryptedData, 'hex', 'utf8');
decrypted += decipher.final('utf8');
return decrypted;
}
function encrypt(text, password) {
const key = crypto.pbkdf2Sync(password, 'selUnique', 100000, 32, 'sha256');
const iv = crypto.pbkdf2Sync(password, 'selUnique', 100000, 16, 'sha256');
const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
let encrypted = cipher.update(text, 'utf8', 'hex');
encrypted += cipher.final('hex');
return encrypted;
}
async function errorHandler(error) {
const errors = [0, 400, 10062, 10008, 50035, 40032, 50013]
if (errors.includes(error.code)) return;
//console.log(colors.cristal(`[ERROR] ${error}`));
console.log(error)
};
process.on("unhandledRejection", errorHandler);
process.on("uncaughtException", errorHandler);