n3k4a

Untitled

Aug 8th, 2019
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.18 KB | None | 0 0
  1. const clans = {};
  2. const system = {};
  3. const level = {};
  4.  
  5.  
  6. client.on('message',async message => {
  7. if(message.author.bot) return;
  8. if(message.channel.type === 'dm') return;
  9.  
  10. let args = message.content.split(' ');
  11. let random = Math.floor(Math.random() * 5) + 2;
  12. let author = message.author;
  13.  
  14. let xpLeft;
  15. let nameClan;
  16. let membersClan = [];
  17. let levelClan = 0;
  18. if(!system[author.id]) system[author.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  19.  
  20. if(!level[author.id]) level[author.id] = {level: 1, xp: 1};
  21.  
  22.  
  23. level[author.id].xp += (+random);
  24. if(level[author.id].xp >= 300) {
  25. if(level[author.id].xp > 300) xpLeft = level[author.id].xp - 300;
  26. level[author.id] = {
  27. level: level[author.id].level + 1,
  28. xp: xpLeft
  29. };
  30.  
  31. }
  32. if(message.content.startsWith(prefix + "clan")) {
  33. if(message.content.split(' ')[0] !== `${prefix}clan`) return;
  34.  
  35.  
  36. if(args[1] && args[1] === 'create') {
  37. //if(level[author.id].level < 10) return message.channel.send('**# يجب أن يكون لديك 10 مستويات لعمل كلان , لتجميع مستويات تفاعل بالشات وسيتم حساب النقاط**');
  38. if(system[author.id].clan !== 'None') return message.channel.send('**# يجب عليك ان تخرج من الكلان الذي أنت به حاليا**');
  39.  
  40. let m = await message.channel.send('**# أكتب أسم الكلان الان**');
  41. let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, { max: 1, time: 20000, errors: ['time']}).then(collected => {
  42. if(collected.first().content.length > 25) return message.channel.send("**# لا يمكنك وضع اسم للكلان يفوق الـ25 حرفا , أعد كابة الأمر**");
  43. if(collected.first().content.includes("None")) return message.channel.send("**# `None`, لا يمكنك وضع هذه الكلمة كأسم للكلان**");
  44. collected.first().delete().catch();
  45. nameClan = collected.first().content;
  46. });
  47.  
  48. m = await m.edit('**# جارى عمل الكلان**');
  49. awaited = await setTimeout(async() => {
  50. let membersArray = {
  51. nameClan: {
  52. array: []
  53. }
  54. };
  55. let members = membersArray.nameClan.array;
  56. members.push(message.author.id);
  57. clans[nameClan] = {
  58. name: nameClan,
  59. createdAt: new Date().toLocaleString(),
  60. level: levelClan,
  61. creator: message.author.id,
  62. members: members,
  63. applylist: [],
  64. admins: []
  65. };
  66.  
  67. system[author.id] = {
  68. clan: nameClan,
  69. joinedAt: new Date().toLocaleString(),
  70. clanLevel: 0,
  71. creator: message.author.id
  72. };
  73.  
  74. m = await m.edit('**# تم عمل الكلان بنجاح**');
  75. }, 2300);
  76.  
  77. }
  78. if(args[1] && args[1] === 'invite') {
  79. if(!system[author.id]) return message.channel.send("**# أنت لست بكلان**");
  80. let clan = system[author.id].clan;
  81. if(system[author.id].clan === 'None') return message.channel.send('**# أنت لست بكلان**');
  82. if(!clans[clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send('**# يجب عليك ان تكون اداري بالكلان**');
  83. let mention = message.mentions.users.first();
  84. if(!mention) return message.channel.send('**# منشن شخص لدعوته للكلان**');
  85. if(clans[clan].members.includes(mention.id)) return message.channel.send("**# هذا العضو بالكلان بالفعل**");
  86. if(clans[clan].members.length === 10) return message.channel.send("**# هذا الكلان وصل للحد الاقصى من الاعضاء يمكنك**");
  87.  
  88. let m = await message.channel.send(`**${mention} # \`${clan}\`, تم دعوتك لدخول الكلان**\n\n - لقبول الدعوة \`نعم\`\n - لرفض الدعوة \`لا\``);
  89. let awaiting = await message.channel.awaitMessages(r => r.author.id === mention.id, {max: 1, time: 50000, errors:['time']}).then(collected => {
  90. collected.first().delete().catch();
  91. if(collected.first().content === 'نعم') {
  92. clans[clan].members.push(mention.id);
  93.  
  94. system[author.id].members += 1;
  95.  
  96.  
  97. system[mention.id] = {
  98. clan: clan,
  99. joinedAt: new Date().toLocaleString(),
  100. clanLevel: 0,
  101. creator: clans[clan].creator
  102. };
  103.  
  104. message.channel.send(`**${message.author} # تم قبول الدعوة**`);
  105. }
  106. if(collected.first().content === 'لا') {
  107. message.channel.send(`**${message.author} # تم رفض الدعوة**`);
  108. } else if(collected.first().content !== 'نعم' && collected.first().content !== 'لا'){
  109. return message.channel.send('**# يجب عليك كتابة `نعم` أو `لا`**');
  110. }
  111. });
  112. }
  113. if(args[1] && args[1] === 'stats') {
  114. if(system[author.id].clan === 'None') return message.channel.send('**# يجب ان تكون بكلان لأستخدام هذا الأمر**');
  115. let clan = system[author.id].clan;
  116. let embed = new Discord.RichEmbed()
  117. .setAuthor(`${message.author.username} || الكلانات`, message.author.avatarURL)
  118. .setDescription(`الكلان || \`${clan.toString()}\``)
  119. embed.addField('» اسم الكلان', clan, true)
  120. embed.addField('» تاريخ عمل الكلان', clans[clan].createdAt, true);
  121. embed.addField('» تاريخ دخول الكلان', system[author.id].joinedAt, true)
  122. embed.addField('» صاحب الكلان', `<@${clans[clan].creator}>`, true);
  123. embed.addField('» لفل الكلان', clans[clan].level, true);
  124. embed.addField('» عدد اعضاء الكلان', clans[clan].members.length, true);
  125. embed.addField('» عدد التقديمات للكلان', clans[clan].applylist.length, true);
  126. embed.addField('» عدد الادمنية بالكلان', clans[clan].admins.length, true);
  127. embed.addField('» اعضاء الكلان', `${prefix}clan list || يظهرلك رسالة بها اعضاء الكلان`);
  128. message.channel.send(embed);
  129.  
  130. }
  131. if(args[1] && args[1] === 'join') {
  132. let clanName = message.content.split(' ').slice(2).join(" ");
  133. if(system[author.id].clan !== 'None') return message.channel.send("**# يجب أن لا تكون بكلان**");
  134. if(!args[2]) return message.channel.send("**# يجب عليك كتابة اسم الكلان**");
  135. if(!clans[clanName]) return message.channel.send("**# هذا الكلان غير موجود**");
  136. if(clans[clanName].applylist.includes(message.author.id)) return message.channel.send("**# لقد قدمت على دخول هذا الكلان مسبقا");
  137.  
  138. clans[clanName].applylist.push(message.author.id);
  139. message.channel.send("**# لقد تم التقديم على دخول الكلان , سيتم الرد عليك من قبل احد ادارة الكلان**");
  140.  
  141. }
  142. if(args[1] && args[1] === 'accept') {
  143. let mention = message.mentions.users.first();
  144. if(system[author.id].clan === 'None') return message.channel.send("**# يجب عليك ان تكون بكلان لأستخدام هذا الأمر**");
  145. if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اداري بالكلان لأستخدام هذا الأمر**");
  146. if(!mention) return message.channel.send("**# يجب عليك منشنة شخص لأستخدام هذا الأمر**");
  147. if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  148.  
  149. if(!clans[system[author.id].clan].applylist.includes(mention.id)) return message.channel.send("**# هذا الشخص لم يقم بالتقديم على دخول الكلان**");
  150.  
  151. clans[system[author.id].clan].applylist.shift(mention.id);
  152. clans[system[author.id].clan].members.push(mention.id);
  153. let clan = system[author.id].clan;
  154.  
  155.  
  156. system[mention.id] = {
  157. clan: clan,
  158. joinedAt: new Date().toLocaleString(),
  159. clanLevel: 0,
  160. creator: clans[clan].creator
  161. };
  162.  
  163.  
  164. mention.send(`**# \`${system[author.id].clan}\`, لقد تم قبولك بالكلان**`).catch();
  165. message.channel.send(`**# \`${mention.username}\`, لقد تم قبول الشخص ودخوله للكلان**`);
  166. }
  167. if(args[1] && args[1] === 'decline') {
  168. let mention = message.mentions.users.first();
  169. if(system[author.id].clan === 'None') return message.channel.send("**# يجب عليك ان تكون بكلان لأستخدام هذا الأمر**");
  170. if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اداري بالكلان لأستخدام هذا الأمر**");
  171. if(!mention) return message.channel.send("**# يجب عليك منشنة شخص لأستخدام هذا الأمر**");
  172. if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  173.  
  174. if(!clans[system[author.id].clan].applylist.includes(message.author.id)) return message.channel.send("**# هذا الشخص لم يقم بالتقديم على دخول الكلان**");
  175.  
  176. clans[system[author.id].clan].applylist.shift(mention.id);
  177.  
  178. system[mention.id] = {
  179. clan: clans[system[author.id].clan],
  180. joinedAt: new Date().toLocaleString(),
  181. clanLevel: 0
  182. };
  183.  
  184.  
  185. mention.send(`**# \`${system[author.id].clan}\`, لقد تم رفض دخولك للكلان**`).catch();
  186. message.channel.send(`**# \`${mention.username}\`, لقد تم رفض دخول الشخص للكلان**`);
  187.  
  188. }
  189. if(args[1] && args[1] === 'promote') {
  190. let mention = message.mentions.users.first();
  191. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  192. if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اونر او ادمن بالكلان لترقية عضو بالكلان**");
  193. if(!mention) return message.channel.send("**# يجب عليك منشنة عضو بالكلان لأعطائه الترقية**");
  194. if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  195.  
  196. if(system[mention.id].clan === 'None') return message.channel.send("**# هذا الشخص ليس بكلان**");
  197. if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
  198. if(clans[system[author.id].clan].admins.includes(mention.id)) return message.channel.send("**# هذا العضو لديه ادمن بالفعل**");
  199. if(mention.id === message.author.id) return message.channel.send("**# لا يمكنك اعطاء نفسك ترقية**");
  200.  
  201. clans[system[author.id].clan].admins.push(mention.id);
  202.  
  203.  
  204. mention.send(`**# \`${system[author.id].clan}\`, لقد تم ترقيتك الى ادمن**`).catch();
  205. message.channel.send(`**# \`${mention.username}\`, لقد تم ترقية العضو الى رتبة ادمن**`);
  206. }
  207. if(args[1] && args[1] === 'demote') {
  208. let mention = message.mentions.users.first();
  209. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  210. if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# هذا الأمر لضاحب الكلان فقط**");
  211. if(!mention) return message.channel.send("**# يجب عليك منشنة عضو بالكلان لأعطائه الترقية**");
  212. if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  213.  
  214. if(system[mention.id].clan === 'None') return message.channel.send("**# هذا الشخص ليس بكلان**");
  215. if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
  216. if(!clans[system[author.id].clan].admins.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس ادمن بالكلان**");
  217. if(mention.id === message.author.id) return message.channel.send("**# لا يمكنك اعطاء نفسك ترقية**");
  218.  
  219. clans[system[author.id].clan].admins.shift(mention.id);
  220.  
  221. mention.send(`**# \`${system[author.id].clan}\`, لقد تم ازالتك من منصب الادمن**`).catch();
  222. message.channel.send(`**# \`${mention.username}\`, لقد تم ازالة الادمنية من العضو**`);
  223. }
  224. if(args[1] && args[1] === 'rename') {
  225. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  226. let newName;
  227. let oldName = clans[system[author.id].clan];
  228. if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# هذا الأمر مخصص لصاحب الكلان فقط**");
  229. if(!args[2]) return message.channel.send("**# يجب عليك تحديد اسم الكلان**");
  230.  
  231. let c = message.content.split(' ').slice(2).join(" ");
  232. newName = c;
  233. let clanInfo = clans[system[author.id].clan];
  234. let m = await message.channel.send(`**# \`${c}\`, هل أنت متأكد من تغيير اسم الكلان \n\n - للتأكيد \`نعم\`\n - للرفض \`لا\`**`);
  235. let awaiting = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 20000, errors: ['time']}).then(c => {
  236. let collected = c.first();
  237. collected.delete().catch();
  238. m.delete().catch();
  239. if(collected.content === 'نعم') {
  240. clans[newName] = {
  241. name: newName,
  242. createdAt: clanInfo.createdAt,
  243. level: clanInfo.level,
  244. creator: clanInfo.creator,
  245. members: clanInfo.members,
  246. applylist: clanInfo.applylist,
  247. admins: clanInfo.admins
  248. };
  249. clans[system[author.id].clan] = undefined;
  250.  
  251. system[author.id].clan = newName;
  252.  
  253.  
  254. message.channel.send("**# جارى تغيير الاسم**");
  255. message.channel.send("**# تم تغيير اسم الكلان بنجاح**");
  256.  
  257. } else if(collected.content === 'لا') {
  258. message.channel.send(`**# \`${newName}\`, تم الغاء تغيير اسم الكلان**`);
  259.  
  260. } else if(collected.first().content !== 'نعم' && collected.first().content !== 'لا'){
  261. return message.channel.send('**# يجب عليك كتابة `نعم` أو `لا`**')
  262. }
  263. });
  264. }
  265. if(args[1] && args[1] === 'list') {
  266. if(system[author.id].clan === 'None') return message.channel.send("**# يجب عليك ان تكون بكلان لأستخدام هذا الأمر**");
  267. let clan = clans[system[author.id].clan];
  268. let members = Array.from(clan.members);
  269. let admins = Array.from(clan.admins);
  270. let applylist = Array.from(clan.applylist);
  271. let i = 1;
  272. let o = 1;
  273.  
  274. let embed = new Discord.RichEmbed();
  275. embed.setAuthor(`${message.author.username} || ${clan.name}`, message.author.avatarURL);
  276. embed.addField("# Members", members.map(r => `\`${i++}.\` **|| <@${r}>**`).join('\n') || `\`1.\` **|| None**`, true);
  277. embed.addField('# Admins', admins.map(r => `\`${o++}.\` **|| <@${r}>**`).join('\n') || `\`1.\` **|| None**`, true);
  278. embed.addField('# Apply', applylist.map(r => `\`${o++}.\` **|| <@${r}>**`).join('\n') || `\`1.\` **|| None**`, true);
  279. embed.addField('# Owner', `\`1.\` **|| <@${clan.creator}>**`, true);
  280. message.channel.send(embed);
  281. }
  282. if(args[1] && args[1] === 'leave') {
  283. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  284. let m = await message.channel.send("**# هل انت متأكد انك تريد الخروج من الكلان \n\n - للتأكيد \`نعم\`\n - للألغاء \`لا\`**");
  285. let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 20000, errors:['time']}).then(c => {
  286. let collected = c.first();
  287. if(collected.content === 'نعم') {
  288. clans[system[author.id].clan].members.shift(author.id);
  289.  
  290. system[author.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  291.  
  292.  
  293. message.channel.send("**# لقد غادرت الكلان**");
  294. } else if(collected.content === 'لا') {
  295. message.channel.send("**# تم الغاء الخروج من الكلان**");
  296. } else if(collected.content !== 'نعم' && collected.content === 'لا') {
  297. message.channel.send('**# يجب عليك كتابة `نعم` أو `لا`**');
  298. }
  299. });
  300. }
  301. if(args[1] && args[1] === 'kick') {
  302. let mention = message.mentions.users.first();
  303. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  304. if(!clans[system[author.id].clan].admins.includes(message.author.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب عليك ان تكون اونر او ادمن بالكلان لأستخدام هذا الامر**");
  305. if(!mention) return message.channel.send("**# يجب عليك منشنة عضو بالكلان لطرده**");
  306. if(!system[mention.id]) system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  307.  
  308. if(system[mention.id].clan === 'None') return message.channel.send("**# هذا الشخص ليس بكلان**");
  309. if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
  310. if(clans[system[author.id].clan].admins.includes(mention.id) && clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# هذا العضو لديه ادمن**");
  311. if(mention.id === message.author.id) return message.channel.send("**# لا يمكنك طرد نفسك**");
  312.  
  313. let index = clans[system[author.id].clan].members.indexOf(mention.id);
  314. let index2 = clans[system[author.id].clan].admins.indexOf(mention.id) || "";
  315. clans[system[author.id].clan].members.splice(index, 1);
  316. if(clans[system[author.id].clan].admins.includes(mention.id)) clans[system[author.id].clan].admins.splice(index2, 1);
  317.  
  318. system[mention.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  319.  
  320.  
  321. message.channel.send(`**# \`${mention.username}\`, تم طرد الشخص من الكلان**`);
  322. mention.send(`**# \`${system[author.id].clan}\`, لقد تم طردك من الكلان**`).catch();
  323. }
  324. if(args[1] && args[1] === 'ownership') {
  325. let mention = message.mentions.users.first();
  326. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  327. if(!mention) return message.channel.send("**# يجب عليك منشنة شخص لتسليمه الأونر**");
  328. if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب أن تكون صاحب الكلان لأستخدام هذا الأمر**");
  329. if(!clans[system[author.id].clan].members.includes(mention.id)) return message.channel.send("**# هذا الشخص ليس بالكلان**");
  330. let o = Math.floor(Math.random() * 8) + 1;
  331. let t = Math.floor(Math.random() * 8) + 1;
  332. let th = Math.floor(Math.random() * 8) + 1;
  333. let f = Math.floor(Math.random() * 8) + 1;
  334. let number = `${o}${t}${th}${f}`;
  335.  
  336. message.author.send(`- \`${number}\`, أكتب هذا الرقم بالشات للأستمرار`).catch(e => {
  337. return message.channel.send(`**# يجب عليك فتح خاصك لأستخدام هذا الأمر**`);
  338. });
  339.  
  340. let m = await message.channel.send("**# تم ارسال رقم التكملة بالخاص .. يجب عليك كتابة الرقم بالشات للأستمرار**");
  341. let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 10000, errors:['time']}).then(c => {
  342. let collected = c.first();
  343.  
  344. if(collected.content === number) {
  345. clans[system[author.id].clan].creator = mention.id;
  346.  
  347.  
  348. m.delete();
  349. message.channel.send(`**# \`${mention.username}\`, تم تحويل اونر الكلان للشخص**`);
  350. } else
  351. if(collected.content !== number) {
  352. m.delete();
  353. }
  354. });
  355. }
  356. if(args[1] && args[1] === 'disband') {
  357. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  358. if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب أن تكون صاحب الكلان لأستخدام هذا الأمر**");
  359. let o = Math.floor(Math.random() * 8) + 1;
  360. let t = Math.floor(Math.random() * 8) + 1;
  361. let th = Math.floor(Math.random() * 8) + 1;
  362. let f = Math.floor(Math.random() * 8) + 1;
  363. let fi = Math.floor(Math.random() * 8) + 1;
  364. let number = `${o}${t}${th}${f}${fi}`;
  365.  
  366. message.author.send(`- \`${number}\`, أكتب هذا الرقم بالشات للأستمرار`).catch(e => {
  367. return message.channel.send(`**# يجب عليك فتح خاصك لأستخدام هذا الأمر**`);
  368. });
  369.  
  370. let m = await message.channel.send("**# تم ارسال رقم التكملة بالخاص .. يجب عليك كتابة الرقم بالشات للأستمرار**");
  371. let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 60000, errors:['time']}).then(c => {
  372. let collected = c.first();
  373.  
  374. if(collected.content === number) {
  375. m.delete().catch();
  376. collected.delete().catch();
  377. let name = system[author.id].clan;
  378. let members = clans[system[author.id].clan].members.length;
  379. let cvlMembers = Array.from(clans[name].members);
  380. for(let i = 0; i < cvlMembers.length; i++) {
  381. let g = hero.users.get(cvlMembers[0]);
  382. g.send(`- \`${system[author.id].clan}\`, تم اقفال الكلان`).catch();
  383. system[g.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  384.  
  385.  
  386. cvlMembers.shift();
  387. if(cvlMembers.length <= 0) {
  388. message.channel.send(`- \`${name}\`, تم اقفال الكلان`);
  389.  
  390. system[author.id] = {clan: 'None',joinedAt: new Date().toLocaleString() ,clanLevel: 0};
  391. clans[system[author.id].clan] = undefined;
  392.  
  393. }
  394. }
  395. } else
  396. if(collected.content !== number) {
  397. m.delete();
  398. message.channel.send(`- \`${name}\`, تم الإلغاء`);
  399. }
  400. });
  401. }
  402. if(args && args[1] === 'room') {
  403. if(system[author.id].clan === 'None') return message.channel.send("**# يجب ان تكون بكلان لأستخدام هذا الأمر**");
  404. if(clans[system[author.id].clan].creator !== message.author.id) return message.channel.send("**# يجب أن تكون صاحب الكلان لأستخدام هذا الأمر**");
  405. 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("**# الكلان لديه روم بالفعل**");
  406. let id = '487721170687229977';
  407. let m = await message.channel.send("**# اكتب نوع الروم الان\n\n - `كتابي`\n - `صوتي`**");
  408. let awaited = await message.channel.awaitMessages(r => r.author.id === message.author.id, {max: 1, time: 20000, errors:['time']}).then(c => {
  409. let collected = c.first();
  410. if(collected.content === 'كتابي') {
  411. message.guild.createChannel(system[author.id].clan, 'text').then(c => {
  412. c.setParent(id);
  413. c.overwritePermissions(message.guild.id, {
  414. SEND_MESSAGES: false,
  415. READ_MESSAGES: true,
  416. CONNECT: false,
  417. SPEAK: false
  418. });
  419.  
  420. let newArray = Array.from(clans[system[author.id].clan].members);
  421. for(let i = 0; i < newArray.length; i++) {
  422. c.overwritePermissions(newArray[0], {
  423. SEND_MESSAGES: true,
  424. READ_MESSAGES: true,
  425. CONNECT: true,
  426. SPEAK: true
  427. });
  428.  
  429. newArray.shift();
  430. }
  431. });
  432. m.edit('**# تم عمل الروم**');
  433. } else if(collected.content === 'صوتي') {
  434. message.guild.createChannel(system[author.id].clan, 'voice').then(c => {
  435. c.setParent(id);
  436. c.overwritePermissions(message.guild.id, {
  437. CONNECT: false,
  438. SPEAK: false
  439. });
  440.  
  441. let newArray = Array.from(clans[system[author.id].clan].members);
  442. for(let i = 0; i < newArray.length; i++) {
  443. c.overwritePermissions(newArray[0], {
  444. CONNECT: true,
  445. SPEAK: true
  446. });
  447.  
  448. newArray.shift();
  449. }
  450. });
  451. m.edit('**# تم عمل الروم**');
  452. }
  453. });
  454. }
  455. }
  456. });
Add Comment
Please, Sign In to add comment