Advertisement
n3k4a

Credits Like ProBot 100%

Jan 27th, 2020
1,275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 KB | None | 0 0
  1. /* هذا الكود بي حقوق توكسك كودز فقط واي احد يملك ذا الكود يتعرض للتبنيد
  2.  
  3. مني والي يعرف احد ينشره بدون ذكر حقوقك صاحبه يرسلي في الدسكورد
  4. https://discord.gg/s7VkhT2
  5. */
  6.  
  7. const Canvas = require('canvas')
  8. const credits = JSON.parse(fs.readFileSync("./credits.json"));
  9. var time = require("./time.json");
  10. client.on("message", async message => {
  11. if (message.author.bot || message.channel.type === "dm") return;
  12. let args = message.content.split(" ");
  13. let author = message.author.id;
  14. if (!credits[author])
  15. credits[author] = {
  16. credits: 0
  17. };
  18. fs.writeFileSync("./credits.json", JSON.stringify(credits, null, 4));
  19. if (args[0].toLowerCase() == `${prefix}credits` ||
  20. args[0].toLowerCase() === `${prefix}credit` ||
  21. args[0].toLowerCase() === `c`
  22.  
  23. ) {
  24. const mention = message.mentions.users.first() || message.author;
  25. const mentionn = message.mentions.users.first();
  26. if (!args[2]) {
  27. message.channel.send(
  28. `**:bank: | ${mention.username}, Your :credit_card: balance is \`$${credits[mention.id].credits}\`**`
  29. );
  30. } else if (mentionn && args[2]) {
  31. if (isNaN(args[2])) return message.channel.send(`** :interrobang: | ${message.author.username}, i can't find it!**`);
  32. if (args[2] < 1) return message.channel.send(`** :interrobang: | ${message.author.username}, type the credit you need to transfer!**`);
  33. if (mention.bot) return message.channel.send(`**:thinking: | ${message.author.username}, bots do not have credits**`);
  34. if (mentionn.id === message.author.id)
  35. return message.channel.send(`**:interrobang: | ${message.author.username}, I can't find User **`);
  36. if (args[2] > credits[author].credits)
  37. return message.channel.send(
  38. `**:thinking: | ${message.author.username}, Your balance is not enough for that!**`
  39. );
  40. if (args[2].includes("-")) return message.channel.send(`**:interrobang: | ${message.author.username}, type the credit you need to transfer!**`);
  41. //let resulting = Math.floor(args[2] - args[2] * (5 / 100));
  42. let tax = Math.floor(args[2] * (5 / 100));
  43. let first = Math.floor(Math.random() * 10);
  44. let second = Math.floor(Math.random() * 10);
  45. let third = Math.floor(Math.random() * 10);
  46. let fourth = Math.floor(Math.random() * 10);
  47. let num = `${ first }${ second }${ third }${ fourth }`;
  48. let canvas = Canvas.createCanvas(100, 50);
  49. let ctx = canvas.getContext("2d");
  50. //let tax = message.content.split(" ")[1]
  51. let Price = message.content.split(" ")[2];
  52. //tax = tax.replace(/%5/g,"");
  53. let resulting = Math.floor(Price-(Price*(5/100))); const background = await Canvas.loadImage(
  54. "https://cdn.discordapp.com/attachments/365219235288317962/656362038884565014/captcha.png"
  55. );
  56. ctx.drawImage(background, 6, 3, canvas.width, canvas.height);
  57. ctx.font = "25px Tahoma";
  58. ctx.fontSize = "7px";
  59. ctx.fillStyle = "Yellow";
  60. message.delete();
  61. //let resulting = Math.floor(Price-(Price*(5/100)));
  62. message.channel.send(`**${message.author.username}, Transfer Fees \`${tax}\`, Amount :\`${resulting}\` **
  63. type these numbers to confirm : `
  64. ).then(m => {
  65.  
  66. ctx.fillText(num, canvas.width / 4.8, canvas.height / 1.5);
  67. message.channel.sendFile(canvas.toBuffer()).then(s => {
  68. message.channel
  69. .awaitMessages(r => r.author.id === message.author.id, {
  70. max: 1,
  71. time: 20000,
  72. errors: ["time"]
  73.  
  74. })
  75.  
  76. .then(collected => {
  77.  
  78. if (collected.first().content === num) {
  79.  
  80. message.channel.send(
  81. `**:moneybag: | ${
  82. message.author.username
  83. }, has transferred \`$${resulting}\` to ${mentionn}**`
  84. ); m.delete();
  85. s.delete();
  86. mention.send(
  87. `**:atm: | Transfer Receipt**\`\`\`You Have Received \$${resulting}\ From User ${message.author.username}; (ID ${ message.author.id })\`\`\``);
  88. m.delete();
  89. s.delete();
  90.  
  91. credits[author].credits += Math.floor(
  92. -resulting
  93. );
  94. credits[mentionn.id].credits += Math.floor(
  95. +resulting
  96. );
  97. fs.writeFileSync(
  98. "./credits.json",
  99. JSON.stringify(credits, null, 4)
  100. );
  101. } else {
  102. m.delete();
  103. }
  104. });
  105. });
  106. });
  107. }
  108. }
  109.  
  110. if (args[0].toLowerCase() === `${prefix}daily` ||
  111. args[0].toLowerCase() === `d`
  112. ) {
  113. let cooldown = 8.64e7;
  114. let Daily = time[message.author.id];
  115. if (Daily !== null && cooldown - (Date.now() - Daily) > 0) {
  116. let times = cooldown - (Date.now() - Daily);
  117. message.channel.send( `**:rolling_eyes: | ${ message.author.username }, your daily credits refreshes in \'${pretty(times, { verbose: true })}'.\**`);
  118. fs.writeFile("./time.json", JSON.stringify(time), function(e) {
  119. if (e) throw e;
  120. });
  121. } else {
  122. let ammount = (300, 500, 100, 200, 120, 150, 350, 320, 220, 250);
  123. credits[author].credits += ammount;
  124. time[message.author.id] = Date.now();
  125. message.channel.send(
  126. `**:moneybag: ${message.author.username}, You got :dollar: ${ammount} daily credits!**`
  127. );
  128. fs.writeFile("./credits.json", JSON.stringify(credits), function(e) {
  129. if (e) throw e;
  130. });
  131. }
  132. }
  133. });/* الحراميه تبنسخه زيي ما هوا للمعولمه اعده رفع علشان انمسح من السيرفر */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement