/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
- Open Events and make a new event.
- In the event list, pick the event for when a message is sent (search for
message). - Add Do the maths: variable
xp, whose variable: the person who sent the message, maths+ 10. - Add a Compare check: is
{DBVAR_xp}greater than or equal to100? - 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}!
- Do the maths on
- Leave the else path empty. Nothing happens if they did not level up.
- Save, and make sure the event is switched on.
Step 3: /rank with a picture card
- Open Card Studio and pick a rank or level-up template. Press Use this.
- Change the text to use your variables:
Level {DBVAR_level}and{DBVAR_xp} / 100 XP. Use the insert a value button. - Save the card.
- Make a slash command called
rank. - Add Make an image card and pick your card.
- Add a Reply with
{card}in it. The picture is attached. - Save and try
/rank!
Make it yours
- Give a role at level 5: on the level-up path, add another Compare (
{DBVAR_level}equals5) 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 of100.
