Custom Commands docsCustom CommandsDocs

Search docs

Find a page, function or guide

HomeSupportDashboard

Getting started

  • Introduction
  • Your first command
  • How a command runs
  • Variables in replies
  • Text commands
  • Events
  • Using Slushy

Guides

  • Welcome messages
  • Role menus
  • Auto moderation
  • Automations
  • Forms
  • Social alerts
  • Moderation commands
  • Levels and XP
  • Economy and coins
  • Ticket system
  • Giveaways
  • Poll
  • Button game
  • Reminders

Concepts

  • Buttons and menus
  • Forms
  • Saving data
  • Permissions and cooldowns
  • Limits and premium
  • Common mistakes

API reference

  • Response
  • Messages
  • Embeds
  • Members and roles
  • Channels
  • Storage
  • Checks
  • Views
  • Components
  • Modals
  • Interactions
  • Paginators
  • Web and files
  • Leveling
  • Scheduling
  • Server events and polls
  • Time
  • Waiting
  • Utilities
  • Objects
  • Event variables

Examples

  • /8ball
  • /coinflip
  • /avatar
  • /serverinfo
  • /rank
  • /remind

API reference

View .md

Leveling

Read and change members' XP and levels, and draw their rank card.

These work only while leveling is on (dashboard, Leveling). Otherwise they stop the script with a clear error.

The bot adds await for all of them. member can be a member, user, or an ID. Where it is optional, it means whoever ran the command.

Read#

python
get_level(member=None)

Returns a dict:

KeyMeaning
xpTotal XP
levelTheir level
rankTheir place on the leaderboard, None without XP
level_xpXP into this level
next_level_xpXP this level needs
progress0 to 1 toward the next level
python
get_leaderboard(limit=10, page=1)

Returns a list of {user_id, xp, level, rank}, best first. limit is at most 25.

Change#

python
add_xp(member, amount)     # a negative amount takes XP away
set_xp(member, xp)
set_level(member, level)   # 0 to 1000; their XP becomes the start of that level

Each returns the same dict as get_level. XP never goes below 0. When a member reaches a new level, they get the reward roles and the Level up event and automations run. The level-up message does not post, because there is no chat channel.

A run can change XP 100 times. Inside a Level up event, changes still give rewards but do not start another Level up.

Draw#

python
render_rank_card(member=None)

Returns the card /rank draws, as a file, ready for send_message or the reply.

Example: XP for a daily reward#

python
info = add_xp(user, 50)
set_content(f"+50 XP. You are level {info['level']} (#{info['rank']}).")
PreviousWeb and filesNext Scheduling

On this page

  • Read
  • Change
  • Draw
  • Example: XP for a daily reward
Custom CommandsCustom Commands

The #1 Custom Commands Discord bot — build commands, events and databases with zero boilerplate.

Join the support server

Product

  • Overview
  • Why us?
  • Premium
  • Template shop

Features

  • AI Agent
  • Reaction roles
  • Welcome messages
  • Leveling
  • Global leaderboard
  • Embed builder
  • Social alerts
  • Custom bot

Resources

  • Docs
  • Blog
  • Support
  • Dashboard

Company

  • Privacy
  • Terms
  • Contact
contact@ccbot.app

2 Frederick Street, London, WC1X 0ND

Payments secured by Stripe

© WEiRDSOFT LTD. All rights reserved.

Custom Commands