Advertisement
IxRawan_

sss

Jul 12th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.02 KB | None | 0 0
  1. const ms = rquire('ms')
  2. const cool = [];
  3. client.on('message',async message => {
  4. if(message.author.bot) return;
  5. if(message.channel.type === 'dm') return;
  6.  
  7. const guildid = "595231357873946627"; // ايدي السيرفر الي موجود فيه الروم
  8. const channelid = "599221947569537045"; // ايدي الروم
  9. var prefix = ".";
  10. const args = message.content.split(' ');
  11. const credits = require('./credits.json');
  12. const path = './credits.json';
  13. const mention = message.mentions.users.first() || client.users.get(args[1]) || message.author;
  14. const mentionn = message.mentions.users.first() || client.users.get(args[1]);
  15. const author = message.author.id;
  16. const balance = args[2];
  17. const daily = Math.floor(Math.random() * 350) + 10;
  18.  
  19. if(!credits[author]) credits[author] = {credits: 50};
  20. if(!credits[mention.id]) credits[mention.id] = {credits: 50};
  21. fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  22.  
  23.  
  24. if(message.content.startsWith(prefix + "credits")) {
  25. if(args[0] !== `${prefix}credit` && args[0] !== `${prefix}credits`) return;
  26.  
  27. if(args[2]) {
  28. if(isNaN(args[2])) return message.channel.send('**:heavy_multiplication_x:| This field should consist of numbers and not letters .**');
  29. if(mention.bot) return message.channel.send(`**:heavy_multiplication_x:| ${message.content.split(' ')[1]} Not found **`);
  30. if(mention.id === message.author.id) return message.channel.send('**:heavy_multiplication_x:| You can not convert credits for yourself **');
  31. if(credits[author].credits < balance) return message.channel.send('**:heavy_multiplication_x:| Your balance is not enough for that! **');
  32. var one = Math.floor(Math.random() * 9) + 1;
  33. var two = Math.floor(Math.random() * 9) + 1;
  34. var three = Math.floor(Math.random() * 9) + 1;
  35. var four = Math.floor(Math.random() * 9) + 1;
  36.  
  37. var number = `${one}${two}${three}${four}`;
  38.  
  39. message.channel.send(`**| :moneybag: \`${number}\`, type these numbers to confirm**`).then(m => {
  40. message.channel.awaitMessages(m => m.author.id === message.author.id, {max: 1, time: 10000}).then(c => {
  41. if(c.first().content === number) {
  42. m.delete();
  43. message.channel.send(`**:moneybag:| ${message.author.username}, has transferred \`${balance}\` to ${mention}**`)
  44. var sendembed = new Discord.RichEmbed()
  45. .setColor('RANDOM')
  46. .setTitle(`عملية تحويل جديدة`)
  47. .addField(`${message.author.username}#${message.author.discriminator}:اسم والتاق المرسل\n${message.author.id} :ايدي المرسل\n${mention.username}#${mention.discriminator}: اسم والتاق المستقبل\n ${mention.id}:ايدي المستقبل\n ${balance} : المبلغ\n${moment(message.createdAt).format('D/MM/YYYY h:mm')} : تم التحويل في`, client.user.username)
  48. client.guilds.get(guildid).channels.get(channelid).send(sendembed)
  49. mention.send(':atm: | Transfer Receipt ```You have received $' + balance + ' from user ' + message.author.username + '(ID: '+message.author.id+' )```');
  50.  
  51. credits[author].credits += (-balance);
  52. credits[mention.id].credits += (+balance);
  53. fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  54. } else if(c.first().content !== number) {
  55. m.delete();
  56. message.channel.send(`** :moneybag: | Sending canceled **`);
  57. }
  58. });
  59. });
  60. }
  61. if(!args[2]) {
  62. if(mention.bot) return message.channel.send(`**:heavy_multiplication_x:| ${message.content.split(' ')[1]} لم يتم العثور على**`);
  63. message.channel.send(`**${mention.username}, your :credit_card: balance is \`\`$${credits[mention.id].credits}\`\`.**`); }
  64. }
  65. if(message.content.startsWith(prefix + "daily")) {
  66. if(cool.includes(message.author.id)) return message.channel.send(`**:stopwatch: | ${mention.username} \ , your daily :yen: credits refreshes in 24 hours **`);
  67. if(mentionn) {
  68. var one = Math.floor(Math.random() * 9) + 1;
  69. var two = Math.floor(Math.random() * 9) + 1;
  70. var three = Math.floor(Math.random() * 9) + 1;
  71. var four = Math.floor(Math.random() * 9) + 1;
  72.  
  73. var number = `${one}${two}${three}${four}`;
  74.  
  75. message.channel.send(`**:atm: | \`${number}\`, type these numbers to confirm **`).then(async m => {
  76. message.channel.awaitMessages(msg => msg.author.id === message.author.id, {max: 1, time: 20000, errors: ['time']}).then(collected => {
  77.  
  78. if(collected.first().content === number) {
  79. m.delete();
  80. collected.first().delete();
  81. credits[mentionn.id].credits += (+daily);
  82. fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  83.  
  84. message.channel.send(`**:atm: | \`${daily}\`, you received your :yen:**`)
  85.  
  86. }
  87. if(collected.first().content !== number) {
  88. return m.delete();
  89. }
  90. });
  91. });
  92. } else if(!mentionn) {
  93. credits[author].credits += (+daily);
  94. fs.writeFile(path, JSON.stringify(credits, null, 5), function(err) {if(err) console.log(err)});
  95.  
  96. var dailyembed = new Discord.RichEmbed()
  97. .setColor('RANDOM')
  98. .setTitle(`شخص استلم ديلي جديد`)
  99. .addField(`${message.author.username}#${message.author.discriminator} :اسم والتاق المستقبل\n${message.author.id} :ايدي المستقبل\n${daily} :المبلغ المستلم`, client.user.username);
  100.  
  101. client.guilds.get(guildid).channels.get(channelid).send(dailyembed)
  102. message.channel.send(`**:atm: | , you received your :yen: \`${daily}\` daily credits! **`);
  103. }
  104. cool.unshift(message.author.id);
  105.  
  106. setTimeout(() => {
  107. cool.shift(message.author.id);
  108. message.author.send("**:atm: | \`Daily\`, يمكنك الحصول على الكردت المجانية الان**").catch();
  109. }, ms("1d"));
  110. }
  111. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement