Advertisement
Guest User

Untitled

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