Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const clans = {};
- const system = {};
- const level = {};
- client.on('message',async message => {
- if(message.author.bot) return;
- if(message.channel.type === 'dm') return;
- let args = message.content.split(' ');
- let random = Math.floor(Math.random() * 5) + 2;
- let author = message.author;
- let xpLeft;
- let nameClan;
- let membersClan = [];
- let levelClan = 0;
- if(!system[author.id]) system[author.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- if(!level[author.id]) level[author.id] = {level: 1, xp: 1};
- level[author.id].xp += (+random);
- if(level[author.id].xp >= 300) {
- if(level[author.id].xp > 300) xpLeft = level[author.id].xp - 300;
- level[author.id] = {
- level: level[author.id].level + 1,
- xp: xpLeft
- };
- }
- if(message.content.startsWith(prefix + "clan")) {
- if(message.content.split(' ')[0] !== `${prefix}clan`) return;
- if(args[1] && args[1] === 'create') {
- //if(level[author.id].level < 10) return message.channel.send('**# يجب أن يكون لديك 10 مستويات لعمل كلان , لتجميع مستويات تفاعل بالشات وسيتم حساب النقاط**');
- if(system[author.id].clan !== 'None') return message.channel.send('**# يجب عليك ان تخرج من الكلان الذي أنت به حاليا**');
- let m = await message.channel.send('**# أكتب أسم الكلان الان**');
- let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, { max: 1, time: 20000, errors: ['time']}).then(collected => {
- if(collected.first().content.length > 25) return message.channel.send("**# لا يمكنك وضع اسم للكلان يفوق الـ25 حرفا , أعد كابة الأمر**");
- if(collected.first().content.includes("None")) return message.channel.send("**# `None`, لا يمكنك وضع هذه الكلمة كأسم للكلان**");
- collected.first().delete().catch();
- nameClan = collected.first().content;
- });
- m = await m.edit('**# جارى عمل الكلان**');
- awaited = await setTimeout(async() => {
- let membersArray = {
- nameClan: {
- array: []
- }
- };
- let members = membersArray.nameClan.array;
- members.push(message.author.id);
- clans[nameClan] = {
- name: nameClan,
- createdAt: new Date().toLocaleString(),
- level: levelClan,
- creator: message.author.id,
- members: members,
- applylist: [],
- admins: []
- };
- system[author.id] = {
- clan: nameClan,
- joinedAt: new Date().toLocaleString(),
- clanLevel: 0,
- creator: message.author.id
- };
- m = await m.edit('**# تم عمل الكلان بنجاح**');
- }, 2300);
- }
- if(args[1] && args[1] === 'invite') {
- if(!system[author.id]) return message.channel.send("**# أنت لست بكلان**");
- let clan = system[author.id].clan;
- if(system[author.id].clan === 'None') return message.channel.send('**# أنت لست بكلان**');
- if(!clans[clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send('**# يجب عليك ان تكون اداري بالكلان**');
- let mention = message.mentions.users.first();
- if(!mention) return message.channel.send('**# منشن شخص لدعوته للكلان**');
- if(clans[clan].members.includes(mention.id)) return message.channel.send("**# هذا العضو بالكلان بالفعل**");
- if(clans[clan].members.length === 10) return message.channel.send("**# هذا الكلان وصل للحد الاقصى من الاعضاء يمكنك**");
- let m = await message.channel.send(`**${mention} # \`${clan}\`, تم دعوتك لدخول الكلان**\n\n - لقبول الدعوة \`نعم\`\n - لرفض الدعوة \`لا\``);
- let awaiting = await message.channel.awaitMessages(r => r.author.id === mention.id, {max: 1, time: 50000, errors:['time']}).then(collected => {
- collected.first().delete().catch();
- if(collected.first().content === 'نعم') {
- clans[clan].members.push(mention.id);
- system[author.id].members += 1;
- system[mention.id] = {
- clan: clan,
- joinedAt: new Date().toLocaleString(),
- clanLevel: 0,
- creator: clans[clan].creator
- };
- message.channel.send(`**${message.author} # تم قبول الدعوة**`);
- }
- if(collected.first().content === 'لا') {
- message.channel.send(`**${message.author} # تم رفض الدعوة**`);
- } else if(collected.first().content !== 'نعم' && collected.first().content !== 'لا'){
- return message.channel.send('**# يجب عليك كتابة `نعم` أو `لا`**');
- }
- });
- }
- if(args[1] && args[1] === 'stats') {
- if(system[author.id].clan === 'None') return message.channel.send('**# يجب ان تكون بكلان لأستخدام هذا الأمر**');
- let clan = system[author.id].clan;
- let embed = new Discord.RichEmbed()
- .setAuthor(`${message.author.username} || الكلانات`, message.author.avatarURL)
- .setDescription(`الكلان || \`${clan.toString()}\``)
- embed.addField('» اسم الكلان', clan, true)
- embed.addField('» تاريخ عمل الكلان', clans[clan].createdAt, true);
- embed.addField('» تاريخ دخول الكلان', system[author.id].joinedAt, true)
- embed.addField('» صاحب الكلان', `<@${clans[clan].creator}>`, true);
- embed.addField('» لفل الكلان', clans[clan].level, true);
- embed.addField('» عدد اعضاء الكلان', clans[clan].members.length, true);
- embed.addField('» عدد التقديمات للكلان', clans[clan].applylist.length, true);
- embed.addField('» عدد الادمنية بالكلان', clans[clan].admins.length, true);
- embed.addField('» اعضاء الكلان', `${prefix}clan list || يظهرلك رسالة بها اعضاء الكلان`);
- message.channel.send(embed);
- }
- if(args[1] && args[1] === 'join') {
- let clanName = message.content.split(' ').slice(2).join(" ");
- if(system[author.id].clan !== 'None') return message.channel.send("**# يجب أن لا تكون بكلان**");
- if(!args[2]) return message.channel.send("**# يجب عليك كتابة اسم الكلان**");
- if(!clans[clanName]) return message.channel.send("**# هذا الكلان غير موجود**");
- if(clans[clanName].applylist.includes(message.author.id)) return message.channel.send("**# لقد قدمت على دخول هذا الكلان مسبقا");
- clans[clanName].applylist.push(message.author.id);
- message.channel.send("**# لقد تم التقديم على دخول الكلان , سيتم الرد عليك من قبل احد ادارة الكلان**");
- }
- if(args[1] && args[1] === 'accept') {
- let mention = message.mentions.users.first();
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب عليك ان تكون بكلان لأستخدام هذا الأمر**");
- if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اداري بالكلان لأستخدام هذا الأمر**");
- if(!mention) return message.channel.send("**# يجب عليك منشنة شخص لأستخدام هذا الأمر**");
- if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- if(!clans[system[author.id].clan].applylist.includes(mention.id)) return message.channel.send("**# هذا الشخص لم يقم بالتقديم على دخول الكلان**");
- clans[system[author.id].clan].applylist.shift(mention.id);
- clans[system[author.id].clan].members.push(mention.id);
- let clan = system[author.id].clan;
- system[mention.id] = {
- clan: clan,
- joinedAt: new Date().toLocaleString(),
- clanLevel: 0,
- creator: clans[clan].creator
- };
- mention.send(`**# \`${system[author.id].clan}\`, لقد تم قبولك بالكلان**`).catch();
- message.channel.send(`**# \`${mention.username}\`, لقد تم قبول الشخص ودخوله للكلان**`);
- }
- if(args[1] && args[1] === 'decline') {
- let mention = message.mentions.users.first();
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب عليك ان تكون بكلان لأستخدام هذا الأمر**");
- if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اداري بالكلان لأستخدام هذا الأمر**");
- if(!mention) return message.channel.send("**# يجب عليك منشنة شخص لأستخدام هذا الأمر**");
- if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- if(!clans[system[author.id].clan].applylist.includes(message.author.id)) return message.channel.send("**# هذا الشخص لم يقم بالتقديم على دخول الكلان**");
- clans[system[author.id].clan].applylist.shift(mention.id);
- system[mention.id] = {
- clan: clans[system[author.id].clan],
- joinedAt: new Date().toLocaleString(),
- clanLevel: 0
- };
- mention.send(`**# \`${system[author.id].clan}\`, لقد تم رفض دخولك للكلان**`).catch();
- message.channel.send(`**# \`${mention.username}\`, لقد تم رفض دخول الشخص للكلان**`);
- }
- if(args[1] && args[1] === 'promote') {
- let mention = message.mentions.users.first();
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اونر او ادمن بالكلان لترقية عضو بالكلان**");
- if(!mention) return message.channel.send("**# يجب عليك منشنة عضو بالكلان لأعطائه الترقية**");
- if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- if(system[mention.id].clan === 'None') return message.channel.send("**# هذا الشخص ليس بكلان**");
- if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
- if(clans[system[author.id].clan].admins.includes(mention.id)) return message.channel.send("**# هذا العضو لديه ادمن بالفعل**");
- if(mention.id === message.author.id) return message.channel.send("**# لا يمكنك اعطاء نفسك ترقية**");
- clans[system[author.id].clan].admins.push(mention.id);
- mention.send(`**# \`${system[author.id].clan}\`, لقد تم ترقيتك الى ادمن**`).catch();
- message.channel.send(`**# \`${mention.username}\`, لقد تم ترقية العضو الى رتبة ادمن**`);
- }
- if(args[1] && args[1] === 'demote') {
- let mention = message.mentions.users.first();
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# هذا الأمر لضاحب الكلان فقط**");
- if(!mention) return message.channel.send("**# يجب عليك منشنة عضو بالكلان لأعطائه الترقية**");
- if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- if(system[mention.id].clan === 'None') return message.channel.send("**# هذا الشخص ليس بكلان**");
- if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
- if(!clans[system[author.id].clan].admins.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس ادمن بالكلان**");
- if(mention.id === message.author.id) return message.channel.send("**# لا يمكنك اعطاء نفسك ترقية**");
- clans[system[author.id].clan].admins.shift(mention.id);
- mention.send(`**# \`${system[author.id].clan}\`, لقد تم ازالتك من منصب الادمن**`).catch();
- message.channel.send(`**# \`${mention.username}\`, لقد تم ازالة الادمنية من العضو**`);
- }
- if(args[1] && args[1] === 'rename') {
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- let newName;
- let oldName = clans[system[author.id].clan];
- if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# هذا الأمر مخصص لصاحب الكلان فقط**");
- if(!args[2]) return message.channel.send("**# يجب عليك تحديد اسم الكلان**");
- let c = message.content.split(' ').slice(2).join(" ");
- newName = c;
- let clanInfo = clans[system[author.id].clan];
- let m = await message.channel.send(`**# \`${c}\`, هل أنت متأكد من تغيير اسم الكلان \n\n - للتأكيد \`نعم\`\n - للرفض \`لا\`**`);
- let awaiting = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 20000, errors: ['time']}).then(c => {
- let collected = c.first();
- collected.delete().catch();
- m.delete().catch();
- if(collected.content === 'نعم') {
- clans[newName] = {
- name: newName,
- createdAt: clanInfo.createdAt,
- level: clanInfo.level,
- creator: clanInfo.creator,
- members: clanInfo.members,
- applylist: clanInfo.applylist,
- admins: clanInfo.admins
- };
- clans[system[author.id].clan] = undefined;
- system[author.id].clan = newName;
- message.channel.send("**# جارى تغيير الاسم**");
- message.channel.send("**# تم تغيير اسم الكلان بنجاح**");
- } else if(collected.content === 'لا') {
- message.channel.send(`**# \`${newName}\`, تم الغاء تغيير اسم الكلان**`);
- } else if(collected.first().content !== 'نعم' && collected.first().content !== 'لا'){
- return message.channel.send('**# يجب عليك كتابة `نعم` أو `لا`**')
- }
- });
- }
- if(args[1] && args[1] === 'list') {
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب عليك ان تكون بكلان لأستخدام هذا الأمر**");
- let clan = clans[system[author.id].clan];
- let members = Array.from(clan.members);
- let admins = Array.from(clan.admins);
- let applylist = Array.from(clan.applylist);
- let i = 1;
- let o = 1;
- let embed = new Discord.RichEmbed();
- embed.setAuthor(`${message.author.username} || ${clan.name}`, message.author.avatarURL);
- embed.addField("# Members", members.map(r => `\`${i++}.\` **|| <@${r}>**`).join('\n') || `\`1.\` **|| None**`, true);
- embed.addField('# Admins', admins.map(r => `\`${o++}.\` **|| <@${r}>**`).join('\n') || `\`1.\` **|| None**`, true);
- embed.addField('# Apply', applylist.map(r => `\`${o++}.\` **|| <@${r}>**`).join('\n') || `\`1.\` **|| None**`, true);
- embed.addField('# Owner', `\`1.\` **|| <@${clan.creator}>**`, true);
- message.channel.send(embed);
- }
- if(args[1] && args[1] === 'leave') {
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- let m = await message.channel.send("**# هل انت متأكد انك تريد الخروج من الكلان \n\n - للتأكيد \`نعم\`\n - للألغاء \`لا\`**");
- let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 20000, errors:['time']}).then(c => {
- let collected = c.first();
- if(collected.content === 'نعم') {
- clans[system[author.id].clan].members.shift(author.id);
- system[author.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- message.channel.send("**# لقد غادرت الكلان**");
- } else if(collected.content === 'لا') {
- message.channel.send("**# تم الغاء الخروج من الكلان**");
- } else if(collected.content !== 'نعم' && collected.content === 'لا') {
- message.channel.send('**# يجب عليك كتابة `نعم` أو `لا`**');
- }
- });
- }
- if(args[1] && args[1] === 'kick') {
- let mention = message.mentions.users.first();
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اونر او ادمن بالكلان لأستخدام هذا الامر**");
- if(!mention) return message.channel.send("**# يجب عليك منشنة عضو بالكلان لطرده**");
- if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- if(system[mention.id].clan === 'None') return message.channel.send("**# هذا الشخص ليس بكلان**");
- if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
- if(clans[system[author.id].clan].admins.includes(mention.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# هذا العضو لديه ادمن**");
- if(mention.id === message.author.id) return message.channel.send("**# لا يمكنك طرد نفسك**");
- let index = clans[system[author.id].clan].members.indexOf(mention.id);
- let index2 = clans[system[author.id].clan].admins.indexOf(mention.id) || "";
- clans[system[author.id].clan].members.splice(index, 1);
- if(clans[system[author.id].clan].admins.includes(mention.id)) clans[system[author.id].clan].admins.splice(index2, 1);
- system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- message.channel.send(`**# \`${mention.username}\`, تم طرد الشخص من الكلان**`);
- mention.send(`**# \`${system[author.id].clan}\`, لقد تم طردك من الكلان**`).catch();
- }
- if(args[1] && args[1] === 'ownership') {
- let mention = message.mentions.users.first();
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- if(!mention) return message.channel.send("**# يجب عليك منشنة شخص لتسليمه الأونر**");
- if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب أن تكون صاحب الكلان لأستخدام هذا الأمر**");
- if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
- let o = Math.floor(Math.random() * 8) + 1;
- let t = Math.floor(Math.random() * 8) + 1;
- let th = Math.floor(Math.random() * 8) + 1;
- let f = Math.floor(Math.random() * 8) + 1;
- let number = `${o}${t}${th}${f}`;
- message.author.send(`- \`${number}\`, أكتب هذا الرقم بالشات للأستمرار`).catch(e => {
- return message.channel.send(`**# يجب عليك فتح خاصك لأستخدام هذا الأمر**`);
- });
- let m = await message.channel.send("**# تم ارسال رقم التكملة بالخاص .. يجب عليك كتابة الرقم بالشات للأستمرار**");
- let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 10000, errors:['time']}).then(c => {
- let collected = c.first();
- if(collected.content === number) {
- clans[system[author.id].clan].creator = mention.id;
- m.delete();
- message.channel.send(`**# \`${mention.username}\`, تم تحويل اونر الكلان للشخص**`);
- } else
- if(collected.content !== number) {
- m.delete();
- }
- });
- }
- if(args[1] && args[1] === 'disband') {
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب أن تكون صاحب الكلان لأستخدام هذا الأمر**");
- let o = Math.floor(Math.random() * 8) + 1;
- let t = Math.floor(Math.random() * 8) + 1;
- let th = Math.floor(Math.random() * 8) + 1;
- let f = Math.floor(Math.random() * 8) + 1;
- let fi = Math.floor(Math.random() * 8) + 1;
- let number = `${o}${t}${th}${f}${fi}`;
- message.author.send(`- \`${number}\`, أكتب هذا الرقم بالشات للأستمرار`).catch(e => {
- return message.channel.send(`**# يجب عليك فتح خاصك لأستخدام هذا الأمر**`);
- });
- let m = await message.channel.send("**# تم ارسال رقم التكملة بالخاص .. يجب عليك كتابة الرقم بالشات للأستمرار**");
- let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 60000, errors:['time']}).then(c => {
- let collected = c.first();
- if(collected.content === number) {
- m.delete().catch();
- collected.delete().catch();
- let name = system[author.id].clan;
- let members = clans[system[author.id].clan].members.length;
- let cvlMembers = Array.from(clans[name].members);
- for(let i = 0; i < cvlMembers.length; i++) {
- let g = hero.users.get(cvlMembers[0]);
- g.send(`- \`${system[author.id].clan}\`, تم اقفال الكلان`).catch();
- system[g.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- cvlMembers.shift();
- if(cvlMembers.length <= 0) {
- message.channel.send(`- \`${name}\`, تم اقفال الكلان`);
- system[author.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
- clans[system[author.id].clan] = undefined;
- }
- }
- } else
- if(collected.content !== number) {
- m.delete();
- message.channel.send(`- \`${name}\`, تم الإلغاء`);
- }
- });
- }
- if(args && args[1] === 'room') {
- if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
- if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب أن تكون صاحب الكلان لأستخدام هذا الأمر**");
- if(message.guild.channels.find(r => r.name.toLowerCase() === system[author.id].clan && r.type === 'text') || message.guild.channels.find(r => r.name === system[author.id].clan && r.type === 'voice')) return message.channel.send("**# الكلان لديه روم بالفعل**");
- let id = '487721170687229977';
- let m = await message.channel.send("**# اكتب نوع الروم الان\n\n - `كتابي`\n - `صوتي`**");
- let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 20000, errors:['time']}).then(c => {
- let collected = c.first();
- if(collected.content === 'كتابي') {
- message.guild.createChannel(system[author.id].clan, 'text').then(c => {
- c.setParent(id);
- c.overwritePermissions(message.guild.id, {
- SEND_MESSAGES: false,
- READ_MESSAGES: true,
- CONNECT: false,
- SPEAK: false
- });
- let newArray = Array.from(clans[system[author.id].clan].members);
- for(let i = 0; i < newArray.length; i++) {
- c.overwritePermissions(newArray[0], {
- SEND_MESSAGES: true,
- READ_MESSAGES: true,
- CONNECT: true,
- SPEAK: true
- });
- newArray.shift();
- }
- });
- m.edit('**# تم عمل الروم**');
- } else if(collected.content === 'صوتي') {
- message.guild.createChannel(system[author.id].clan, 'voice').then(c => {
- c.setParent(id);
- c.overwritePermissions(message.guild.id, {
- CONNECT: false,
- SPEAK: false
- });
- let newArray = Array.from(clans[system[author.id].clan].members);
- for(let i = 0; i < newArray.length; i++) {
- c.overwritePermissions(newArray[0], {
- CONNECT: true,
- SPEAK: true
- });
- newArray.shift();
- }
- });
- m.edit('**# تم عمل الروم**');
- }
- });
- }
- }
- });
Add Comment
Please, Sign In to add comment