Skip to main content
People get XP every time they chat. At 100 XP they go up a level, and the bot cheers. /rank shows a picture card with their level.

Before you start

Your bot can only see messages if the Message Content Intent is turned on. Open the Discord Developer Portal, pick your bot, open Bot, and switch on Message Content Intent.

Step 1: Make the variables

Make two variables on the Database page:

Step 2: The XP event

  1. Open Events and make a new event.
  2. In the event list, pick the event for when a message is sent (search for message).
  3. Add Do the maths: variable xp, whose variable: the person who sent the message, maths + 10.
  4. Add a Compare check: is {DBVAR_xp} greater than or equal to 100?
  5. On the yes path:
    • Do the maths on level: + 1.
    • Save a value on xp: 0 (start again for the next level).
    • A message block that sends to the same channel: GG {user_displayName}, you reached level {DBVAR_level}!
  6. Leave the else path empty. Nothing happens if they did not level up.
  7. Save, and make sure the event is switched on.

Step 3: /rank with a picture card

  1. Open Card Studio and pick a rank or level-up template. Press Use this.
  2. Change the text to use your variables: Level {DBVAR_level} and {DBVAR_xp} / 100 XP. Use the insert a value button.
  3. Save the card.
  4. Make a slash command called rank.
  5. Add Make an image card and pick your card.
  6. Add a Reply with {card} in it. The picture is attached.
  7. Save and try /rank!

Make it yours

  • Give a role at level 5: on the level-up path, add another Compare ({DBVAR_level} equals 5) and Give roles.
  • Stop XP in one channel: add a check on the channel (search channel) before the maths.
  • Make each level harder: work out {DBVAR_level} times 100 with a Do the maths into a run-only value, and compare against that instead of 100.