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
  • 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
  • Scheduling
  • Server events and polls
  • Time
  • Waiting
  • Utilities
  • Objects
  • Event variables

Examples

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

Getting started

View .md

Variables in replies

Put names, numbers and server info in a reply with curly brackets.

A variable is a name in curly brackets, like {user.mention}. When the command runs, the bot puts the real value in its place.

text
Hello {user.mention}! There are {server.member_count} members here.

Becomes:

text
Hello @Alex! There are 1,204 members here.

Variables work in the Content / Reply Message box and in embeds used as the reply.

The person who ran the command#

VariableWhat it shows
{user.mention}A ping, like @Alex
{user.display_name}Their name in this server
{user.username}Their Discord username
{user.id}Their user ID
{user.avatar_url}A link to their avatar
{user.top_role}Their highest role
{user.unix_joined_at}When they joined, as a number for timestamps

The server#

VariableWhat it shows
{server.name}The server name
{server.member_count}How many members
{server.icon_url}A link to the server icon
{server.owner.mention}A ping of the owner
{server.premium_subscription_count}Number of boosts

The channel#

VariableWhat it shows
{channel.mention}A link to the channel, like #general
{channel.name}The channel name
{channel.id}The channel ID

For every field, see Objects.

Arguments#

Every argument you add to a command becomes a variable with the same name.

Add a Member argument named target. Then:

text
{user.mention} gave a cookie to {target.mention}!

A Text argument named reason is plain text:

text
Reason: {reason}

Watch out

An argument hides anything with the same name. An argument named user replaces the person who ran the command. Pick a different name, like member or target.

Values from your code#

Anything you make in the Pre-hook can go in the reply.

python
coins = int(member_var("coins", 0))
text
You have {coins} coins.

You can also do small sums inside the brackets. With an Integer argument named age:

text
Next year you will be {age + 1}.

If something inside the brackets fails, it shows as None instead of breaking the command.

Saved values#

Some values should stay after the command ends, like coins or a counter. Save them with server or member variables:

python
update_member_var("coins", 100)

See Saving data.

In events#

Events have no reply box, so curly-bracket variables do not work there. Build the text in code with an f-string instead:

python
send_message("welcome", f"Welcome {user.mention} to {server.name}!")
PreviousHow a command runsNext Text commands

On this page

  • The person who ran the command
  • The server
  • The channel
  • Arguments
  • Values from your code
  • Saved values
  • In events
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
  • 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