In this article, we will create a tier-based XP reward system for the number of messages sent by a user.
Level | No. of Messages Sent | XP Reward |
Level 0 | <10 | +0 |
Level 1 | >=10 & <20 | +10 |
Level 2 | >=20 & <40 | +20 |
Level 3 | >=40 | +40 |
Step 1: Set-up the Member Fields
Go to your BotDisco Dashboard
Click on the Member Fields tab on your left
Now create 3 Member Fields as follows:
Name | Type | Description |
XP | Number | To store XP Points of the user |
Level | Number | To store the level of the user |
Msg_Count | Number | To store the no. of messages user sent |
Step 2: Create a Trigger for Channel Message on BotDisco's Dashboard
Suppose I want to create a trigger for any message sent out by users in the channel named "General".
Open the BotDisco Dashboard.
Click on the "+ New Flow" button.
Select the trigger named "New Channel Message".
Identify which text channel you want to create a trigger for any message sent out by users.
Step 3: Update message count of the user
Next, we want to update the message count by 1 for the user that sent the message.
Open the BotDisco Dashboard.
Click "Add Action" and then select "Set Member Field" option.
Select the message count member field and increase its value by "1"
This increases the message count of the user each time he/she sends a message in your channel.
Step 4: Check and Reward XP to the user
Now we know the message count of the user, we'll see which level he gets and then reward him the XP points accordingly (as per the table above).
Click "Add Action" and select "Filter".
Check if the member qualifies for Level 1. Select member field Msg_Count is >= 10
If that is true, Click 'Add Action" and select "Set Member Field". Then set Level to "1". Also repeat this step again to set XP to 10.
Do Step 2 and Step 3 again twice, to check for Level 2 and Level 3 qualification (refer to the video above).
Step 5: Create a custom command for user to check his XP and Level
Lastly, create a custom command for your server so any user can check their current server stats which is their XP and Level.
Step 6: Check the trigger and command on your server