JohnTomah

Untitled

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