Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const { prefix, token} = require('./config.json')
  3. const client = new Discord.Client();
  4. const cmdPrefix = prefix
  5.  
  6. // Embeds
  7. const helpEmbed = new Discord.RichEmbed()
  8. .setColor("#8b0000")
  9. .setAuthor("Prison")
  10. .addField("-Prestige {starting prestige} {ending prestige}", "Will calculate the cost to go from one prestige to another.")
  11. const prestigeEmbed = new Discord.RichEmbed()
  12. .setColor("#8b0000")
  13. .setAuthor("Prison")
  14. .setDescription("Here is a list of prestige commands!")
  15. .addField("-prestige {prestige}:", "Will provide the cost of a given prestige")
  16. .addField("-prestige {current prestige} {prestige}:", "Will provide the cost of leveling up from your prestige to a given prestige")
  17.  
  18. client.on('ready', () =>{
  19. console.log('bot ready')
  20. })
  21.  
  22. client.on('message', message => {
  23. prestigeCosts = client.channels.get('630102052395155477');
  24. msg = message.content.toLowerCase();
  25. msgSplit = msg.split(" ");
  26. console.log(message.author.username,"says","'",message.content,"'","at",message.createdAt)
  27.  
  28. if (msg.startsWith(cmdPrefix + "help")) {
  29. if (message.channel !== prestigeCosts) {
  30. return message.channel.send("Please use #prestige-costs")
  31. }
  32. message.channel.send(helpEmbed)
  33. }
  34. if(msg.startsWith(cmdPrefix + "prestige")){
  35. if (message.channel !== prestigeCosts) {
  36. return message.channel.send("Please use #prestige-costs")
  37. }
  38. if(msg === "-prestige")
  39. message.channel.send(prestigeEmbed)
  40. if(msg === "-prestige " + msgSplit[1] + " " + msgSplit[2]){
  41. let startPrestige = Math.max(1, parseInt(msgSplit[1])) - 1
  42. let endPrestige = Math.min(1000, parseInt(msgSplit[2])) - 1
  43. let startCost = (731850000 * Math.pow(startPrestige, 2)) + (2561475000 * startPrestige) + (1829625000)
  44. let endCost = (731850000 * Math.pow(endPrestige, 2)) + (2561475000 * endPrestige) + (1829625000)
  45. let cost = endCost - startCost
  46. message.reply("It would cost $" + cost.toLocaleString() + " to prestige from " + msgSplit[1] + " to " + msgSplit[2])
  47. }
  48. }
  49. })
  50.  
  51.  
  52. client.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement