Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.90 KB | None | 0 0
  1.  
  2. const credits = JSON.parse(fs.readFileSync('./credits.json'));
  3. const creditsPath = './credits.json';
  4. var time = require("./time.json");
  5. client.on('message',async message => {
  6. if(message.author.bot || message.channel.type === 'dm') return;
  7. let args = message.content.split(' ');
  8. let author = message.author.id;
  9. if(!credits[author]) credits[author] = {
  10. credits: 0
  11. }
  12. if(!credits[author]) credits[author] = {
  13. blacklist: false
  14. }
  15. fs.writeFileSync(creditsPath, JSON.stringify(credits, null, 4));
  16. if(credits[message.author.id].blacklist === true) return undefined;
  17. if(args[0].toLowerCase() == `${prefix}credit` || args[0].toLowerCase() === `${prefix}credits`) {
  18. const mention = message.mentions.users.first() || client.users.get(args[1]) || message.author;
  19. const mentionn = message.mentions.users.first() || client.users.get(args[1]);
  20. if(!args[2]) {
  21. message.channel.send(`**💰 | ${mention.username}, Your credits \`$${credits[mention.id].credits}\`**`)
  22. } else if(mentionn && args[2]) {
  23. if(credits[message.author.id].blacklist === true) return undefined;
  24. if(isNaN(args[2])) return message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  25. if(args[2] < 1) return message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  26. if(mention.bot) return message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  27. if(mentionn.id === message.author.id) return message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  28. if(args[2] > credits[author].credits) return message.channel.send(`**<a:PureNo1:640233851062452224> | You don\'t have enough credit**`);
  29. if(args[2].includes("-")) return message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  30. if(args[2].includes(".")) return message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  31. let first = Math.floor(Math.random() * 9);
  32. let second = Math.floor(Math.random() * 9);
  33. let third = Math.floor(Math.random() * 9);
  34. let fourth = Math.floor(Math.random() * 9);
  35. let num = `${first}${second}${third}${fourth}`;
  36.  
  37. let tax = message.content.split(" ")[1]
  38. let Price = message.content.split(" ")[2];
  39. tax = tax.replace(/%5/g,"");
  40. let resulting = Math.floor(Price-(Price*(5/100)));
  41. message.channel.send(`**${message.author.username}, Transfer Fees: \`${resulting}\`, Amount :\`$${args[2]}\` **
  42. type these numbers to confirm :
  43. \`${num}\``).then(m => {
  44. message.channel.awaitMessages(r => r.author.id === message.author.id, { max: 1, time: 20000, errors:['time'] }).then(collected => {
  45. if(collected.first().content === num) {
  46. client.channels.get("643132886899490817").send(`**
  47. تم التحول من : ${message.author.username} | (ID: \`${message.author.id}\`)
  48. تم التحول الي : ${mentionn.username} | (ID: \`${mentionn.id}\`)
  49. المبلغ : \`$${resulting}\`
  50. **`);
  51. message.channel.send(`**<a:PureYes1:640231382060236819> | ${message.author.username}, The conversion was successful Money : \`$${resulting}\`**`);
  52. mention.send(`**<a:PureYes1:640231382060236819> | New Transfer:\n You have received \`${resulting}\` from ${message.author.username} | (ID: \`${message.author.id}\`)**`);
  53. m.delete();
  54. credits[author].credits += Math.floor((-args[2]));
  55. credits[mentionn.id].credits += Math.floor((+resulting));
  56. fs.writeFileSync(creditsPath, JSON.stringify(credits, null, 4));
  57. } else {
  58. m.delete();
  59. }
  60. })
  61. })
  62. }else {
  63. message.channel.send(`**<a:PureYes1:640231382060236819> Using: \`${prefix}credit [mentionuser] [amount]\`**`);
  64. }
  65. }
  66. if(args[0].toLowerCase() === `${prefix}daily`) {
  67. if(credits[message.author.id].blacklist === true) return undefined;
  68. let cooldown = 8.64e+7
  69. let Daily = time[message.author.id]
  70. if (Daily !== null && cooldown - (Date.now() - Daily) > 0) {
  71. let times = (cooldown - (Date.now() - Daily));
  72. message.channel.send(`**⏲ | ${message.author.username}, Wait \`(${pretty(times, {verbose:true})})\`**`);
  73. fs.writeFile("./time.json", JSON.stringify(time), function(e) {
  74. if(e)throw e;
  75. })
  76. }else{
  77. let ammount = Math.round(Math.random() * 1250);
  78. credits[author].credits += ammount;
  79. time[message.author.id] = Date.now();
  80. message.channel.send(`**💲 | ${message.author.username}, You've taken \`$${ammount}\`**`);
  81. fs.writeFile("./credits.json", JSON.stringify(credits), function(e) {
  82. if(e)throw e;
  83. })
  84. }
  85. }
  86. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement