title: Discord.js Level System
body: <p>My 'problem' is more of a feature I am looking to add, I used this guide:
  <a href="https://anidiots.guide/coding-guides/sqlite-based-points-system" rel="nofollow noreferrer">https://anidiots.guide/coding-guides/sqlite-based-points-system</a>
  I changed the code a little to mainly give you a random amount of XP, I am looking to edit how much XP is needed to level up.</p>
  
  <p>Right now it is a static amount, being 5000 needed to level up. I am trying to make it increase the amount needed to level up by an extra 5000 each time you level up.</p>
  
  <p>Currently, it works like this:</p>
  
  <blockquote>
    <p>Level 1 to 2 = 5000 total XP needed</p>
    
    <p>Level 2 to 3 = 10000 total xp needed</p>
  </blockquote>
  
  <p>Currently, the amount needed to level up is always 5000 between each level.</p>
  
  <p>This is how I want it to work:</p>
  
  <blockquote>
    <p>Level 1 to 2 = 5000 total XP needed</p>
    
    <p>Level 2 to 3 = 15000 total XP needed</p>
  </blockquote>
  
  <p>Which will be 5000 to level 2 and then 10000 to level 3 and so on (increasing the amount needed by 5000 each time you level up)</p>
  
  <p>I spent the best part of 2 hours trying different things, and mainly looking at the code being completely out of my depth.
  I believed that doing something like this would work, but I have no idea if it's correct</p>
  
  <pre class="lang-js prettyprint-override"><code>if (score.level == '1') {
      nextLevel = 5000
  }
  if (score.level == '2' {
      nextLevel = 10000
  }
  </code></pre>
  
  <p>I highly doubt this is correct, otherwise, my message event would be very long, as I plan to have 100 levels</p>
  
  <p>The code in its entirety: </p>
  
  <pre class="lang-js prettyprint-override"><code>    let score;
      if (message.guild) {
          score = bot.getScore.get(message.author.id, message.guild.id);
          if (!score) {
              score = {
                  id: `${message.guild.id}-${message.author.id}`,
                  user: message.author.id,
                  guild: message.guild.id,
                  points: 0,
                  level: 1,
              };
          }
          const xpAdd = Math.floor(Math.random() * 10) + 50;
          const curxp = score.points;
          const curlvl = score.level;
          const nxtLvl = score.level * 5000;
          score.points = curxp + xpAdd;
          if (nxtLvl &lt;= score.points) {
              score.level = curlvl + 1;
              const lvlup = new MessageEmbed()
                  .setAuthor(
                      `Congrats ${message.author.username}`,
                      message.author.displayAvatarURL()
                  )
                  .setTitle('You have leveled up!')
                  .setThumbnail('https://i.imgur.com/lXeBiMs.png')
                  .setColor(color)
                  .addField('New Level', curlvl + 1);
              message.channel.send(lvlup).then(msg =&gt; {
                  msg.delete({
                      timeout: 10000,
                  });
              });
          }
          bot.setScore.run(score);
      }
  </code></pre>
  
  <p>The code as-is works fine and as expected, but as-is is not very good, as there is no reward from going from level 30-31 as it's the same amount of XP needed to get from level 1-2</p>