Discord level bot with a leaderboard

Members earn experience for chatting, climb levels and see where they stand. Level-ups are announced where you choose.

A level-up, and what /rank answers.
general
TheoToday at 18:41
anyone up for the end fight tonight
Level BotAPPToday at 18:41
@Theo reached level 8.
Miraused/rank
Level BotAPPToday at 18:42
mira
Level
7
Rank
#3
Messages
412
Progress
█████████░░░░░░░░░░░ 312 / 695 XP
Plan
Free, always on
Setup
A token, nothing else
Privileged intents
Message Content
Experience
15 to 25 XP a message

What the level bot does

XP for chatting

15 to 25 XP for a message, at most once a minute, so flooding the chat does not pay.

/rank and /leaderboard

Level, rank, messages and a progress bar for anyone, and the top ten members of the server.

Level-ups announced

In the channel where it happened, or in one you pick with /levels channel.

Channels that do not count

/levels ignore takes a channel out, a bot channel or a spam corner. /levels reset starts a member over.

Set it up

  1. 1

    Create the bot

    At discord.com/developers, New Application, then Bot and Reset Token. Copy the token.

  2. 2

    Turn on Message Content

    Under Bot, Privileged Gateway Intents. It counts messages, and they never reach it without this.

  3. 3

    Invite it

    With the bot and applications.commands scopes and Send Messages and Embed Links.

  4. 4

    Deploy it

    Press Deploy free, pick the Level Bot template and paste the token. Members start earning straight away.

  5. 5

    Tune it, if you like

    /levels channel #level-ups for the announcements, /levels ignore #bot-spam for channels that should not count.

Commands

/rank [user]
Level, rank, message count and progress.
/leaderboard
The top ten members.
/levels channel [#channel]
Where level-ups are announced. Leave it out to announce where they happen.
/levels ignore #channel
A channel that gives no experience.
/levels unignore
Lets an ignored channel count again.
/levels reset user
A member starts over.

Environment variables

They live in the table on the bot's page in the panel, values masked once saved. The template's form asks for the ones it needs when you deploy.

VariableNeededWhat it is
DISCORD_TOKENRequiredYour bot token.
LEVELUP_CHANNEL_IDOptionalThe channel for level-up messages, if you would rather not use /levels channel.

Which plan it needs

The free plan runs it, always on. Experience is saved every fifteen seconds and when the bot stops, so nothing is lost to a restart.

Free

Recommended

$0

No card

  • 256 MB and a quarter of a CPU, always on
  • No card: one free bot or app per person
  • No renewals. Only a bot with no network traffic for 7 days is stopped

Starter

$2/mo

or $20 a year

  • 1 GB of memory and a full vCPU
  • Never stopped for being quiet
  • You pick the region it runs in

Running more than one? Standard carries two bots or apps for $3 a month and Pro four for $6, on one bill with your game servers. Every plan

Frequently asked questions

How much XP does a level take?

Going up from level L takes 5 × L² + 50 × L + 100 XP: 100 for the first level, 155 for the second, and about 4,700 in all to reach level 10. A message gives 15 to 25 XP, once a minute at most.

Is the XP kept when the bot restarts?

Yes. It is saved to the bot's storage every fifteen seconds and when the bot shuts down, so a restart or a redeploy keeps it.

Can I stop a channel giving XP?

Yes: /levels ignore with the channel, and /levels unignore to let it count again.

Is the level bot free?

Yes. It runs on the free plan, always on, with no card. One bot or app is free per person; a second one needs a paid plan, from $2 a month for one or $3 for two.

Give your members levels

Your first bot is free, with no card. It logs in within a minute.

Deploy free