SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. const arf = JSON.parse(fs.readFileSync("./arf.json", "utf8"));
  3. let emojiss = require("node-emoji");//npm i node-emoji
  4. client.on("message", msg=>{
  5. if(msg.content.startsWith(`${prefix}setRole`)){
  6.     if(!arf[msg.guild.id]) arf[msg.guild.id] = {
  7.         role: "Member"
  8.     }
  9. if(!msg.member.hasPermission("ADMINISTRATOR")) return msg.reply("you don't have permission").then(s => {s.delete(1600);})
  10. msg.reply("منشن الروم الي تبي فيه التفعيل").then(msgs=>{
  11.   const filter = response => response.author.id === msg.author.id;
  12.   msg.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
  13.   .then( collected =>{
  14.     msg.delete();
  15.     let idC = msg.guild.channels.find(c=>c.id == collected.first().mentions.channels.first().id)
  16.     if(!idC) return msgs.edit("لم اجد الروم");
  17.      idC = idC.id;
  18.      msgs.edit(`${msg.author}, ادخل الايموجي الذي تريدة للتفعيل`)
  19. const filter = response => response.author.id === msg.author.id;
  20. msg.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
  21. .then( collected =>{
  22. if(!emojiss.hasEmoji(collected.first().mentions._content)) return msgs.edit("ادخل ايموجي صحيح !");
  23. newemoji = collected.first().mentions._content;
  24. msg.delete();
  25. msgs.edit(`${msg.author}, منشن للرتبة الذي تريدها`)
  26. const filter = response => response.author.id === msg.author.id;
  27. msg.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
  28. .then( collected =>{
  29. let roleW = collected.first().mentions.roles.first()
  30. if(!roleW) {
  31.   let embed = new Discord.RichEmbed()
  32.   .setColor("#42f4f4")
  33.   .setTitle(`:x: - منشن الرتبة `);
  34.   msg.reply(embed).then( z => z.delete(3000)); return
  35. };
  36. let role = msg.guild.roles.find(`name`, roleW.name);
  37. if(!role) {
  38.   let embed = new Discord.RichEmbed()
  39.   .setColor("#42f4f4")
  40.   .setTitle(`:x: - Could't find \`${roleW.name}\` role.`);
  41. msg.reply(embed).then( msgs => msgs.delete(3000));
  42. return
  43. }
  44. roleNew = role;
  45. arf[msg.guild.id].role = roleNew.name
  46. msgs.edit(`${msg.author}, ادخل النص الذي تريدة`)//Toxic Codes
  47. const filter = response => response.author.id === msg.author.id;
  48. msg.channel.awaitMessages(filter, { maxMatches: 1, time: 30000, errors: ['time'] })
  49. .then( collected =>{
  50. stringNew = collected.first().mentions._content;
  51. let channel = msg.guild.channels.get(idC);
  52. if(!channel) {
  53. let embed = new Discord.RichEmbed()
  54. .setColor("#42f4f4")
  55. .setTitle(`:x: - Could't find \`${idC}\` Channel.`);
  56. msg.reply(embed).then( msgs => msgs.delete(3000));
  57. return
  58. }
  59. channel.bulkDelete(100)
  60. channel.send(`@here || @everyone
  61. ${msg.guild.name}© :arrow_down:
  62.  
  63. ${stringNew}
  64. `).then( msgA =>{
  65. msgA.react(newemoji).then(()=>{
  66.     let rolee = arf[msg.guild.id].role
  67.   const Ac = (reaction, user) => reaction.emoji.name === newemoji && !user.bot;
  68.   const Acc = msgA.createReactionCollector(Ac, {time: 120000});
  69.   Acc.on("collect", r=>{
  70.   let member = msg.guild.members.get(r.users.last().id);
  71.   if(!member) return;
  72.   r.remove(member.user);
  73. if(member.roles.find(r=>r.name == rolee)) return;
  74.     member.addRole(roleNew);
  75.   channel.send(`${member.user}, تم تفعيلك`).then(z => z.delete(1500));
  76.   fs.writeFile("./arf.json", JSON.stringify(arf), function(a) {
  77.       if (a) throw a;
  78.   })
  79. })})})
  80. }).catch(e => {console.log(e.message)});
  81. }).catch(e => {console.log(e.message)});
  82. }).catch(e => {console.log(e.message)});
  83. }).catch(e => {console.log(e.message)});
  84. })
  85. }})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top