Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.00 KB | None | 0 0
  1.  
  2. let profile = JSON.parse(fs.readFileSync("credit.json", "utf8"))
  3.  
  4. client.on("message", message => {
  5.  
  6. if (message.author.bot) return;
  7. if(!message.channel.guild)return;
  8. if (!profile[message.author.id]) profile[message.author.id] = {
  9. tite: 'Super User',
  10. rep: 0,
  11. reps: 'NOT YET',
  12. lastDaily:'Not Collected',
  13. level: 0,
  14. points: 0,
  15. credits: 150,
  16. };
  17.  
  18.  
  19. fs.writeFile('credit.json', JSON.stringify(profile), (err) => {
  20. if (err) console.error(err);
  21. })
  22. });
  23.  
  24. client.on('message', message => {
  25.  
  26. if(message.content.startsWith(prefix + 'rep')) {
  27. if(!message.channel.guild) return;
  28. moment.locale('en');
  29. var getvalueof = message.mentions.users.first()
  30. if(!getvalueof) return message.channel.send(`**:mag: | ${message.author.username}, the user could not be found. **`);
  31. if(getvalueof.id == message.author.id) return message.channel.send(`**${message.author.username}, you cant give yourself a reputation !**`)
  32. if(profile[message.author.id].reps != moment().format('L')) {
  33. profile[message.author.id].reps = moment().format('L');
  34. profile[getvalueof.id].rep = Math.floor(profile[getvalueof.id].rep+1);
  35. message.channel.send(`** :up: | ${message.author.username} has given ${getvalueof} a reputation point!**`)
  36. } else {
  37. message.channel.send(`**:stopwatch: | ${message.author.username}, you can raward more reputation ${moment().endOf('day').fromNow()} **`)
  38. }
  39. }
  40. fs.writeFile('credit.json', JSON.stringify(profile), (err) => {
  41. if (err) console.error(err);
  42. })
  43. });
  44.  
  45. client.on("message", (message) => {
  46. let men = message.mentions.users.first()
  47.  
  48. if (message.author.bot) return;
  49. if (message.author.id === client.user.id) return;
  50. if(!message.channel.guild) return;
  51. if (message.content.startsWith(prefix + 'credit')) {
  52. if(men) {
  53. if (!profile[men.id]) profile[men.id] = {
  54. lastDaily:'Not Collected',
  55. credits: 1,
  56. };
  57. }
  58. if(men) {
  59. message.channel.send(`** ${men.username}, :credit_card: balance` + " is `" + `${profile[men.id].credits}$` + "`.**")
  60. } else {
  61. message.channel.send(`** ${message.author.username}, your :credit_card: balance` + " is `" + `${profile[message.author.id].credits}$` + "`.**")
  62. }
  63. }
  64.  
  65. if(message.content.startsWith(prefix + "dailyplue")) {
  66. if(profile[message.author.id].lastDaily != moment().format('minute')) {
  67. profile[message.author.id].lastDaily = moment().format('minute')
  68. profile[message.author.id].credits += 2500000000
  69. message.channel.send(`**${message.author.username} you collect your \`2500000000\` :dollar: daily pounds**`)
  70. } else {
  71. message.channel.send(`**:stopwatch: | ${message.author.username}, your daily :yen: credits refreshes ${moment().endOf('minute').fromNow()}**`)
  72. }
  73. }
  74.  
  75. if(message.content.startsWith(prefix + "daily")) {
  76. if(profile[message.author.id].lastDaily != moment().format('day')) {
  77. profile[message.author.id].lastDaily = moment().format('day')
  78. profile[message.author.id].credits += 200
  79. message.channel.send(`**${message.author.username} you collect your \`200\` :dollar: daily pounds**`)
  80. } else {
  81. message.channel.send(`**:stopwatch: | ${message.author.username}, your daily :yen: credits refreshes ${moment().endOf('day').fromNow()}**`)
  82. }
  83. }
  84.  
  85.  
  86. let cont = message.content.slice(prefix.length).split(" ");
  87. let args = cont.slice(2);
  88. let sender = message.author
  89. if(message.content.startsWith(prefix + 'trans')) {
  90. if (!args[0]) {message.channel.send(`**Usage: ${prefix}trans @someone amount**`);
  91. return;
  92. }
  93. // We should also make sure that args[0] is a number
  94. if (isNaN(args[0])) {
  95. message.channel.send(`**Usage: ${prefix}trans @someone amount**`);
  96. return;
  97. }
  98. // We should also make sure that args[0] is a number
  99. if (isNaN(args[0])) {
  100. message.channel.send(`**Usage: ${prefix}trans @someone number**`);
  101. return; // Remember to return if you are sending an error message! So the rest of the code doesn't run.
  102. }
  103. if(profile[message.author.id].credits < args[0]) return message.channel.send("**Your Credits is not enough that**")
  104. let defineduser = '';
  105. let firstMentioned = message.mentions.users.first();
  106. defineduser = (firstMentioned)
  107. if (!defineduser) return message.channel.send(`**Usage: ${prefix}trans @someone number**`);
  108. if(defineduser.id === message.author.id) return message.channel.send("***Transfering to your self hah ?!***")
  109. var mentionned = message.mentions.users.first();
  110. if (!profile[sender.id]) profile[sender.id] = {}
  111. if (!profile[sender.id].credits) profile[sender.id].credits = 310;
  112. fs.writeFile('./credit.json', JSON.stringify(profile), (err) => {
  113. if (err) console.error(err);
  114. })
  115. var x = ['5587' ,' 9978' , '3785' , '7734' , '9864' , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , '8762' , '0889' , '0388' , '3316' , '0976' , '8603' , '1842' , '4565' , '9524' , '9524' , '0964' , '5930' , '5678' , '9567' , '6099' , '7058' , '0001' , '1324' , '9834' , '7668' , '0378' , '7055' , '9733' , '9876' , '9846' , '9685' , '8574' , '8975' , '9845' , '9862' , '0069' , '0807' , '0673' , '0813' , '1235' , '6879'];
  116. var x2 = ['5587' ,' 9978' , '3785' , '7734' , '9864' , '7681' , '3758' , '7834' , '3489' , '1382' , '7389' , '8762' , '0889' , '0388' , '3316' , '0976' , '8603' , '1842' , '4565' , '9524' , '9524' , '0964' , '5930' , '5678' , '9567' , '6099' , '7058' , '0001' , '1324' , '9834' , '7668' , '0378' , '7055' , '9733' , '9876' , '9846' , '9685' , '8574' , '8975' , '9845' , '9862' , '0069' , '0807' , '0673' , '0813' , '1235' , '6879'];
  117. var x3 = Math.floor(Math.random()*x.length)
  118. message.channel.send(` \`${args}\`** : الملبغ** \n \`${x[x3]}\` ** : اكتب الرقم التالي حتي تتم عملية التحويل **`).then(msg1=> {
  119. var r = message.channel.awaitMessages(msg => msg.content == x2[x3], { maxMatches : 1, time : 60000, errors : ['time'] })
  120. r.catch(() => {
  121. message.delete()
  122. r.delete()
  123. msg.delete()
  124. message.channel.sendEmbed(embed)
  125. })
  126. r.then(s=> {
  127. var mando = message.mentions.users.id;
  128. if (!profile[defineduser.id]) profile[defineduser.id] = {}
  129. if (!profile[defineduser.id].credits) profile[defineduser.id].credits = 200;
  130. profile[defineduser.id].credits += (+args[0]);
  131. profile[sender.id].credits += (-args[0]);
  132. let mariam = message.author.username
  133. message.channel.send(`**:moneybag: | ${message.author.username}, has transferrerd ` + "`" + args[0] + "$` to " + `<@${defineduser.id}>**`)
  134. mentionned.send(`:credit_card: | Transfer Receipt \`\`\`\`You have received ${args[0]} from user ${message.author.username} (ID: ${message.author.id})\`\`\`\``);
  135. message.channel.sendEmbed(embed)
  136. })
  137. })
  138. }
  139. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement