-
Notifications
You must be signed in to change notification settings - Fork 29
/
raid.js
265 lines (232 loc) · 10.8 KB
/
raid.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
console.log("\nLoading...")
console.log("If This Take Too long make sure u have add right token!")
const fs = require('fs')
const yaml = require("js-yaml");
const { mainprefix , token } = yaml.load(fs.readFileSync("./config.yml"));
const Discord = require('discord.js')
const client = new Discord.Client();
const db = require('quick.db')
const { join } = require('path');
const { readdirSync } = require('fs');
client.commands= new Discord.Collection();
client.login(token)
client.on('ready', () => {
client.user.setActivity('Anit Nuke System', { type: 'PLAYING' });
console.clear();
console.log('\n\x1b[32m%s\x1b[0m', ` $[INFO]: Logged on ${client.user.tag}`);
console.log('\x1b[32m%s\x1b[0m', ` $[INFO]: PREFIX ${mainprefix}`);
console.log('\x1b[32m%s\x1b[0m', ` $[EXTRA]: Discord ANIT-RAID`);
console.log('\x1b[31m%s\x1b[0m', ` $[CREDITS]: Made By DarkBoy/Offender`);
console.log('\x1b[31m%s\x1b[0m', ` $[SUPPORT]: Dark Codes: https://discord.gg/vcTwsbREQB `);
});
const commandFiles = readdirSync(join(__dirname, "commands")).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(join(__dirname, "commands", `${file}`));
client.commands.set(command.name , command);
}
client.on("message", async message => {
let prefix = await db.get(`prefix_${message.guild.id}`);
if(prefix === null) prefix = mainprefix;
if(message.author.bot) return;
if(message.channel.type === 'dm') return;
if(message.content.startsWith(prefix)) {
let premiumcheck = db.get(`blacklisted`)
if(premiumcheck && premiumcheck.find(find => find.kid == message.author.id)) return message.channel.send(`you cant use the bot your blacklisted!!`);
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if(!client.commands.has(command)) return;
try {
client.commands.get(command).run(client, message, args);
} catch (error){
console.error(error);
}
}
})
client.on("roleCreate", async role => {
const user = await role.guild.fetchAuditLogs({
type: 'ROLE_CREATE'
}).then(audit => audit.entries.first())
const entry = user.executor
let trustedusers = db.get(`trustedusers_${role.guild.id}`)
if(trustedusers && trustedusers.find(find => find.user == entry.id)) {
return console.log('Its Trusted User');
}
let author = db.get(`executer_${role.guild.id}_${entry.id}_rolecreate`)
let limts = db.get(`rolecreatelimt_${role.guild.id}`)
if(limts === null) {
return console.log('shit');
}
let logs = db.get(`acitonslogs_${role.guild.id}`)
if(author > limts) {
db.delete(`executer_${role.guild.id}_${entry.id}`)
console.log('trying to ban the user..')
role.guild.members.ban(entry.id)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} was trying to raid but failed miserabely! [Breaking Roles Create Limts]`)
return client.channels.cache.get(logs).send(logsembed);
}
db.add(`executer_${role.guild.id}_${role.guild.id}_rolecreate`, 1)
let warn = db.get(`executer_${role.guild.id}_${entry.id}_rolecreate`)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} Is Creating Roles.. [${warn || 0}/${author || 0}]`)
client.channels.cache.get(logs).send(logsembed)
});
client.on("roleDelete", async role => {
const user = await role.guild.fetchAuditLogs({
type: 'ROLE_DELETE'
}).then(audit => audit.entries.first())
const entry = user.executor
let author = db.get(`executer_${role.guild.id}_${entry.id}_roledelete`)
let limts = db.get(`roledeletelimt_${role.guild.id}`)
if(limts === null) {
return console.log('shit');
}
let trustedusers = db.get(`trustedusers_${role.guild.id}`)
if(trustedusers && trustedusers.find(find => find.user == entry.id)) {
return console.log('Its Trusted User');
}
let logs = db.get(`acitonslogs_${role.guild.id}`)
if(author > limts) {
db.delete(`executer_${role.guild.id}_${entry.id}`)
console.log('trying to ban the user..')
role.guild.members.ban(entry.id)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} was trying to raid but failed miserabely! [Breaking Roles Delete Limts]`)
return client.channels.cache.get(logs).send(logsembed);
}
db.add(`executer_${role.guild.id}_${entry.id}_roledelete`, 1)
let warn = db.get(`executer_${role.guild.id}_${entry.id}_roledelete`)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} Is Deleting Roles.. [${warn || 0}/${author || 0}]`)
client.channels.cache.get(logs).send(logsembed)
});
client.on("channelCreate", async channel => {
const user = await channel.guild.fetchAuditLogs({
type: 'CHANNEL_CREATE'
}).then(audit => audit.entries.first())
const entry = user.executor
let trustedusers = db.get(`trustedusers_${channel.guild.id}`)
if(trustedusers && trustedusers.find(find => find.user == entry.id)) {
return console.log('Its Trusted User');
}
let author = db.get(`executer_${channel.guild.id}_${entry.id}_channelcreate`)
let limts = db.get(`channelcreatelimts_${channel.guild.id}`)
if(limts === null) {
return console.log('shit');
}
let logs = db.get(`acitonslogs_${channel.guild.id}`)
if(author > limts) {
db.delete(`executer_${channel.guild.id}_${entry.id}`)
console.log('trying to ban the user..')
channel.guild.members.ban(entry.id)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} was trying to raid but failed miserabely! [Breaking Channel Create Limts]`)
return client.channels.cache.get(logs).send(logsembed);
}
db.add(`executer_${channel.guild.id}_${entry.id}_channelcreate`, 1)
let warn = db.get(`executer_${channel.guild.id}_${entry.id}_channelcreate`)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} Is Creating channel.. [${warn || 0}/${author || 0}]`)
client.channels.cache.get(logs).send(logsembed)
});
client.on("channelDelete", async channel => {
const user = await channel.guild.fetchAuditLogs({
type: 'CHANNEL_DELETE'
}).then(audit => audit.entries.first())
const entry = user.executor
let trustedusers = db.get(`trustedusers_${channel.guild.id}`)
if(trustedusers && trustedusers.find(find => find.user == entry.id)) {
return console.log('Its Trusted User');
}
let author = db.get(`executer_${channel.guild.id}_${entry.id}_channeldelete`)
let limts = db.get(`channeldeletelimts_${channel.guild.id}`)
if(limts === null) {
return console.log('shit');
}
let logs = db.get(`acitonslogs_${channel.guild.id}`)
if(author > limts) {
db.delete(`executer_${channel.guild.id}_${entry.id}`)
console.log('trying to ban the user..')
channel.guild.members.ban(entry.id)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} was trying to raid but failed miserabely! [Breaking Delete Create Limts]`)
return client.channels.cache.get(logs).send(logsembed);
}
db.add(`executer_${channel.guild.id}_${entry.id}_channeldelete`, 1)
let warn = db.get(`executer_${channel.guild.id}_${entry.id}_channeldelete`)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} Is Deleting channel.. [${warn || 0}/${author || 0}]`)
client.channels.cache.get(logs).send(logsembed)
});
client.on("guildMemberRemove", async member => {
const entry1 = await member.guild
.fetchAuditLogs()
.then(audit => audit.entries.first());
if (entry1.action === "MEMBER_KICK") {
const entry2 = await member.guild
.fetchAuditLogs({
type: "MEMBER_KICK"
})
.then(audit => audit.entries.first());
const entry = entry2.executor;
let trustedusers = db.get(`trustedusers_${member.guild.id}`)
if(trustedusers && trustedusers.find(find => find.user == entry.id)) {
return console.log('Its Trusted User');
}
let author = db.get(`executer_${member.guild.id}_${entry.id}_kicklimts`)
let limts = db.get(`kicklimts_${member.guild.id}`)
if(limts === null) {
return console.log('shit');
}
let logs = db.get(`acitonslogs_${member.guild.id}`)
if(author > limts) {
db.delete(`executer_${member.guild.id}_${entry.id}`)
console.log('trying to ban the user..')
channel.guild.members.ban(entry.id)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} was trying to raid but failed miserabely! [Breaking Kicking Members Limts]`)
return client.channels.cache.get(logs).send(logsembed);
}
db.add(`executer_${member.guild.id}_${entry.id}_kicklimts`, 1)
let warn = db.get(`executer_${member.guild.id}_${entry.id}_kicklimts`)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} Is Kicking Members.. [${warn || 0}/${author || 0}]`)
client.channels.cache.get(logs).send(logsembed)
}
})
client.on("guildMemberRemove", async member => {
const entry1 = await member.guild
.fetchAuditLogs()
.then(audit => audit.entries.first());
if (entry1.action === "MEMBER_BAN_ADD") {
const entry2 = await member.guild
.fetchAuditLogs({
type: "MEMBER_BAN_ADD"
})
.then(audit => audit.entries.first());
const entry = entry2.executor;
let trustedusers = db.get(`trustedusers_${member.guild.id}`)
if(trustedusers && trustedusers.find(find => find.user == entry.id)) {
return console.log('Its Trusted User');
}
let author = db.get(`executer_${member.guild.id}_${entry.id}_banlimts`)
let limts = db.get(`banlimts_${member.guild.id}`)
if(limts === null) {
return console.log('shit');
}
let logs = db.get(`acitonslogs_${member.guild.id}`)
if(author > limts) {
db.delete(`executer_${member.guild.id}_${entry.id}`)
console.log('trying to ban the user..')
member.guild.members.ban(entry.id)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} was trying to raid but failed miserabely! [Breaking Banning Members Limts]`)
return client.channels.cache.get(logs).send(logsembed);
}
db.add(`executer_${member.guild.id}_${entry.id}_banlimts`, 1)
let warn = db.get(`executer_${member.guild.id}_${entry.id}_banlimts`)
let logsembed = new Discord.MessageEmbed()
.setTitle(`${entry.tag} Is Banning Members.. [${warn || 0}/${author || 0}]`)
client.channels.cache.get(logs).send(logsembed)
}
})