├── package.json ├── README.md ├── LICENSE ├── config.js └── index.js /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "striga-guard", 3 | "version": "0.0.1", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Striga", 10 | "license": "ISC", 11 | "dependencies": { 12 | "discord.js": "^12.5.3", 13 | "moment": "^2.29.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Striga Guard 2 | Selam dostlar ben Striga, arkadaşlar örneklendirmelere bakarak yaptığım guardımı paylaşıyorum herhangi bir şekilde backup fonksiyonuna sahip değildir amacı sadece sunucuyu korumaktır. 3 | `Eğer bir hata veya bug ile karşılaşırsanız hemen discordumdan bildirirseniz sevinirim.` 4 | 5 | # Hızlı Ve Basit Kurulum 6 | * Bot klasöründe Powershell'i açın npm install yazın gerekli modülleri indirin. 7 | * Botu bastiçe ayarlamak için "config.js" dosyasını eksiksiz doldurun 8 | * Botlarınızın yetkilerinin en üstte olduğundan emin oldun 9 | 10 | 11 | * [Discord Adresim](https://discord.gg/striga) 12 | * [YouTube Kanalım](https://www.youtube.com/channel/UC2yLMwMa0vyrBw_Tzhe0U-g) 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Striga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | GuildID: "", 3 | SunucuGuardToken: "", 4 | RolGuardToken: "", 5 | KanalGuardToken: "", 6 | OwnerID: " ", 7 | VoiceID: "", 8 | 9 | // SUNUCU KORUMA LOGLARININ IDLERİ 10 | BanLog: "", 11 | KickLog: "", 12 | SunucuLog: "", 13 | EmojiLog: "", 14 | BotLog: "", 15 | 16 | // ROL KORUMA LOGLARININ IDLERİ 17 | RolSilmeLog: "", 18 | RolAçmaLog: "", 19 | RolGüncellemeLog: "", 20 | YetkiKorumaLog: "", 21 | 22 | // KANAL KORUMA LOGLARININ IDLERİ 23 | KanalSilmeLog: "", 24 | KanalAçmaLog: "", 25 | KanalGüncellemeLog: "", 26 | KanalWebhookLog: "", 27 | 28 | // CEZA İŞLEM İÇİN ROL İDLERİ 29 | BoosterRole: "", //YOKSA BİR TANE YENİ ROL AÇIN ONUN IDSINI GİRİN 30 | JailedRole: "", 31 | 32 | Whitelist: [ 33 | "", // Kimin IDsi olduğunu // tan sonra belirtirseniz o kişinin idsini aramak zorunda kalmazınsız 34 | "", // striga 35 | "", // raviwen gibi 36 | ], 37 | 38 | Bots: [ 39 | "", // Kimin IDsi olduğunu // tan sonra belirtirseniz o kişinin idsini aramak zorunda kalmazınsız (BOTUN KENDİ IDSINI EKLEMEYI UNUTMAYIN SORUN ÇIKAR) 40 | "", // register 41 | "", // moderasyon gibi 42 | ], 43 | statusMessage: "Striga Guard", 44 | statusCase: "dnd" 45 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { Discord, MessageEmbed} = require('discord.js') 2 | const client1 = require("discord.js"); const client2 = require("discord.js"); const client3 = require("discord.js"); 3 | const serverGuard = new client1.Client(); const roleGuard = new client2.Client(); const channelGuard = new client3.Client(); 4 | const settings = require('./config') 5 | const moment = require('moment'); moment.locale('tr'); 6 | 7 | const yetkiler = ["ADMINISTRATOR", "MANAGE_ROLES", "MANAGE_CHANNELS", "MANAGE_GUILD", "BAN_MEMBERS", "KICK_MEMBERS", "MANAGE_NICKNAMES", "MANAGE_EMOJIS", "MANAGE_WEBHOOKS"]; 8 | function sunucuCeza(kisiID, tur) {let member = serverGuard.guilds.cache.get(settings.GuildID).members.cache.get(kisiID); if (!member) return; if (tur == "jail") return member.roles.cache.has(settings.BoosterRole) ? member.roles.set([settings.BoosterRole, settings.JailedRole]) : member.roles.set([settings.JailedRole]); if (tur == "ban") return member.ban({ reason: "Sunucu Koruma." }).catch();}; 9 | function rolCeza(kisiID, tur) {let member = roleGuard.guilds.cache.get(settings.GuildID).members.cache.get(kisiID); if (!member) return; if (tur == "jail") return member.roles.cache.has(settings.BoosterRole) ? member.roles.set([settings.BoosterRole, settings.JailedRole]) : member.roles.set([settings.JailedRole]); if (tur == "ban") return member.ban({ reason: "Sunucu Koruma." }).catch();}; 10 | function kanalCeza(kisiID, tur) {let member = channelGuard.guilds.cache.get(settings.GuildID).members.cache.get(kisiID); if (!member) return; if (tur == "jail") return member.roles.cache.has(settings.BoosterRole) ? member.roles.set([settings.BoosterRole, settings.JailedRole]) : member.roles.set([settings.JailedRole]); if (tur == "ban") return member.ban({ reason: "Sunucu Koruma." }).catch();}; 11 | 12 | // SUNUCU KORUMA \\ 13 | 14 | serverGuard.on("guildBanAdd", async function(guild, user) { 15 | let entry = await guild.fetchAuditLogs({type: 'MEMBER_BAN_ADD'}).then(audit => audit.entries.first()); 16 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 17 | const yetkili = await guild.members.cache.get(entry.executor.id); sunucuCeza(entry.executor.id, "jail") 18 | if(settings.BanLog) { serverGuard.channels.cache.get(settings.BanLog).send(new MessageEmbed().setAuthor(`İzinsiz Kullanıcı Sunucudan Yasaklandı`, guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Kullanıcıyı Yasakladı !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Kullanıcı: ${user} | \` ${user.id} \`\n\n❯ İşlem: \` Sunucudan Yasaklama \` | ❯ Ceza: \` Jail'a Atıldı \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 19 | 20 | serverGuard.on("guildMemberRemove", async function(member) { 21 | let entry = await member.guild.fetchAuditLogs({type: 'MEMBER_KICK'}).then(audit => audit.entries.first()); 22 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 23 | const yetkili = await member.guild.members.cache.get(entry.executor.id); sunucuCeza(entry.executor.id, "jail") 24 | if(settings.KickLog) { serverGuard.channels.cache.get(settings.KickLog).send(new MessageEmbed().setAuthor(`İzinsiz Kullanıcı Sunucudan Atıldı`, member.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Kullanıcıyı Attı !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Kullanıcı: ${member} | \` ${member.id} \`\n\n❯ İşlem: \` Sunucudan Atmak \` | ❯ Ceza: \` Jail'a Atıldı \` `).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 25 | 26 | serverGuard.on("guildMemberAdd", async function(member) { 27 | let entry = await member.guild.fetchAuditLogs({type: 'BOT_ADD'}).then(audit => audit.entries.first()); 28 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 29 | const yetkili = await member.guild.members.cache.get(entry.executor.id); 30 | if(settings.BotLog) { serverGuard.channels.cache.get(settings.BotLog).send(new MessageEmbed().setAuthor(`İzinsiz Bot Çekme`, member.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucuya Bir Bot Çekti !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Bot: ${member} | \` ${member.id} \`\n\n❯ İşlem: \` Bot Çekmek \` | ❯ Ceza: \` Jail'a Atıldı \` `).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 31 | 32 | serverGuard.on('guildUpdate', async (oldGuild, newGuild) => { 33 | let entry = await newGuild.fetchAuditLogs({type: 'GUILD_UPDATE'}).then(audit => audit.entries.first()); 34 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 35 | const yetkili = await newGuild.members.cache.get(entry.executor.id); sunucuCeza(entry.executor.id, "jail"); await sunucuCeza(entry.executor.id, "ban"); 36 | if(newGuild.name !== oldGuild.name) newGuild.setName(oldGuild.name); newGuild.setIcon(oldGuild.iconURL({dynamic: true, size: 2048})); newGuild.roles.cache.forEach(async function(sunucu) {if (sunucu.permissions.has("ADMINISTRATOR") || sunucu.permissions.has("BAN_MEMBERS") || sunucu.permissions.has("MANAGE_GUILD") || sunucu.permissions.has("KICK_MEMBERS") || sunucu.permissions.has("MANAGE_ROLES") || sunucu.permissions.has("MANAGE_CHANNELS")) {sunucu.setPermissions(0).catch(err =>{});}}); 37 | if(settings.SunucuLog) { serverGuard.channels.cache.get(settings.SunucuLog).send(new MessageEmbed().setAuthor(`Sunucunun Ayarlarıyla Oynadı`, newGuild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucunun Ayarlarıyla Oynadı !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ İşlem: \` Ayarları Değişti \` | ❯ Ceza: \` Yasaklama \` `).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 38 | 39 | serverGuard.on('emojiDelete', async (emoji, message) => { 40 | let entry = await emoji.fetchAuditLogs({type: 'EMOJI_DELETE'}).then(audit => audit.entries.first()); 41 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 42 | const yetkili = await newGuild.members.cache.get(entry.executor.id); sunucuCeza(entry.executor.id, "jail"); emoji.guild.emojis.create(`${emoji.url}`, `${emoji.name}`).catch(); 43 | if(settings.EmojiLog) { serverGuard.channels.cache.get(settings.EmojiLog).send(new MessageEmbed().setAuthor(`İzinsiz Emoji Sildi`, emoji.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Emoji Sildi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Emoji: ${emoji.name} | \` ${emoji.id} \`\n\n❯ İşlem: \` Emoji Silmek \` | ❯ Ceza: \` Jail'a Atıldı \` `).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 44 | 45 | serverGuard.on('emojiCreate', async (emoji, message) => { 46 | let entry = await emoji.fetchAuditLogs({type: 'EMOJI_CREATE'}).then(audit => audit.entries.first()); 47 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 48 | const yetkili = await newGuild.members.cache.get(entry.executor.id); sunucuCeza(entry.executor.id, "jail"); emoji.delete({reason: "İzinsiz Emoji Yüklendi Sildim."}); 49 | if(settings.EmojiLog) { serverGuard.channels.cache.get(settings.EmojiLog).send(new MessageEmbed().setAuthor(`İzinsiz Emoji Yüklendi`, emoji.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Emoji Yükledi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\❯ İşlem: \` Emoji Yüklemek \` | ❯ Ceza: \` Jail'a Atıldı \` `).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 50 | 51 | serverGuard.on('emojiUpdate', async (oldEmoji, newEmoji) => { 52 | if(oldEmoji === newEmoji) return; 53 | let entry = await emoji.fetchAuditLogs({type: 'EMOJI_UPDATE'}).then(audit => audit.entries.first()); 54 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 55 | const yetkili = await newGuild.members.cache.get(entry.executor.id); sunucuCeza(entry.executor.id, "jail"); await newEmoji.setName(oldEmoji.name); 56 | if(settings.EmojiLog) { serverGuard.channels.cache.get(settings.EmojiLog).send(new MessageEmbed().setAuthor(`İzinsiz Emoji Güncellendi`, emoji.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Emoji Güncelledi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Emoji: ${oldEmoji.name} | \` ${oldEmoji.id} \`\n\n\❯ İşlem: \` Emoji Güncellemek \` | ❯ Ceza: \` Jail'a Atıldı \` `).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 57 | 58 | 59 | // ROL KORUMA \\ 60 | 61 | roleGuard.on("roleDelete", async role => { 62 | let entry = await role.guild.fetchAuditLogs({type: 'ROLE_DELETE'}).then(audit => audit.entries.first()); 63 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 64 | const yetkili = await role.guild.members.cache.get(entry.executor.id); rolCeza(entry.executor.id, "jail"); await rolCeza(entry.executor.id, "ban"); role.roles.cache.forEach(async function(sunucu) {if (sunucu.permissions.has("ADMINISTRATOR") || sunucu.permissions.has("BAN_MEMBERS") || sunucu.permissions.has("MANAGE_GUILD") || sunucu.permissions.has("KICK_MEMBERS") || sunucu.permissions.has("MANAGE_ROLES") || sunucu.permissions.has("MANAGE_CHANNELS")) {sunucu.setPermissions(0).catch(err =>{});}}); 65 | role.guild.roles.create({ data: {name: role.name, color: role.color, hoist: role.hoist, permissions: role.permissions, mentionable: role.mentionable, position: role.position}, reason: 'Silinen Roller Tekrar Açıldı.'}) 66 | if(settings.RolSilmeLog) { roleGuard.channels.cache.get(settings.RolSilmeLog).send(new MessageEmbed().setAuthor(`İzinsiz Rol Silindi`, role.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Rol Sildi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Rol: **${role.name}** | \` ${role.id} \`\n\n❯ İşlem: \` Rol Silmek \` | ❯ Ceza: \` Yasaklama \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 67 | 68 | roleGuard.on("roleCreate", async role => { 69 | let entry = await role.guild.fetchAuditLogs({type: 'ROLE_CREATE'}).then(audit => audit.entries.first()); 70 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 71 | const yetkili = await role.guild.members.cache.get(entry.executor.id); rolCeza(entry.executor.id, "jail"); 72 | role.delete({reason: `${yetkili.id} idli kullanıcı izinsiz rol açtı sildim.`}) 73 | if(settings.RolAçmaLog) { roleGuard.channels.cache.get(settings.RolAçmaLog).send(new MessageEmbed().setAuthor(`İzinsiz Rol Açıldı`, role.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Rol Açtı !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Rol: **${role.name}** | \` ${role.id} \`\n\n❯ İşlem: \` Rol Açmak \` | ❯ Ceza: \` Jail'a Atıldı \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 74 | 75 | roleGuard.on("roleUpdate", async (oldRole, newRole) => { 76 | let entry = await newRole.guild.fetchAuditLogs({type: 'ROLE_UPDATE'}).then(audit => audit.entries.first()); 77 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 78 | const yetkili = await newRole.guild.members.cache.get(entry.executor.id); rolCeza(entry.executor.id, "jail"); await rolCeza(entry.executor.id, "ban") 79 | if (yetkiler.some(p => !oldRole.permissions.has(p) && newRole.permissions.has(p))) {newRole.setPermissions(oldRole.permissions); newRole.guild.roles.cache.filter(r => !r.managed && (r.permissions.has("ADMINISTRATOR") || r.permissions.has("MANAGE_ROLES") || r.permissions.has("MANAGE_GUILD"))).forEach(r => r.setPermissions(36818497));}; newRole.edit({name: oldRole.name, color: oldRole.hexColor, hoist: oldRole.hoist, permissions: oldRole.permissions, mentionable: oldRole.mentionable}); 80 | if(settings.RolGüncellemeLog) { roleGuard.channels.cache.get(settings.RolGüncellemeLog).send(new MessageEmbed().setAuthor(`İzinsiz Rol Güncellendi`, newRole.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Rol Güncelledi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Rol: **${newRole.name}** | \` ${newRole.id} \`\n\n❯ İşlem: \` Rol Güncellemek \` | ❯ Ceza: \` Yasaklama \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 81 | 82 | roleGuard.on("guildMemberUpdate", async (oldMember, newMember) => { 83 | if (newMember.roles.cache.size > oldMember.roles.cache.size) { 84 | let entry = await newMember.guild.fetchAuditLogs({type: 'MEMBER_ROLE_UPDATE'}).then(audit => audit.entries.first()); 85 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 86 | const yetkili = await newMember.guild.members.cache.get(entry.executor.id); rolCeza(entry.executor.id, "jail"); newMember.roles.set(oldMember.roles.cache.map(x => x.id)); 87 | if(settings.YetkiKorumaLog) { roleGuard.channels.cache.get(settings.YetkiKorumaLog).send(new MessageEmbed().setAuthor(`İzinsiz Rol Verildi`, newMember.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Birisine Rol Verdi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Kullanıcı: **${newMember}** | \` ${newMember.id} \`\n\n❯ İşlem: \` Rol Vermek \` | ❯ Ceza: \` Jail'a Atıldı \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}}); 88 | 89 | // KANAL KORUMA \\ 90 | 91 | channelGuard.on("channelDelete", async channel => { 92 | let entry = await channel.guild.fetchAuditLogs({type: 'CHANNEL_DELETE'}).then(audit => audit.entries.first()); 93 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 94 | const yetkili = await channel.guild.members.cache.get(entry.executor.id); kanalCeza(entry.executor.id, "jail"); await kanalCeza(entry.executor.id, "ban"); 95 | await channel.clone({ reason: "Silinen Kanal Geri Açıldı" }).then(async kanal => {if (channel.parentID != null) await kanal.setParent(channel.parentID); await kanal.setPosition(channel.position); if (channel.type == "category") await channel.guild.channels.cache.filter(k => k.parentID == channel.id).forEach(x => x.setParent(kanal.id))}); 96 | if(settings.KanalSilmeLog) { channelGuard.channels.cache.get(settings.KanalSilmeLog).send(new MessageEmbed().setAuthor(`İzinsiz Kanal Silindi`, channel.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Kanal Sildi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Kanal: **${channel.name}** | \` ${channel.id} \`\n\n❯ İşlem: \` Kanal Silmek \` | ❯ Ceza: \` Yasaklama \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))}}); 97 | 98 | channelGuard.on("channelCreate", async channel => { 99 | let entry = await channel.guild.fetchAuditLogs({type: 'CHANNEL_CREATE'}).then(audit => audit.entries.first()); 100 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 101 | const yetkili = await channel.guild.members.cache.get(entry.executor.id); kanalCeza(entry.executor.id, "jail"); 102 | channel.delete({reason: `${yetkili.id} idli kullanıcı izinsiz kanal açtı sildim.`}) 103 | if(settings.KanalAçmaLog) { channelGuard.channels.cache.get(settings.KanalAçmaLog).send(new MessageEmbed().setAuthor(`İzinsiz Kanal Açıldı`, channel.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Kanal Açtı !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Kanal: **${channel.name}** | \` ${channel.id} \`\n\n❯ İşlem: \` Kanal Açmak \` | ❯ Ceza: \` Yasaklama \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))} else if(!GuardLog) {}}); 104 | 105 | channelGuard.on("channelUpdate", async (oldChannel, newChannel) => { 106 | let entry = await newChannel.guild.fetchAuditLogs({type: 'CHANNEL_UPDATE'}).then(audit => audit.entries.first()); 107 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 108 | const yetkili = await newChannel.guild.members.cache.get(entry.executor.id); kanalCeza(entry.executor.id, "jail"); 109 | if (newChannel.type !== "category" && newChannel.parentID !== oldChannel.parentID) newChannel.setParent(oldChannel.parentID); 110 | if (newChannel.type === "category") {newChannel.edit({name: oldChannel.name})} else if (newChannel.type === "text") {newChannel.edit({name: oldChannel.name, topic: oldChannel.topic, nsfw: oldChannel.nsfw, rateLimitPerUser: oldChannel.rateLimitPerUser})} else if (newChannel.type === "voice") {newChannel.edit({name: oldChannel.name, bitrate: oldChannel.bitrate, userLimit: oldChannel.userLimit,})}; oldChannel.permissionOverwrites.forEach(perm => {let thisPermOverwrites = {}; perm.allow.toArray().forEach(p => {thisPermOverwrites[p] = true;}); perm.deny.toArray().forEach(p => {thisPermOverwrites[p] = false;}); newChannel.createOverwrite(perm.id, thisPermOverwrites)}); 111 | if(settings.KanalGüncellemeLog) { channelGuard.channels.cache.get(settings.KanalGüncellemeLog).send(new MessageEmbed().setAuthor(`İzinsiz Kanal Güncellendi`, newChannel.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Kanal Güncelledi !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Kanal: **${newChannel.name}** | \` ${newChannel.id} \`\n\n❯ İşlem: \` Kanal Güncellemek \` | ❯ Ceza: \` Yasaklama \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))} else if(!GuardLog) {}}); 112 | 113 | channelGuard.on("webhookUpdate", async channel => { 114 | let entry = await channel.guild.fetchAuditLogs({type: 'WEBHOOK_CREATE'}).then(audit => audit.entries.first()); 115 | if(!entry || !entry.executor || settings.OwnerID.includes(entry.executor.id) || settings.Whitelist.includes(entry.executor.id) || settings.Bots.includes(entry.executor.id) || Date.now()-entry.createdTimestamp > 10000) return; 116 | const yetkili = await channel.guild.members.cache.get(entry.executor.id); kanalCeza(entry.executor.id, "jail"); 117 | const webhooklar = await channel.fetchWebhooks(); await webhooklar.map(x => x.delete({reason: "İzinsiz webhook açıldığı için silindi."})) 118 | if(settings.KanalWebhookLog) { channelGuard.channels.cache.get(settings.KanalWebhookLog).send(new MessageEmbed().setAuthor(`İzinsiz Webhook Açıldı`, channel.guild.iconURL({dynamic:true})).setDescription(`**${yetkili} Yetkilisi Sunucudan Bir Webkhook Açtı !**\n\n❯ Yetkili: ${yetkili} | \` ${yetkili.id} \`\n❯ Webhook Açılan Kanal: **${channel.name}** | \` ${channel.id} \`\n\n❯ İşlem: \` Webhııj Açmak \` | ❯ Ceza: \` Jail'a Atıldı \``).setFooter(`❯ Tarih: ${moment(+Date.now()).format(`Do MMMM YYYY | HH:mm`)}`).setColor(`#73b8e7`))} else if(!GuardLog) {}}); 119 | 120 | 121 | serverGuard.on('ready', async() => {serverGuard.user.setPresence({ activity: { name: settings.statusMessage }, status: settings.statusCase }); if (settings.VoiceID && serverGuard.channels.cache.has(settings.VoiceID)) serverGuard.channels.cache.get(settings.VoiceID).join().catch(); console.log(`Sunucu Guardına ses-durum bağlandı.`)}) 122 | roleGuard.on('ready', async() => {roleGuard.user.setPresence({ activity: { name: settings.statusMessage }, status: settings.statusCase }); if (settings.VoiceID && roleGuard.channels.cache.has(settings.VoiceID)) roleGuard.channels.cache.get(settings.VoiceID).join().catch(); console.log(`Rol Guardına ses-durum bağlandı.`)}) 123 | channelGuard.on('ready', async() => {channelGuard.user.setPresence({ activity: { name: settings.statusMessage }, status: settings.statusCase }); if (settings.VoiceID && channelGuard.channels.cache.has(settings.VoiceID)) channelGuard.channels.cache.get(settings.VoiceID).join().catch(); console.log(`Kanal Guardına ses-durum bağlandı.`)}) 124 | 125 | serverGuard.login(settings.SunucuGuardToken).then(console.log(`Sunucu Korunuyor.`)).catch(err => console.error('API bağlanamadı işte hata sebebi: ' + err)); 126 | roleGuard.login(settings.RolGuardToken).then(console.log(`Roller Korunuyor.`)).catch(err => console.error('API bağlanamadı işte hata sebebi: ' + err)); 127 | channelGuard.login(settings.KanalGuardToken).then(console.log(`Kanallar Korunuyor.`)).catch(err => console.error('API bağlanamadı işte hata sebebi: ' + err)); --------------------------------------------------------------------------------