Skip to main content
← Blog

August 21, 2026 · The Minely team

How to build a leveling bot with AI (xp, ranks, role rewards)

Leveling is the engine of Discord retention: every message earns xp, levels unlock perks, and the ladder gives people a reason to come back tomorrow. The concept is one formula; the craft is anti-spam discipline and rewards that feel worth the climb.

What a leveling bot actually is

A leveling bot awards experience points for activity, tracks levels per member, and announces level-ups with rewards at milestones. Cooldowns stop xp farming, /rank shows a personal card, and /leaderboard fuels the competition that keeps the ladder alive.

How it works under the hood

Each message grants xp once per cooldown window (15 to 60 seconds) with a random amount in a small range, stored per member per guild. Levels follow a curve — level N costs roughly 5N² to 10N² cumulative xp for the classic feel. Level-ups fire an announcement and check a milestone table for role rewards. The /rank card shows current level, progress to next, and rank position from a sorted query.

The prompt that builds it

You do not have to write this yourself. A precise description is enough:

a leveling bot with per-message xp and cooldowns, level-up messages, /rank and /leaderboard, role rewards at level milestones, and per-channel xp multipliers

Name the commands, the permissions, and the exact messages players see. Precision here is what makes the first build land close.

Building it in the right order

  1. Implement xp awards with cooldown windows and storage.
  2. Add the level curve and level-up detection.
  3. Build /rank and /leaderboard.
  4. Wire role rewards at milestones.
  5. Add multipliers, channel ignores, and anti-spam rules.

The details that matter in production

In production, the first thing you learn is that the happy path is the easy half. The edges are where the work lives: restarts, protection interactions, full inventories, and players who treat every system like an exploit puzzle. Build for those from day one and the launch weekend is quiet instead of a fire drill.

Storage and cleanup deserve special attention. Write state as it changes rather than on shutdown, clear per-player state on quit and on world change, and make every admin-facing action leave an audit line. The first time something goes wrong, those records are the difference between a two-minute review and an evening of guessing.

Finally, test like a hostile user. Spam-click every GUI, rejoin mid-action, try the command with no permission and with every permission, and run it while the server is under load. The bugs that survive that pass are the ones worth shipping.

Tuning it after the first build

Level 10 should take an active member a week, level 30 a couple of months, level 50 a year. Milestone roles every 5 to 10 levels with visible names (Regular, Veteran, Legend) — cosmetic but coveted. Exclude bot channels and command spam from xp or the leaderboard means nothing.

Tips that save you a rebuild

  • Randomize xp per message slightly; flat rates invite macro optimization.
  • Exclude channels that exist for spam — counting them teaches spam.
  • Announce level-ups in the same channel; the social proof is the reward.
  • Give the leaderboard a public home or the competition never starts.

Questions people ask

Can xp be transferred from another bot?

Yes — an import command with a CSV or an admin /xp set for manual adjustments.

What about voice xp?

Add periodic checks for members in voice with a lower rate and a no-self-deafened rule.

How do I reset a cheater?

An admin /xp reset per user with an audit entry; wipe-and-log, never silent.

Open the dashboard, paste the prompt from this guide, and watch it build live. The first one is free, and the source is yours either way.