Advertisement
X_KillerYT

كريديت مع تحويل

Dec 14th, 2019
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const credits = JSON.parse(fs.readFileSync("./credits.json"));///////////! , X_KillérYT - 💔#2571
  2. var time = require("./time.json");
  3. client.on("message", async message => {
  4.   if (message.author.bot || message.channel.type === "dm") return;
  5.   let args = message.content.split(" ");
  6.   let author = message.author.id;
  7.   if (!credits[author])
  8.     credits[author] = {
  9.       credits: 0
  10.     };
  11.   fs.writeFileSync("./credits.json", JSON.stringify(credits, 0, 4));
  12.   if (args[0].toLowerCase() == `${prefix}credits`) {
  13.     const mention = message.mentions.users.first() || message.author;
  14.     const mentionn = message.mentions.users.first();
  15.     if (!args[2]) {
  16.       message.channel.send(
  17.         `**${mention.username}, your :credit_card: balance is \`$${credits[mention.id].credits}\`**`
  18.       );
  19.     } else if (mentionn && args[2]) {
  20.       if (args[2] < 1) return message.channel.send(`**:x: | Error**`);
  21.       if (mention.bot) return message.channel.send(`**:x: | Error**`);
  22.       if (mentionn.id === message.author.id)
  23.         return message.channel.send(`**:x: | Error**`);
  24.       if (args[2] > credits[author].credits)
  25.         return message.channel.send(
  26.           `**:x: | Error , You Don't Have Enough Credit**`
  27.        );
  28.      if (args[2].includes("-")) return message.channel.send(`**:x: | Error**`);
  29.      let resulting = Math.floor(args[2] - args[2] * (5 / 100));
  30.      let tax = Math.floor(args[2] * (5 / 100));
  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.      let canvas = Canvas.createCanvas(108, 40);
  37.      let ctx = canvas.getContext("2d");
  38.      const background = await Canvas.loadImage(
  39.        "https://cdn.discordapp.com/attachments/608278049091223552/617791172810899456/hmmm.png"
  40.      );
  41.      ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
  42.      ctx.font = "20px Arial Bold";
  43.      ctx.fontSize = "20px";
  44.      ctx.fillStyle = "#ffffff";
  45.      message.channel
  46.        .send(
  47.          `**${
  48.            message.author.username
  49.          }, Transfer Fees: \`${tax}\`, Amount: \`$${resulting.toLocaleString()}\`**
  50. type these numbers to confirm: `
  51.        )
  52.        .then(essss => {
  53.          ctx.fillText(num, canvas.width / 2.4, canvas.height / 1.7);
  54.          message.channel.sendFile(canvas.toBuffer()).then(m => {
  55.            message.channel
  56.              .awaitMessages(r => r.author.id === message.author.id, {
  57.                max: 1,
  58.                time: 20000,
  59.                errors: ["time"]
  60.              })
  61.              .then(collected => {
  62.                if (collected.first().content === num) {
  63.                  message.channel.send(
  64.                    `**:moneybag: | ${
  65.                      message.author.username
  66.                    }, Done Trans \`$${resulting.toLocaleString()}\` To ${mentionn}**`
  67.                  );
  68.                  mention.send(
  69.                    `**:money_with_wings: | Transfer Receipt \`\`\`You Have Received \`$${resulting.toLocaleString()}\` From User ${
  70.                      message.author.username
  71.                    }; (ID (${message.author.id})\`\`\``
  72.                  );
  73.                  m.delete();
  74.                  credits[author].credits += Math.floor(
  75.                    -resulting.toLocaleString()
  76.                  );
  77.                  credits[mentionn.id].credits += Math.floor(
  78.                    +resulting.toLocaleString()
  79.                  );
  80.                  fs.writeFileSync(
  81.                    "./credits.json",
  82.                    JSON.stringify(credits, 0, 4)
  83.                  );
  84.                } else {
  85.                  m.delete();
  86.                  essss.delete();
  87.                }
  88.              });
  89.          });
  90.        });
  91.    } else {
  92.      message.channel.send(
  93.        `**:x: | Error , Please Command True Ex: \`${prefix}credits [MentionUser] [Balance]\`**`
  94.      );
  95.    }
  96.  }
  97.  if (args[0].toLowerCase() === `${prefix}daily`) {
  98.    let cooldown = 8.64e7;
  99.    let Daily = time[message.author.id];
  100.    if (Daily !== 0 && cooldown - (Date.now() - Daily) > 0) {
  101.      let times = cooldown - (Date.now() - Daily);
  102.      message.channel.send(
  103.        `**:stopwatch: |  ${
  104.          message.author.username
  105.        }, your daily :dollar: credits refreshes in ${pretty(times, {
  106.          verbose: true
  107.        })}.**`
  108.      );
  109.      fs.writeFile("./time.json", JSON.stringify(time), function(e) {
  110.        if (e) throw e;
  111.      });
  112.    } else {
  113.      let ammount = (300, 500, 100, 200, 120, 150, 350, 320, 220, 250);
  114.      credits[author].credits += ammount;
  115.      time[message.author.id] = Date.now();
  116.      message.channel.send(
  117.        `**:atm:  | ${message.author.username}, you received your :yen: ${ammount} daily credits!**`
  118.      );
  119.      fs.writeFile("./credits.json", JSON.stringify(credits), function(e) {
  120.        if (e) throw e;
  121.      });
  122.    }
  123.  }
  124. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement