Advertisement
X_KillerYT

credit + daily

Dec 28th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. client.on('message',async message => {
  2.  
  3. if(message.author.bot) return;
  4. if(!credits[message.author.id]) credits[message.author.id] = {
  5. credits: 50
  6. };
  7.  
  8. let userData = credits[message.author.id];
  9. let m = userData.credits;
  10.  
  11. fs.writeFile("./creditsCode.json", JSON.stringify(credits), (err) => {
  12. if (err) console.error(err);
  13. });
  14. credits[message.author.id] = {
  15. credits: m + 0.5,
  16. }
  17.  
  18. if(message.content.startsWith(prefix + "credit" || prefix + "credits")) {
  19. message.channel.send(`**${message.author.username}, your :credit_card: balance is \`\`${userData.credits}\`\`.**`);
  20. }
  21. });
  22.  
  23. client.on('message', async message => {
  24. let amount = 200000;
  25. if(message.content.startsWith(prefix + "daily")) {
  26. if(message.author.bot) return;
  27. if(coolDown.has(message.author.id)) return message.channel.send(`**:stopwatch: | ${message.author.username}, your daily :yen: credits refreshes in \`\`1 Day\`\`.**`);
  28.  
  29. let userData = credits[message.author.id];
  30. let m = userData.credits + amount;
  31. credits[message.author.id] = {
  32. credits: m
  33. };
  34.  
  35. fs.writeFile("./creditsCode.json", JSON.stringify(userData.credits + amount), (err) => {
  36. if (err) console.error(err);
  37. });
  38.  
  39. message.channel.send(`**:atm: | ${message.author.username}, you received your :yen: ${amount} credits!**`).then(() => {
  40. coolDown.add(message.author.id);
  41. });
  42.  
  43. setTimeout(() => {
  44. coolDown.remove(message.author.id);
  45. },86400000);
  46. }
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement