SHARE
TWEET

Buy Vip Role (JS)

gaber-elsayed Dec 8th, 2019 132 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let vipKeys = JSON.parse(fs.readFileSync("./vipKeys.json", "utf8"));
  2. client.on("message", msg=>{
  3. let id = "530062292969062412"; // ايديك
  4. let role = "▪Legend | Seller"; // اسم رتبة الفيب
  5. let Price = 100000; // السعر
  6. let Price2 = Math.floor(Price-(Price*(1/100)));
  7. if(!Price || Price < 1) return;
  8. let cmd = msg.content.split(' ')[0];
  9. if(cmd === `${prefix}buy-Legend`){
  10. if(msg.author.bot) return;
  11. if(!msg.channel.guild) return;
  12. let embedvip = new Discord.RichEmbed()
  13. .setColor("#42f4f4")
  14. .setAuthor(msg.author.username, msg.author.displayAvatarURL)
  15. .setThumbnail(msg.author.avatarURL)
  16. .setTitle("**اختر الطريقة المناسبة لك**")
  17. .addField("ل شراء الفي اي بي لنفسك","🔱",true )
  18. .addField("ل شراء الفي اي بي ك هدية","🎁",true)
  19. .setTimestamp()
  20. .setFooter(client.user.username,client.user.displayAvatarURL);
  21. msg.channel.send(embedvip).then(msgs2 =>{
  22. msgs2.react("🔱").then(()=>{
  23.   msgs2.react("🎁").then(()=>{
  24.     const me = (reaction, user) => reaction.emoji.name === '🔱' && user.id === msg.author.id;
  25.     const gift = (reaction, user) => reaction.emoji.name === '🎁' && user.id === msg.author.id;
  26.     const mec = msgs2.createReactionCollector(me, {time: 120000});
  27.     const giftc = msgs2.createReactionCollector(gift, {time: 120000});
  28. mec.on("collect", r=>{  
  29. msgs2.delete()
  30. if(msg.member.roles.find(r=>r.name == role)) return msg.reply("انت تمتلك الرتبة مسبقًا");
  31. let roleW = msg.guild.roles.find(r=>r.name == role);
  32. if(!roleW) return msg.reply(`البوت مقفل لعدم وجود رتبة ب أسم \`${role}\``)
  33. msg.channel.send(`كردت بروبوت\`${Price}\` لديك 4 دقائق لتحويل
  34. إلى ${msg.guild.members.get(id)}
  35. `).then( msgs =>{
  36. const filter = response => response.author.id == "282859044593598464" && response.mentions._content.includes(`:moneybag: | ${msg.author.username}, has transferred \`$${Price2}\` to ${msg.guild.members.get(id)}`);
  37. msg.channel.awaitMessages(filter, { maxMatches: 1, time: 240000, errors: ['time'] })
  38. .then( collected =>{
  39. msgs.delete()
  40. msg.reply(`تم اعطائك رتبة \`${role}\``);
  41. msg.member.addRole(roleW);
  42. }).catch(e => {});
  43. })})
  44. giftc.on("collect", r=>{
  45.   msgs2.delete()
  46.   let roleW = msg.guild.roles.find(r=>r.name == role);
  47.   if(!roleW) return msg.reply(`البوت مقفل لعدم وجود رتبة ب أسم \`${role}\``)
  48. msg.channel.send(`كردت بروبوت\`${Price}\` لديك 4 دقائق لتحويل
  49. إلى ${msg.guild.members.get(id)}
  50. `).then( msgs =>{
  51.   const filter = response => response.author.id == "282859044593598464" && response.mentions._content.includes(`:moneybag: | ${msg.author.username}, has transferred \`$${Price2}\` to ${msg.guild.members.get(id)}`);
  52.   msg.channel.awaitMessages(filter, { maxMatches: 1, time: 240000, errors: ['time'] })
  53.   .then( collected =>{
  54.   msgs.delete()
  55.   genKey(msg,roleW);
  56.   }).catch(e => {});
  57.   })
  58. })
  59. })})})
  60. ///
  61. }
  62. if(cmd === `${prefix}used`){
  63.   let args = msg.content.split(" ").slice(1)[0];
  64.   if(!args) {  
  65.     let embed = new Discord.RichEmbed()
  66.     .setColor("#42f4f4")
  67.     .setTitle(`:x: - **الرجاء ادخال كود الهدية** \`${prefix}used <Key>\``)
  68.     msg.reply(embed).then( z => z.delete(3000));
  69.     return
  70. }
  71.   let embed = new Discord.RichEmbed()
  72. .setTitle(`**جاري التحقق من الكود**`)
  73. .setColor("#42f4f4")
  74.   msg.reply(embed).then( msgs =>{
  75.   if(vipKeys[args]){
  76.     let hav = msg.member.roles.find(`name`, vipKeys[args].name);
  77.     if(hav){
  78.     let embed = new Discord.RichEmbed()
  79.     .setTitle(`:x: - **انت تمتلك هذه الرتبة مسبقًا**  \`${vipKeys[args].name}\``)
  80.     .setColor("#42f4f4")
  81.     msgs.edit(embed)
  82.     return
  83.     }
  84.     let embed = new Discord.RichEmbed()
  85.     .setTitle(`:tada: - **مبروك تم اعطائك رتبة** \`${vipKeys[args].name}\``)
  86.     .setColor("#42f4f4")
  87.     msgs.edit(embed)
  88.     msg.member.addRole(vipKeys[args]);
  89.     delete vipKeys[args]
  90.     save()
  91.   }else{
  92.     let embed = new Discord.RichEmbed()
  93.     .setTitle(`:x: - **الكود غير صيحيح أو انه مستعمل من قبل**`)
  94.     .setColor("#42f4f4")
  95.     msgs.edit(embed)
  96.   }});
  97. }
  98. });
  99.  
  100. function genKey(msg,role){
  101.   var randomkeys = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  102.   var gift = "";
  103.   for (var y = 0; y < 16; y++) {   ///16
  104.     gift +=  `${randomkeys.charAt(Math.floor(Math.random() * randomkeys.length))}`;
  105.   }
  106.   vipKeys[gift] = role;
  107.   let embed = new Discord.RichEmbed()
  108.   .setColor("#42f4f4")
  109.   .setTitle(`:ok_hand: - **تم ارسآل الكود على الخاص**`);
  110.   msg.reply(embed);
  111.   let embed2= new Discord.RichEmbed()
  112.   .setAuthor(msg.author.username, msg.author.displayAvatarURL)
  113.   .setThumbnail(msg.author.avatarURL)
  114.   .addField("**Key Of Gift**", gift,true)
  115.   .addField("Role",vipKeys[gift].name,true)
  116.   .addField("This Key Made by", msg.author, true)
  117.   .addField("The Room", msg.channel , true)
  118.   .setTimestamp()
  119.   .setFooter(client.user.username,client.user.displayAvatarURL)  
  120.   msg.author.send(embed2);
  121.   save()
  122. }
  123.  
  124. function save(){
  125.   fs.writeFile("./vipKeys.json", JSON.stringify(vipKeys), (err) => {
  126.     if (err) console.log(err)
  127.   });
  128.  
  129. }
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