DudeThatsErin

links.js

Dec 31st, 2020
1,375
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { prefix, config } = require('../config.json');
  2. const Discord = require("discord.js");
  3.  
  4. // Links Embeds
  5. const links1 = new Discord.MessageEmbed()
  6. .setColor('#9F49D1')
  7. .setTitle('Here are all of our useful links.')
  8. .addFields(
  9.     {name: 'Related Subreddits', value: 'These are subreddits that have been found to be incredibly useful to the Finance community.\n- [r/PersonalFiannce](https://www.reddit.com/r/personalfinance/)\n- [r/CreditCards (no affiliation with us)](https://www.reddit.com/r/CreditCards)\n- [r/Frugal](https://www.reddit.com/r/frugal)\n- [r/StudentLoans](https://www.reddit.com/r/StudentLoans)\n- [r/Tax](https://www.reddit.com/r/tax)'},
  10.     {name: 'Free Credit Monitoring', value: '- [CreditKarma](https://www.creditkarma.com/)\n- [CreditSesame](http://www.creditsesame.com/)\n- [Quizzle](https://www.quizzle.com/)'},
  11.     {name: 'Other Resources', value: '- [Credit Card Wiki at r/PersonalFinance](https://www.reddit.com/r/personalfinance/wiki/creditcards)\nYou can view more resources by using \`$links 4\`.'}
  12. );
  13.  
  14. const links2 = new Discord.MessageEmbed()
  15. .setColor('#BFD149')
  16. .setTitle('Related Subreddits')
  17. .setDescription('These are subreddits that have been found to be incredibly useful to the Finance community.\n- [r/PersonalFiannce](https://www.reddit.com/r/personalfinance/)\n- [r/CreditCards (no affiliation with us)](https://www.reddit.com/r/CreditCards)\n- [r/Frugal](https://www.reddit.com/r/frugal)\n- [r/StudentLoans](https://www.reddit.com/r/StudentLoans)\n- [r/Tax](https://www.reddit.com/r/tax)');
  18.  
  19. const links3 = new Discord.MessageEmbed()
  20. .setColor('#D19F49')
  21. .setTitle('Free Credit Monitoring')
  22. .setDescription('- [CreditKarma](https://www.creditkarma.com/): Uses TransUnion and Equifax\n- [CreditSesame](http://www.creditsesame.com/): May use TransUnion or Experian depending on service.\n- [Quizzle](https://www.quizzle.com/): Uses Equifax.');
  23.  
  24. const links4 = new Discord.MessageEmbed()
  25. .setColor('#1a1a1a')
  26. .setTitle('Other Resources')
  27. .setDescription('These are resources that don\'t fit into any other category.\n\n- [Credit Card Wiki at r/PersonalFinance](https://www.reddit.com/r/personalfinance/wiki/creditcards)\n- [Complete List of Free FICO Scores](http://www.doctorofcredit.com/credit-scores/fico-score/free-fico-score/)\n- [Free Credit Reports Info from FTC](http://www.consumer.ftc.gov/articles/0155-free-credit-reports)\n- [Card Offers Just for You](https://www.creditcards.com/cardmatch/)\n- [Compare Cash Reward Credit Cards](http://www.magnifymoney.com/compare/cash-back-credit-cards)\n- [List of credit card company phone numbers](http://ficoforums.myfico.com/t5/Credit-Card-Applications/Backdoor-Numbers/m-p/408066)\n- [Credt Card Tuneup](http://creditcardtuneup.com/) or [CreditIntro](http://www.creditintro.com/recommend/) to help you find the right card.\n- [Capital One Upgrade Link](https://verified.capitalone.com/sic-ui/#/esignin?Product=Card&Action=ProductUpgrade): Check PC eligibility for your existing card.\n- [Credit Card Insider](https://www.creditcardinsider.com/learn/): Learn the basics of Credit Cards.');
  28.  
  29. // Links actual code
  30. module.exports = {
  31.     name: 'links',
  32.     description: 'Spits out an embed with the a few quick links. You can also get an embed for each link separately with this command.',
  33.     aliases: ['useful', 'useful-links', 'link'],
  34.     usage: `${prefix}links [number]`,
  35.     inHelp: 'yes',
  36.     execute(message, args) {
  37.  
  38.         const links = []; // Keeps all of the links inside an array.
  39.         links.push(links1); // Pushes the alLinks embed. Each one below it pushes it's own embed. Each line is a separate rule and that is how the array knows 1 from 2 from 3, etc.
  40.         links.push(links2);
  41.         links.push(links3);
  42.         links.push(links4);
  43.  
  44.         if (args[0] === 'all') { // Displays all of the links when $links all is run.
  45.             let text = '';
  46.             for (let i = 0; i < links.length; i++) {
  47.                 message.channel.send(links[i]);
  48.             }
  49.             message.channel.send(text);
  50.         }
  51.  
  52.         else {
  53.             if(!message.member.hasPermission("SEND_MESSAGES")){ // Allows any user that can send messages, use this command.
  54.                 message.channel.send('You can\'t use that');
  55.                 return;
  56.                 }    
  57.  
  58.             const nb = parseInt(args[1])
  59.             if (nb < 1 || nb > links.length || isNaN(nb)) { // Gives an error if a correct rule number isn't specified.
  60.                 message.channel.send ("Please enter the embed you would like to display. If you want all of them please run \`$links all\`.");
  61.                 message.delete();
  62.                 return;
  63.             };
  64.            
  65.             message.channel.send(links[nb-1]); // Pings the user and deletes the message and asks them to follow the rules.
  66.             }
  67.    
  68.     }
  69.  
  70. };
RAW Paste Data