Configuration
config.json
enabled to true to activate the system.
How XP is awarded
Every non-bot message in a guild channel runs through the XP handler:- The feature gate checks
reputation.enabled. - Messages shorter than 10 characters are skipped (anti-spam).
- The handler checks the in-memory cooldown map. If the user earned XP within the last
xpCooldownSecondsseconds (default: 60), the message is skipped. - A random XP amount between the two values in
xpPerMessage(inclusive) is awarded. - The user’s total XP is upserted into the
reputationtable. - The cooldown timestamp is set.
Example: award between 5 and 15 XP per message
The cooldown is per-user per-guild and stored in memory. It resets on bot restart, but the XP totals in PostgreSQL are persistent.
Levels
Levels are determined by comparing total XP against thelevelThresholds array. The index in the array corresponds to the level (index 0 = level 1, index 1 = level 2, etc.).
Default thresholds
| Level | XP required |
|---|---|
| 1 | 100 |
| 2 | 300 |
| 3 | 600 |
| 4 | 1,000 |
| 5 | 1,500 |
| 6 | 2,500 |
| 7 | 4,000 |
| 8 | 6,000 |
| 9 | 8,500 |
| 10 | 12,000 |
Level-up announcements
When a member levels up, the bot sends an embed toannounceChannelId if one is configured:
config.json
Role rewards
Map specific levels to role IDs underroleRewards. When a member reaches that level, the bot automatically assigns the role.
config.json
Commands
/rank
/rank
Shows your current XP, level, and a progress bar toward the next level.Available to everyone. No options required.
Example output
/leaderboard
/leaderboard
Shows the top members ranked by XP for the current server.Available to everyone. No options required.
Progress bar format
The/rank command renders a 10-segment progress bar using block characters:
▓ segments represent progress toward the next level. The percentage is rounded to the nearest whole number.