-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
875 lines (838 loc) · 31.3 KB
/
bot.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
/**/
// -------------------------------------------------------------
const http = require("http");
const keep_alive = require("./keep_alive.js");
http
.createServer(function(req, res) {
res.write("OK!");
res.end();
})
.listen(8080);
//
const Discord = require("discord.js");
const client = new Discord.Client();
const ayarlar = require("./ayarlar.json");
const chalk = require("chalk");
const moment = require("moment");
const fs = require("fs");
var prefix = ayarlar.prefix;
const db = require("quick.db");
require("./util/eventLoader")(client);
const log = message => {
console.log(`[${moment().format("YYYY-MM-DD HH:mm:ss")}] ${message}`);
};
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
fs.readdir("./komutlar/", (err, files) => {
if (err) console.error(err);
log(`${files.length} komut yüklenecek.`);
files.forEach(f => {
let props = require(`./komutlar/${f}`);
log(`Yüklenen komut: ${props.help.name}.`);
client.commands.set(props.help.name, props);
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name);
});
});
});
client.reload = command => {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(`./komutlar/${command}`)];
let cmd = require(`./komutlar/${command}`);
client.commands.delete(command);
client.aliases.forEach((cmd, alias) => {
if (cmd === command) client.aliases.delete(alias);
});
client.commands.set(command, cmd);
cmd.conf.aliases.forEach(alias => {
client.aliases.set(alias, cmd.help.name);
});
resolve();
} catch (e) {
reject(e);
}
});
};
client.load = command => {
return new Promise((resolve, reject) => {
try {
let cmd = require(`./komutlar/${command}`);
client.commands.set(command, cmd);
cmd.conf.aliases.forEach(alias => {
client.aliases.set(alias, cmd.help.name);
});
resolve();
} catch (e) {
reject(e);
}
});
};
client.unload = command => {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(`./komutlar/${command}`)];
let cmd = require(`./komutlar/${command}`);
client.commands.delete(command);
client.aliases.forEach((cmd, alias) => {
if (cmd === command) client.aliases.delete(alias);
});
resolve();
} catch (e) {
reject(e);
}
});
};
const DBL = require("dblapi.js");
const dbl = new DBL('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2NTIzMjYzMzUyOTM2ODU3NiIsImJvdCI6dHJ1ZSwiaWF0IjoxNTgxMDA5ODg0fQ.ZrLr1fZZ6m6iBmD_66N4rqeQ9fmtrV7pnLoc8IfVe_c', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
client.on("guildBanAdd", async (guild, user) => {
let kontrol = await db.fetch(`dil_${guild.id}`);
let kanal = await db.fetch(`bank_${guild.id}`);
let rol = await db.fetch(`banrol_${guild.id}`);
if (!kanal) return;
if (kontrol == "TR_tr") {
const entry = await guild
.fetchAuditLogs({ type: "GUILD_BAN_ADD" })
.then(audit => audit.entries.first());
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == guild.owner.id) return;
if (!rol) {
guild.unban(user.id);
guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Biri Yasaklandı!`)
.setColor("BLACK")
.addField(`Yasaklayan`, entry.executor.tag)
.addField(`Yasaklanan Kişi`, user.name)
.addField(
`Sonuç`,
`Yasaklayan kişi sunucudan açıldı!\nve yasaklanan kişinin yasağı kalktı!`
);
client.channels.get(kanal).send(embed);
} else {
if (entry.executor.roles.has(rol)) {
let limito = await db.fetch(`limido_${entry.executor.id}`);
let slimito = await db.fetch(`slimido_${guild.id}`);
if (slimito == limito || slimito > limito) {
db.delete(`limido_${entry.executor.id}`);
guild.unban(user.id);
guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Biri Yasaklandı!`)
.setColor("BLACK")
.addField(`Yasaklayan`, entry.executor.tag)
.addField(`Yasaklanan Kişi`, user.name)
.addField(
`Sonuç`,
`Yasaklayan kişi sunucudan açıldı!\nve yasaklanan kişinin yasağı kalktı!\nNOT: LİMİTİ AŞTI!`
);
client.channels.get(kanal).send(embed);
} else {
db.add(`limido_${entry.executor.id}`, +1);
const embed = new Discord.RichEmbed()
.setTitle(`Biri Yasaklandı!`)
.setColor("BLACK")
.addField(`Yasaklayan`, entry.executor.tag)
.addField(`Yasaklanan Kişi`, user.name)
.addField(
`Sonuç`,
`Yasaklayan kişi ${limito}/${slimito} sınırına ulaştı!`
);
client.channels.get(kanal).send(embed);
}
} else {
guild.unban(user.id);
guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Biri Yasaklandı!`)
.setColor("BLACK")
.addField(`Yasaklayan`, entry.executor.tag)
.addField(`Yasaklanan Kişi`, user.name)
.addField(
`Sonuç`,
`Yasaklayan kişi sunucudan açıldı!\nve yasaklanan kişinin yasağı kalktı!`
);
client.channels.get(kanal).send(embed);
}
}
}
///////////////////////////////////////
else {
const entry = await guild
.fetchAuditLogs({ type: "GUILD_BAN_ADD" })
.then(audit => audit.entries.first());
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == guild.owner.id) return;
if (!rol) {
guild.unban(user.id);
guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`One Banned!`)
.setColor("BLACK")
.addField(`Banner`, entry.executor.tag)
.addField(`Banned Person`, user.name)
.addField(
`Sonuç`,
`The ban has been opened from the server!\nand the ban has been lifted!`
);
client.channels.get(kanal).send(embed);
} else {
if (entry.executor.roles.has(rol)) {
let limito = await db.fetch(`limido_${entry.executor.id}`);
let slimito = await db.fetch(`slimido_${guild.id}`);
if (slimito == limito || slimito > limito) {
guild.unban(user.id);
guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`One Banned!`)
.setColor("BLACK")
.addField(`Banner`, entry.executor.tag)
.addField(`Banned Person`, user.name)
.addField(
`Result`,
`The ban has been opened from the server!\and the ban has been lifted!\nNOTE: EXCEEDED!`
);
client.channels.get(kanal).send(embed);
} else {
const embed = new Discord.RichEmbed()
.setTitle(`One Banned!`)
.setColor("BLACK")
.addField(`Banner`, entry.executor.tag)
.addField(`Banned Person`, user.name)
.addField(
`Result`,
`The ban has reached the limit of ${limito}/${slimito}!`
);
client.channels.get(kanal).send(embed);
}
} else {
guild.unban(user.id);
guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`One Banned!`)
.setColor("BLACK")
.addField(`Banner`, entry.executor.tag)
.addField(`Banned Person`, user.name)
.addField(
`Result`,
`The ban has been opened from the server!\nand the ban has been lifted!`
);
client.channels.get(kanal).send(embed);
}
}
}
});
client.on("roleDelete", async role => {
const entry = await role.guild
.fetchAuditLogs({ type: "ROLE_DELETE" })
.then(audit => audit.entries.first());
let rol = await db.fetch(`rolrol_${role.guild.id}`);
let kontrol = await db.fetch(`dil_${role.guild.id}`);
let kanal = await db.fetch(`rolk_${role.guild.id}`);
if (!kanal) return;
if (kontrol == "TR_tr") {
if (!rol) {
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == role.guild.owner.id) return;
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silindi!`)
.setColor("BLACK")
.addField(`Silen`, entry.executor.tag)
.addField(`Silinen Rol`, role.name)
.addField(`Sonuç`, `Rol Geri Açıldı!`);
client.channels.get(kanal).send(embed);
} else {
if (entry.executor.roles.has(rol)) {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
if (slimito == limito || slimito > limito) {
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silen!`)
.setColor("BLACK")
.addField(`Rolü Silen`, entry.executor.tag)
.addField(`Silinen Rol`, role.name)
.addField(`Sonuç`, `Rol geri açıldı! Rolü silen sunucudan atıldı!`);
client.channels.get(kanal).send(embed);
} else {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silen!`)
.setColor("BLACK")
.addField(`Rolü Silen`, entry.executor.tag)
.addField(`Silinen Rol`, role.name)
.addField(
`Sonuç`,
`Rol geri açılamadı! Rolü silen ${limito}/${slimito} sınırına ulaştı!`
);
client.channels.get(kanal).send(embed);
}
} else {
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silindi!`)
.setColor("BLACK")
.addField(`Silen`, entry.executor.tag)
.addField(`Silinen Rol`, role.name)
.addField(`Sonuç`, `Rol Geri Açıldı!`);
client.channels.get(kanal).send(embed);
}
}
} else {
if (!rol) {
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == role.guild.owner.id) return;
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
const embed = new Discord.RichEmbed()
.setTitle(`A Role Deleted!`)
.setColor("BLACK")
.addField(`Role Deleter`, entry.executor.tag)
.addField(`Deleting Role`, role.name)
.addField(`Result`, `Role Back A Open!`);
client.channels.get(kanal).send(embed);
} else {
if (entry.executor.roles.has(rol)) {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
if (slimito == limito || slimito > limito) {
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`A Role Deleted!`)
.setColor("BLACK")
.addField(`Role Deleter`, entry.executor.tag)
.addField(`Deleting Role`, role.name)
.addField(
`Result`,
`Role Back A Open! Role Deleter Kicking Has Guild!`
);
client.channels.get(kanal).send(embed);
} else {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`A Role Deleted!`)
.setColor("BLACK")
.addField(`Role Deleter`, entry.executor.tag)
.addField(`Deleting Role`, role.name)
.addField(
`Result`,
`The role could not be turned back! Reached ${limito}/${slimito} limit, which opens the role!`
);
client.channels.get(kanal).send(embed);
}
} else {
role.guild
.createRole({
name: role.name,
color: role.color,
hoist: role.hoist,
permissions: role.permissions,
mentionable: role.mentionable,
position: role.position
})
.then(r => r.setPosition(role.position));
const embed = new Discord.RichEmbed()
.setTitle(`A Role Deleted!`)
.setColor("BLACK")
.addField(`Role Deleter`, entry.executor.tag)
.addField(`Deleting Role`, role.name)
.addField(`Result`, `Role Back A Open`);
client.channels.get(kanal).send(embed);
}
}
}
});
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
client.on("message", async message => {
let pref = (await db.fetch(`prefix_${message.guild.id}`)) || "g!";
let dil = await db.fetch(`dil_${message.guild.id}`);
if (message.content === "<@!665232633529368576>") {
if (dil == "TR_tr") {
message.channel.send(
`Prefixim: \`${pref}\`\nEğer yardım istiyorsan; https://discord.gg/6Cc3fNM`
);
} else {
message.channel.send(
`My prefix is: \`${pref}\`\nIf you want to get help; https://discord.gg/6Cc3fNM`
);
}
} else {
return;
}
});
client.on("guildMemberAdd", async member => {
let user = member.guild.members.get(member.id);
let kanal = await db.fetch(`güvenlik_${member.guild.id}`);
let d = await db.fetch(`dil_${member.guild.id}`);
if (!kanal) return;
if (d == "TR_tr") {
const kurulus = new Date().getTime() - user.createdAt.getTime();
const gün = moment(kurulus).format("dddd");
var kontrol;
if (kurulus > 1296000000) kontrol = "15 günden sonra oluşturulmuş!";
if (kurulus < 1296000000) kontrol = "15 günden önce oluşturulmuş!";
if (kontrol == "15 günden sonra oluşturulmuş!") {
const embed = new Discord.RichEmbed().setDescription(
`${member} sunucuya katıldı! Hesabı; ${kontrol}`
);
client.channels.get(kanal).send(embed);
let rol1 = await db.fetch(`güvenlikalınacak_${member.guild.id}`);
let rol2 = await db.fetch(`güvenlikverilecek_${member.guild.id}`);
if (!rol1) {
if (!rol2) {
return;
} else {
member.addRole(rol2);
return;
}
} else {
member.removeRole(rol1);
if (!rol2) {
return;
} else {
member.addRole(rol2);
return;
}
}
} else {
const embed = new Discord.RichEmbed().setDescription(
`${member} sunucuya katıldı! Hesabı; ${kontrol}`
);
client.channels.get(kanal).send(embed);
let rol1 = await db.fetch(`güvenlikfake_${member.guild.id}`);
if (!rol1) return;
else {
member.addRole(rol1);
}
}
} else {
const kurulus = new Date().getTime() - user.createdAt.getTime();
const gün = moment(kurulus).format("dddd");
var kontrol;
if (kurulus > 1296000000) kontrol = "Created after 15 days!";
if (kurulus < 1296000000) kontrol = "Created before 15 days!";
if (kontrol == "Created after 15 days!") {
const embed = new Discord.RichEmbed().setDescription(
`${member} has joined the server! Account; ${kontrol}`
);
client.channels.get(kanal).send(embed);
let rol1 = await db.fetch(`güvenlikalınacak_${member.guild.id}`);
let rol2 = await db.fetch(`güvenlikverilecek_${member.guild.id}`);
if (!rol1) {
if (!rol2) {
return;
} else {
member.addRole(rol2);
return;
}
} else {
member.removeRole(rol1);
if (!rol2) {
return;
} else {
member.addRole(rol2);
return;
}
}
} else {
const embed = new Discord.RichEmbed().setDescription(
`${member} has joined the server! Account; ${kontrol}`
);
client.channels.get(kanal).send(embed);
let rol1 = await db.fetch(`güvenlikfake_${member.guild.id}`);
if (!rol1) return;
else {
member.addRole(rol1);
}
}
}
});
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
client.on("guildMemberAdd", async member => {
let tag = await db.fetch(`ototag_${member.guild.id}`);
let kanal = await db.fetch(`ototagk_${member.guild.id}`);
let msj = await db.fetch(`ototagmsj_${member.guild.id}`);
let dil = await db.fetch(`dil_${member.guild.id}`);
if (!tag) return;
if (!kanal) return;
if (dil == "TR_tr") {
if (!msj) {
member.setNickname(`${tag} | ${member.user.username}`);
const embed = new Discord.RichEmbed()
.setColor("BLACK")
.setDescription(
`:loudspeaker: **@${member.user.tag}** adlı şahsa tag verildi!`
)
.setFooter(client.user.username, client.user.avatarURL);
client.channels.get(kanal).send(embed);
return;
} else {
var msj2 = msj
.replace(`-uye-`, `${member.user.username}`)
.replace(`-tag-`, tag)
.replace(`-sunucu-`, member.guild.name)
.replace(`-uyetag-`, member.user.tag);
member.setNickname(msj2);
const embed = new Discord.RichEmbed()
.setColor("BLACK")
.setDescription(
`:loudspeaker: **@${member.user.tag}** adlı şahsa tag verildi!`
)
.setFooter(client.user.username, client.user.avatarURL);
client.channels.get(kanal).send(embed);
return;
}
} else {
if (!msj) {
member.setNickname(`${tag} | ${member.user.username}`);
const embed = new Discord.RichEmbed()
.setColor("BLACK")
.setDescription(
`:loudspeaker: Tag was given to **@${member.user.tag}**!`
)
.setFooter(client.user.username, client.user.avatarURL);
client.channels.get(kanal).send(embed);
return;
} else {
var msj2 = msj
.replace(`-uye-`, `${member.user.username}`)
.replace(`-tag-`, `${tag}`)
.replace(`-sunucu-`, member.guild.name)
.replace(`-uyetag-`, member.user.tag);
member.setNickname(msj2);
const embed = new Discord.RichEmbed()
.setColor("BLACK")
.setDescription(
`:loudspeaker: Tag was given to **@${member.user.tag}**!`
)
.setFooter(client.user.username, client.user.avatarURL);
client.channels.get(kanal).send(embed);
return;
}
}
});
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
client.on("roleCreate", async role => {
const entry = await role.guild
.fetchAuditLogs({ type: "ROLE_CREATE" })
.then(audit => audit.entries.first());
let rol = await db.fetch(`rolrol_${role.guild.id}`);
let kontrol = await db.fetch(`dil_${role.guild.id}`);
let kanal = await db.fetch(`rolk_${role.guild.id}`);
if (!kanal) return;
if (kontrol == "TR_tr") {
if (!rol) {
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == role.guild.owner.id) return;
role.delete();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Açıldı!`)
.setColor("BLACK")
.addField(`Açan`, entry.executor.tag)
.addField(`Açılan Rol`, role.name)
.addField(`Sonuç`, `Rol Geri Silindi!`);
client.channels.get(kanal).send(embed);
} else {
if (entry.executor.roles.has(rol)) {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
if (slimito == limito || slimito > limito) {
role.delete();
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silen!`)
.setColor("BLACK")
.addField(`Rolü Açan`, entry.executor.tag)
.addField(`Açılan Rol`, role.name)
.addField(`Sonuç`, `Rol geri silindi! Rolü açan sunucudan atıldı!`);
client.channels.get(kanal).send(embed);
} else {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
role.delete();
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silen!`)
.setColor("BLACK")
.addField(`Rolü Silen`, entry.executor.tag)
.addField(`Silinen Rol`, role.name)
.addField(
`Sonuç`,
`Rol geri silinmedi! Rolü açan ${limito}/${slimito} sınırına ulaştı!`
);
client.channels.get(kanal).send(embed);
}
} else {
role.delete();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Rol Silindi!`)
.setColor("BLACK")
.addField(`Rolü Açan`, entry.executor.tag)
.addField(`Açılan Rol`, role.name)
.addField(`Sonuç`, `Rol Geri Silindi!`);
client.channels.get(kanal).send(embed);
}
}
} else {
if (!rol) {
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == role.guild.owner.id) return;
role.delete();
const embed = new Discord.RichEmbed()
.setTitle(`A Role Created!`)
.setColor("BLACK")
.addField(`Role Creator`, entry.executor.tag)
.addField(`Creating Role`, role.name)
.addField(`Result`, `Role Back A Deleted!`);
client.channels.get(kanal).send(embed);
} else {
if (entry.executor.roles.has(rol)) {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
if (slimito == limito || slimito > limito) {
role.delete();
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`A Role Created!`)
.setColor("BLACK")
.addField(`Role Creator`, entry.executor.tag)
.addField(`Creating Role`, role.name)
.addField(
`Result`,
`Role Back A Deleted! Role Creator Kicking Has Guild!`
);
client.channels.get(kanal).send(embed);
} else {
let limito = await db.fetch(`limitrol_${entry.executor.id}`);
let slimito = await db.fetch(`rollim_${role.guild.id}`);
role.delete();
role.guild.members.get(entry.executor.id).kick();
const embed = new Discord.RichEmbed()
.setTitle(`A Role Created!`)
.setColor("BLACK")
.addField(`Role Creator`, entry.executor.tag)
.addField(`Creating Role`, role.name)
.addField(
`Result`,
`The role could not be turned delete back! Reached ${limito}/${slimito} limit, which opens the role!`
);
client.channels.get(kanal).send(embed);
}
} else {
role.delete();
const embed = new Discord.RichEmbed()
.setTitle(`A Role Created!`)
.setColor("BLACK")
.addField(`Role Creator`, entry.executor.tag)
.addField(`Creating Role`, role.name)
.addField(`Result`, `Role Back A Open`);
client.channels.get(kanal).send(embed);
}
}
}
});
client.on("channelDelete", async channel => {
let kontrol = await db.fetch(`dil_${channel.guild.id}`);
let kanal = await db.fetch(`kanalk_${channel.guild.id}`);
if (!kanal) return;
if (kontrol == "TR_tr") {
const entry = await channel.guild
.fetchAuditLogs({ type: "CHANNEL_DELETE" })
.then(audit => audit.entries.first());
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == channel.guild.owner.id) return;
channel.guild.createChannel(channel.name, channel.type, [
{
id: channel.guild.id,
position: channel.calculatedPosition
}
]);
const embed = new Discord.RichEmbed()
.setTitle(`Bir Kanal Silindi!`)
.addField(`Silen`, entry.executor.tag)
.addField(`Silinen Kanal`, channel.name)
.addField(`Sonuç`, `Kanal Geri Açıldı!`)
.setColor("BLACK");
client.channels.get(kanal).send(embed);
} else {
const entry = await channel.guild
.fetchAuditLogs({ type: "CHANNEL_DELETE" })
.then(audit => audit.entries.first());
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == channel.guild.owner.id) return;
channel.guild.createChannel(channel.name, channel.type, [
{
id: channel.guild.id,
position: channel.calculatedPosition
}
]);
const embed = new Discord.RichEmbed()
.setTitle(`One Channel Deleted!`)
.addField(`Deleter Channel`, entry.executor.tag)
.setColor("BLACK")
.addField(`Deleted Channel`, channel.name)
.addField(`Result`, `Channel Back Opened!`);
client.channels.get(kanal).send(embed);
}
});
client.on("channelCreate", async channel => {
let kontrol = await db.fetch(`dil_${channel.guild.id}`);
let kanal = await db.fetch(`kanalk_${channel.guild.id}`);
if (!kanal) return;
if (kontrol == "TR_tr") {
const entry = await channel.guild
.fetchAuditLogs({ type: "CHANNEL_CREATE" })
.then(audit => audit.entries.first());
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == channel.guild.owner.id) return;
channel.delete();
const embed = new Discord.RichEmbed()
.setTitle(`Bir Kanal Açıldı!`)
.setColor("BLACK")
.addField(`Açan`, entry.executor.tag)
.addField(`Açılan Kanal`, channel.name)
.addField(`Sonuç`, `Kanal Geri Silindi!`);
client.channels.get(kanal).send(embed);
} else {
const entry = await channel.guild
.fetchAuditLogs({ type: "CHANNEL_CREATE" })
.then(audit => audit.entries.first());
if (entry.executor.id == client.user.id) return;
if (entry.executor.id == channel.guild.owner.id) return;
channel.delete();
const embed = new Discord.RichEmbed()
.setTitle(`A Channel Opened!`)
.setColor("BLACK")
.addField(`Channel Opener`, entry.executor.tag)
.addField(`Drop Down Channel`, channel.name)
.addField(`Result`, `Channel Back Deleted!`);
client.channels.get(kanal).send(embed);
}
});
/*client.on("guildCreate", async guild => {
const embed = new Discord.RichEmbed()
.setColor(`GREEN`)
.setTitle(`EKLENDİM/ADDED!`)
.setDescription(
`Sunucu Adı/Guild Name: ${guild.name}\nSunucu Id/Guild Id: ${guild.id}\nSunucu Sahibi/Guild Owner: ${guild.owner}\nSunucudaki Kişi Sayısı/Guild Member Count: ${guild.memberCount}\nSunucu Oluşturulma Zamanı/Guild Created Time: ${guild.createdAt}\nDoğrulama Seviyesi\nVerifection Level: ${guild.verificationLevel}`
);
client.channels.get(`675041940634468353`).send(embed);
});
client.on("guildDelete", async guild => {
const embed = new Discord.RichEmbed()
.setColor(`RED`)
.setTitle(`ATILDIM/REMOVED!`)
.setDescription(
`Sunucu Adı/Guild Name: ${guild.name}\nSunucu Id/Guild Id: ${guild.id}\nSunucu Sahibi/Guild Owner: ${guild.owner}\nSunucudaki Kişi Sayısı/Guild Member Count: ${guild.memberCount}\nSunucu Oluşturulma Zamanı/Guild Created Time: ${guild.createdAt}\nDoğrulama Seviyesi\nVerifection Level: ${guild.verificationLevel}`
);
client.channels.get(`675041940634468353`).send(embed);
});*/
client.elevation = message => {
if (!message.guild) {
return;
}
let permlvl = 0;
if (message.member.hasPermission("BAN_MEMBERS")) permlvl = 2;
if (message.member.hasPermission("ADMINISTRATOR")) permlvl = 3;
if (message.author.id === ayarlar.sahip) permlvl = 4;
return permlvl;
};
var regToken = /[\w\d]{24}\.[\w\d]{6}\.[\w\d-_]{27}/g;
client.on("warn", e => {
console.log(chalk.bgYellow(e.replace(regToken, "that was redacted")));
});
client.on("error", e => {
console.log(chalk.bgRed(e.replace(regToken, "that was redacted")));
});
client.login(ayarlar.token);