XP & Leveling System
The XP (Experience) system allows your bot to reward users with points for activity, and optionally assign roles based on levels earned. This helps encourage engagement and gives your server a fun, gamified feel.
Getting Started
You must have completed the initial setup in Getting Started before enabling the XP system.
Link the Library
Make sure you import and initialise the XP module:
const { discordXP } = require('./node_modules/bb-dbotbits/discordXP');
discordXP();
How XP Works
- Users earn XP for activity like sending messages.
- Each message gives a base amount of XP.
- When thresholds are reached, users level up.
Role Rewards
You can reward levels with roles. In your configuration file, set roles for specific XP thresholds:
levels: [
{ level: 5, role: 'Member' },
{ level: 10, role: 'Veteran' },
{ level: 20, role: 'Elite' }
]
Config Options
Typical settings include:
- xpPerMessage – how much XP per message
- levelMultiplier – how much XP required per level
- roleRewards – roles given at specific levels
Best Practices
- Don’t reward XP in bot-spam channels.
- Consider cooldown limits to avoid farming.
- Ensure roles assigned by XP are below bot role.
Next up: All Commands