Advertisement
_THE_SUPER_PVP_

Untitled

Feb 21st, 2019
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const fs = require('fs'); // npm i fs
  2. const ms = require('ms'); // npm i ms
  3. const cool = [];
  4. client.on('message',async message => {
  5.   if(message.author.bot) return;
  6.   if(message.channel.type === 'dm') return;
  7.  
  8.   const args = message.content.split(' ');
  9.   const credits = require('./credits.json');
  10.   const path = './credits.json';
  11.   const mention = message.mentions.users.first() || client.users.get(args[1]) || message.author;
  12.   const mentionn = message.mentions.users.first() || client.users.get(args[1]);
  13.   const author = message.author.id;
  14.   const balance = args[2];
  15.   const daily = Math.floor(Math.random() * 350) + 10;
  16.  
  17.   if(!credits[author]) credits[author] = {credits: 50};
  18.   if(!credits[mention.id]) credits[mention.id] = {credits: 50};
  19.   fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  20.  
  21.  
  22.   if(message.content.startsWith(prefix + "credit")) {
  23.   if(args[0] !== `${prefix}credit` && args[0] !== `${prefix}credits`) return;
  24.  
  25.   if(args[2]) {
  26.     if(isNaN(args[2])) return message.channel.send('**:heavy_multiplication_x:| هذه الخانة يجب ان تتكون من ارقام وليس احرف.**');
  27.     if(mention.bot) return message.channel.send(`**:heavy_multiplication_x:| ${message.content.split(' ')[1]} لم يتم العثور على**`);
  28.     if(mention.id === message.author.id) return message.channel.send('**:heavy_multiplication_x:| لا يمكنك تحويل كردت لنفسك**');
  29.     if(credits[author].credits < balance) return message.channel.send('**:heavy_multiplication_x:| أنت لا تملك هذا القدر من الكردت**');
  30.     var one = Math.floor(Math.random() * 9) + 1;
  31.     var two = Math.floor(Math.random() * 9) + 1;
  32.     var three = Math.floor(Math.random() * 9) + 1;
  33.     var four = Math.floor(Math.random() * 9) + 1;
  34.  
  35.     var number = `${one}${two}${three}${four}`;
  36.    
  37.     message.channel.send(`**:heavy_dollar_sign:| \`${number}\`, أكتب الرقم للأستمرار**`).then(m => {
  38.       message.channel.awaitMessages(m => m.author.id === message.author.id, {max: 1, time: 10000}).then(c => {
  39.         if(c.first().content === number) {
  40.           m.delete();
  41.           message.channel.send(`**:atm:| ${message.author.username}, قام بتحويل \`${balance}\` لـ ${mention}**`);
  42.           credits[author].credits += (-balance);
  43.           credits[mention.id].credits += (+balance);
  44.           fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  45.         } else if(c.first().content !== number) {
  46.           m.delete();
  47.           message.channel.send(`** :money_with_wings: | تم الغاء الإرسال**`);
  48.         }
  49.       });
  50.     });
  51.   }
  52.   if(!args[2]) {
  53.     if(mention.bot) return message.channel.send(`**:heavy_multiplication_x:| ${message.content.split(' ')[1]} لم يتم العثور على**`);
  54.     message.channel.send(`**${mention.username}`+", your :credit_card: balance is **``$"+`${credits[mention.id].credits}`+"``");
  55.   }
  56.  
  57.   }
  58.   if(message.content.startsWith(prefix + "daily")) {
  59.     if(cool.includes(message.author.id)) return message.channel.send(`**:heavy_dollar_sign: | \ , يجب عليك انتظار  يوم لأخذ المبلغ مرة اخرى**`);
  60.     if(mentionn) {
  61.       var one = Math.floor(Math.random() * 9) + 1;
  62.       var two = Math.floor(Math.random() * 9) + 1;
  63.       var three = Math.floor(Math.random() * 9) + 1;
  64.       var four = Math.floor(Math.random() * 9) + 1;
  65.  
  66.       var number = `${one}${two}${three}${four}`;
  67.  
  68.       message.channel.send(`**:atm: | \`${number}\`, قم بكتابة الرقم للأستمرار**`).then(async m => {
  69.         message.channel.awaitMessages(msg => msg.author.id === message.author.id, {max: 1, time: 20000, errors: ['time']}).then(collected => {
  70.           if(collected.first().content === number) {
  71.             m.delete();
  72.             collected.first().delete();
  73.             credits[mentionn.id].credits += (+daily);
  74.             fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  75.  
  76.           message.channel.send(`**:atm: | \`${daily}\`, تم تسليم المبلغ**`);  
  77.           }
  78.           if(collected.first().content !== number) {
  79.             return m.delete();
  80.           }
  81.         });
  82.       });
  83.     } else if(!mentionn) {
  84.       credits[author].credits += (+daily);
  85.       fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  86.  
  87.       message.channel.send(`**:atm: | \`${daily}\`, تم اعطائك المبلغ**`);
  88.     }
  89.     cool.unshift(message.author.id);
  90.  
  91.     setTimeout(() => {
  92.       cool.shift(message.author.id);
  93.       message.author.send("**:atm: | \`Daily\`, يمكنك الحصول على الكردت المجانية الان**").catch();
  94.     }, ms("1d"));
  95.   }
  96. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement