Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let anti = JSON.parse(fs.readFileSync("./antigreff.json", "UTF8"));
- let config = JSON.parse(fs.readFileSync("./config.json", "UTF8"));
- client.on("message", message => {
- if (!message.channel.guild) return;
- let user = anti[message.guild.id + message.author.id]
- let num = message.content.split(" ").slice(2).join(" ");
- if (!anti[message.guild.id + message.author.id]) anti[message.guild.id + message.author.id] = {
- actions: 0
- }
- if (!config[message.guild.id]) config[message.guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3,
- time: 30
- }
- if (message.content.startsWith(prefix + "settings limits")) {
- if (!message.member.hasPermission('MANAGE_GUILD')) return;
- if (message.content.startsWith(prefix + "settings limitsban")) {
- if (!num) return message.channel.send("**? | أرسل رقم ! **");
- if (isNaN(num)) return message.channel.send("**? | أرقام فقط ! **");
- config[message.guild.id].banLimit = num;
- message.channel.send(`**? | تم التغيير اِلي : ${config[message.guild.id].banLimit} **`)
- }
- if (message.content.startsWith(prefix + "settings limitskick")) {
- if (!num) return message.channel.send("**? | أرسل رقم ! **");
- if (isNaN(num)) return message.channel.send("**? | أرقام فقط ! **");
- config[message.guild.id].kickLimits = num;
- message.channel.send(`**? | تم التغيير اِلي : ${config[message.guild.id].kickLimits}**`)
- }
- if (message.content.startsWith(prefix + "settings limitsroleD")) {
- if (!num) return message.channel.send("**? | أرسل رقم ! **");
- if (isNaN(num)) return message.channel.send("**? | أرقام فقط ! **");
- config[message.guild.id].roleDelLimit = num;
- message.channel.send(`**? | تم التغيير اِلي : ${config[message.guild.id].roleDelLimit}**`)
- }
- if (message.content.startsWith(prefix + "settings limitsroleC")) {
- if (!num) return message.channel.send("**? | أرسل رقم ! **");
- if (isNaN(num)) return message.channel.send("**? | أرقام فقط ! **");
- config[message.guild.id].roleCrLimits = num;
- message.channel.send(`**? | تم التغيير اِلي : ${config[message.guild.id].roleCrLimits}**`)
- }
- if (message.content.startsWith(prefix + "settings limitschannelD")) {
- if (!num) return message.channel.send("**? | أرسل رقم ! **");
- if (isNaN(num)) return message.channel.send("**? | أرقام فقط ! **");
- config[message.guild.id].chaDelLimit = num;
- message.channel.send(`**? | تم التغيير اِلي : ${config[message.guild.id].chaDelLimit}**`)
- }
- if (message.content.startsWith(prefix + "settings limitstime")) {
- if (!num) return message.channel.send("**? | أرسل رقم ! **");
- if (isNaN(num)) return message.channel.send("**? | أرقام فقط ! **");
- config[message.guild.id].time = num;
- message.channel.send(`**? | تم التغيير اِلي : ${config[message.guild.id].time}**`)
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- });
- client.on("channelDelete", async channel => {
- const entry1 = await channel.guild.fetchAuditLogs({
- type: 'CHANNEL_DELETE'
- }).then(audit => audit.entries.first())
- console.log(entry1.executor.username)
- const entry = entry1.executor
- if (!config[channel.guild.id]) config[channel.guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3
- }
- if (!anti[channel.guild.id + entry.id]) {
- anti[channel.guild.id + entry.id] = {
- actions: 1
- }
- setTimeout(() => {
- anti[channel.guild.id + entry.id].actions = "0"
- }, config[channel.guild.id].time * 1000)
- } else {
- anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
- console.log("TETS");
- setTimeout(() => {
- anti[channel.guild.id + entry.id].actions = "0"
- }, config[channel.guild.id].time * 1000)
- if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].chaDelLimit) {
- channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**? | ${entry.username} قام بمسح الكثير من الرومات **`))
- anti[channel.guild.id + entry.id].actions = "0"
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- });
- client.on("roleDelete", async channel => {
- const entry1 = await channel.guild.fetchAuditLogs({
- type: 'ROLE_DELETE'
- }).then(audit => audit.entries.first())
- console.log(entry1.executor.username)
- const entry = entry1.executor
- if (!config[channel.guild.id]) config[channel.guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3
- }
- if (!anti[channel.guild.id + entry.id]) {
- anti[channel.guild.id + entry.id] = {
- actions: 1
- }
- setTimeout(() => {
- anti[channel.guild.id + entry.id].actions = "0"
- }, config[channel.guild.id].time * 1000)
- } else {
- anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
- console.log("TETS");
- setTimeout(() => {
- anti[channel.guild.id + entry.id].actions = "0"
- }, config[channel.guild.id].time * 1000)
- if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleDelLimit) {
- channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**? | ${entry.username} قام بمسح الكثير من الرتب **`))
- anti[channel.guild.id + entry.id].actions = "0"
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- });
- client.on("roleCreate", async channel => {
- const entry1 = await channel.guild.fetchAuditLogs({
- type: 'ROLE_CREATE'
- }).then(audit => audit.entries.first())
- console.log(entry1.executor.username)
- const entry = entry1.executor
- if (!config[channel.guild.id]) config[channel.guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3
- }
- if (!anti[channel.guild.id + entry.id]) {
- anti[channel.guild.id + entry.id] = {
- actions: 1
- }
- setTimeout(() => {
- anti[channel.guild.id + entry.id].actions = "0"
- }, config[channel.guild.id].time * 1000)
- } else {
- anti[channel.guild.id + entry.id].actions = Math.floor(anti[channel.guild.id + entry.id].actions + 1)
- console.log("TETS");
- setTimeout(() => {
- anti[channel.guild.id + entry.id].actions = "0"
- }, config[channel.guild.id].time * 1000)
- if (anti[channel.guild.id + entry.id].actions >= config[channel.guild.id].roleCrLimits) {
- channel.guild.members.get(entry.id).ban().catch(e => channel.guild.owner.send(`**? | ${entry.username} قام بأنشاء الكثير من الرتب **`))
- anti[channel.guild.id + entry.id].actions = "0"
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- });
- client.on("guildBanAdd", async (guild, user) => {
- const entry1 = await channel.guild.fetchAuditLogs({
- type: 'MEMBER_BAN_ADD'
- }).then(audit => audit.entries.first())
- console.log(entry1.executor.username)
- const entry = entry1.executor
- if (!config[guild.id]) config[guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3
- }
- if (!anti[guild.id + entry.id]) {
- anti[guild.id + entry.id] = {
- actions: 1
- }
- setTimeout(() => {
- anti[guild.id + entry.id].actions = "0"
- }, config[guild.id].time * 1000)
- } else {
- anti[guild.id + entry.id].actions = Math.floor(anti[guild.id + entry.id].actions + 1)
- console.log("TETS");
- setTimeout(() => {
- anti[guild.id + entry.id].actions = "0"
- }, config[guild.id].time * 1000)
- if (anti[guild.id + entry.id].actions >= config[guild.id].banLimit) {
- channel.members.get(entry.id).ban().catch(e => channel.owner.send(`**? | ${entry.username} حاول حظر جميع الأعضاء **`))
- anti[guild.id + entry.id].actions = "0"
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- });
- client.on("guildKickAdd", async (guild, user) => {
- const entry1 = await channel.fetchAuditLogs({
- type: 'MEMBER_KICK'
- }).then(audit => audit.entries.first())
- console.log(entry1.executor.username)
- const entry = entry1.executor
- if (!config[guild.id]) config[guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3
- }
- if (!anti[guild.id + entry.id]) {
- anti[guild.id + entry.id] = {
- actions: 1
- }
- setTimeout(() => {
- anti[guild.id + entry.id].actions = "0"
- }, config[guild.id].time * 1000)
- } else {
- anti[guild.id + entry.id].actions = Math.floor(anti[guild.id + entry.id].actions + 1)
- console.log("TETS");
- setTimeout(() => {
- anti[guild.id + entry.id].actions = "0"
- }, config[guild.id].time * 1000)
- if (anti[guild.id + entry.id].actions >= config[guild.id].banLimit) {
- channel.members.get(entry.id).ban().catch(e => channel.owner.send(`**? | ${entry.username} حاول حظر جميع الأعضاء **`))
- anti[guild.id + entry.id].actions = "0"
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- });
- 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;
- if (!config[member.guild.id]) config[guild.id] = {
- banLimit: 3,
- chaDelLimit: 3,
- roleDelLimit: 3,
- kickLimits: 3,
- roleCrLimits: 3
- }
- if (!anti[member.guild.id + entry.id]) {
- anti[member.guild.id + entry.id] = {
- actions: 1
- }
- setTimeout(() => {
- anti[member.guild.id + entry.id].actions = "0"
- }, config[member.guild.id].time * 1000)
- } else {
- anti[member.guild.id + entry.id].actions = Math.floor(anti[member.guild.id + entry.id].actions + 1)
- console.log("TETS");
- setTimeout(() => {
- anti[member.guild.id + entry.id].actions = "0"
- }, config[member.guild.id].time * 1000)
- if (anti[member.guild.id + entry.id].actions >= config[member.guild.id].kickLimits) {
- member.members.get(entry.id).ban().catch(e => member.owner.send(`**? | ${entry.username} حاول حظر جميع الأعضاء **`))
- anti[member.guild.id + entry.id].actions = "0"
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- }
- fs.writeFile("./config.json", JSON.stringify(config, null, 2), function (e) {
- if (e) throw e;
- });
- fs.writeFile("./antigreff.json", JSON.stringify(anti, null, 2), function (e) {
- if (e) throw e;
- });
- }
- })
- const members = JSON.parse(fs.readFileSync("./members.json")) || {};
- client.on('ready', () => {
- console.log(`Logged in as ${client.user.tag}!`);
- client.guilds.forEach(g=> !members[g.id] ? members[g.id] = {} : null)
- });
- client.on("guildMemberRemove", member=>{
- let roles = [];
- member.roles.forEach(r=> roles.push(r.id));
- members[member.guild.id][member.id] = roles;
- saveChanges();
- });
- client.on("guildMemberAdd", member=> {
- if(members[member.guild.id][member.id] !== undefined){
- member.addRoles(members[member.guild.id][member.id], "Returning roles after leaving");
- members[member.guild.id][member.id] = [];
- };
- saveChanges();
- });
- function saveChanges(){
- fs.writeFileSync("./members.json", JSON.stringify(members, null, 4));
- };
- const sug = JSON.parse(fs.readFileSync('./sug.json', 'utf8'));
- // ? , ?
- client.on('message', message => {
- if (!message.channel.guild) return;
- let room = message.content.split(" ").slice(1);
- let findroom = message.guild.channels.find(x => x.name === `${room}`)
- if (message.content.startsWith(prefix + "setSug")) {
- if (!message.channel.guild) return;
- if (!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send(`** | Don\'t have perms.**`);
- if (!room) return message.channel.send(`** | Please type the channel name.**`)
- if (!findroom) return message.channel.send(`** | Can\'t found this channel.**`)
- let embed = new Discord.RichEmbed()
- .addField(`? Channel:`, `? \`${room}\`.`)
- .addField(`? Requested By:`, `? \`${message.author}\``)
- .setThumbnail(message.author.avatarURL)
- .setFooter(`${client.user.username}`)
- message.channel.sendEmbed(embed)
- sug[message.guild.id] = {
- channel: room,
- }
- fs.writeFile("./sug.json", JSON.stringify(sug), (err) => {
- if (err) console.error(err)
- })
- client.on('message', message => {
- // ? , ?
- if (message.content.startsWith(`sug`)) {
- if (!message.channel.guild) return;
- let suggest = message.content.split(" ").slice(1);
- if (!suggest) return message.reply(`** | Please type the suggest.**`)
- let findchannel = (message.guild.channels.find(x => x.name === `${sug[message.guild.id].channel}`))
- if (!findchannel) return message.channel.send(`** | Error: \`Can\'t find the suggestions room.**`)
- message.channel.send(`**| Thanks for your suggest.**`)
- let sugembed = new Discord.RichEmbed()
- .setTitle('? New suggest:')
- .addField('? Suggest By:', `? \`${message.author}\``)
- .addField('? Suggest:', `? \`${suggest}\``)
- .setFooter(client.user.username)
- findchannel.sendEmbed(sugembed)
- .then(function (message) {
- message.react('?')
- message.react('?')
- })
- .catch(err => {
- message.reply(`** | Error: \`Can\'t find the suggestions room.**`)
- console.error(err);
- });
- }
- })
- }
- })
- const rWlc = JSON.parse(fs.readFileSync("./AutoRole.json", "utf8"));
- client.on('message', message => {
- var prefix = "-";//البرفكس
- if(message.channel.type === "dm") return;
- if(message.author.bot) return;
- if(!rWlc[message.guild.id]) rWlc[message.guild.id] = {
- role: "member"
- }
- const channel = rWlc[message.guild.id].role
- if (message.content.startsWith(prefix + "autorole")) {
- if(!message.member.hasPermission(`MANAGE_GUILD`)) return;
- let newrole = message.content.split(' ').slice(1).join(" ")
- if(!newrole) return message.reply(`**${prefix}autorole <role name>**`)
- rWlc[message.guild.id].role = newrole
- message.channel.send(`**${message.guild.name}'s role has been changed to ${newrole}**`);
- }
- fs.writeFile("./AutoRole.json", JSON.stringify(rWlc), function(e){
- if (e) throw e;
- })
- });
- client.on("guildMemberAdd", member => {
- if(!rWlc[member.guild.id]) rWlc[member.guild.id] = {
- role: "member"
- }
- const sRole = rWlc[member.guild.id].role
- let Rrole = member.guild.roles.find('name', sRole);
- member.addRole(Rrole);
- });
- client.on("message", msg => {
- if(msg.content.startsWith(prefix + "infoautorole")){
- var sRole = rWlc[msg.guild.id].role
- let emb = new Discord.RichEmbed()
- .setTitle("**AutoRole معلومات**")
- .setAuthor(msg.guild.name,msg.guild.iconURL)
- .setThumbnail(msg.guild.iconURL)
- .setColor("GREEN")
- .addField("**ايدي السيرفر**", msg.guild.id)
- .addField("**اسم السيرفر**", msg.guild.name)
- .addField("**الرتبه المحددة**", sRole)
- .setFooter(client.user.tag,client.user.avatarURL)
- msg.channel.send(emb)
- }
- });
- let antijoin = JSON.parse(fs.readFileSync('./antijoin.json' , 'utf8'));
- /*يحتاج تعرف بكج const fs = require('fs')
- طبعا لو مو معرف البكج ^
- + تثبت البكج npm i fs
- */
- client.on('message', message => {
- if(message.content.startsWith(prefix + "antijoin on")) {
- if(!message.channel.guild) return message.reply('**This Command Only For Servers**');
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- antijoin[message.guild.id] = {
- onoff: 'On',
- }
- message.channel.send(`**? The AntiJoin Is __????__ !**`)
- fs.writeFile("./antijoin.json", JSON.stringify(antijoin), (err) => {
- if (err) return console.error(err)
- .catch(err => {
- console.error(err);
- });
- });
- }
- })
- client.on('message', message => {
- if(message.content.startsWith(prefix + "antijoin off")) {
- if(!message.channel.guild) return message.reply('**This Command Only For Servers**');
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- antijoin[message.guild.id] = {
- onoff: 'Off',
- }
- message.channel.send(`**? The AntiJoin Is __??????__ !**`)
- fs.writeFile("./antijoin.json", JSON.stringify(antijoin), (err) => {
- if (err) return console.error(err)
- .catch(err => {
- console.error(err);
- });
- });
- }
- })
- client.on('message', message => {
- if (!message.channel.guild) return;
- if(message.content.startsWith(prefix + "setJoin")) {
- let time = message.content.split(" ").slice(1).join(" ");
- if(!message.channel.guild) return message.reply('**This Command Only For Servers**');
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- if (!time) return message.channel.send('Please Type The Account Created Time [Days]');
- let embed = new Discord.RichEmbed()
- .setTitle('**Done The AntiJoin Code Has Been Setup**')
- .addField('Account Create Time:', `${time}.`)
- .addField('Requested By:', `${message.author}`)
- .setThumbnail(message.author.avatarURL)
- .setFooter(`${client.user.username}`)
- message.channel.sendEmbed(embed)
- antijoin[message.guild.id] = {
- created: time,
- onoff: 'On',
- }
- fs.writeFile("./antijoin.json", JSON.stringify(antijoin), (err) => {
- if (err) console.error(err)
- })
- }})
- client.on("guildMemberAdd", async member => {
- if(!antijoin[member.guild.id]) antijoin[member.guild.id] = {
- onoff: 'Off'
- }
- if(antijoin[member.guild.id].onoff === 'Off') return;
- if(!member.user.bot) return;
- let accounttime = `${antijoin[member.guild.id].created}`
- let moment2 = require('moment-duration-format'),
- moment = require("moment"),
- date = moment.duration(new Date() - member.user.createdAt).format("d");
- if(date < accounttime) {
- member.ban(`Member account age is lower than ${antijoin[member.guild.id].created} days.`)
- }
- });
Add Comment
Please, Sign In to add comment