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

API reference

View .md

Embeds

Build embeds in code, load the embeds you saved on the dashboard, and send files.

An embed is the box Discord draws around a message, with a colored edge, a title, fields and images.

You can make embeds in two ways:

  • On the dashboard. Open Embeds, design it, save it. Then load it in code with load_embed.
  • In code. Build one with Message(...).

A built embed goes anywhere a message goes: set_embed, send_message(message=...), send_dm(message=...) and paginator pages. See Messages and Response.

None of these functions need await.

Message#

Builds a message: text, an embed, or both. Every argument is optional.

python
Message(
    content=None,
    title=None,
    url=None,
    color=None,
    description=None,
    fields=None,
    image=None,
    thumbnail=None,
    footer=None,
    footer_icon=None,
    timestamp=None,
    author=None,
    author_icon=None,
    author_url=None,
    embed=None,
    populate={},
)
ArgumentWhat it does
contentPlain text above the embed.
titleThe embed title.
urlMakes the title a link.
colorThe side color, as a hex code like "#5865F2".
descriptionThe main text of the embed.
fieldsA list of fields. Each field is (name, value, inline).
imageA big image at the bottom. A link, a rendered image, or a loaded file.
thumbnailA small image in the top right. Same kinds as image.
footerSmall text at the bottom.
footer_iconA small image next to the footer.
timestampA date shown next to the footer. Use get_time("now").
authorSmall text above the title.
author_iconA small image next to the author.
author_urlMakes the author a link.
embedA ready embed to send as is.
populateFills {name} placeholders in the text. See below.

The embed part is only made when you set at least one embed field. Message(content="Hi") sends plain text.

Example: a profile card

python
set_response_message(Message(
    title=user.display_name,
    color="#5865F2",
    thumbnail=user.avatar_url,
    fields=[
        ("Joined", f"<t:{user.unix_joined_at}:R>", True),
        ("Roles", str(len(user.role_names)), True),
    ],
    footer=f"ID: {user.id}",
))

Example: show a rendered image inside the embed

python
card = await render_template("rank-card", name=user.display_name, level=5)
send_message(channel, message=Message(title="Your rank", image=card))

You do not need attachments= here. The image uploads with the message.

Add fields one at a time#

python
msg = Message(title="Top players")
msg.add_field("1st", "Alex", True)
msg.add_field("2nd", "Sam", True)

add_field(name, value, inline=False) skips a field when the name or value is empty.

Fill placeholders with populate#

populate replaces {name} in the text with a value. Unknown names stay as written.

python
Message(description="Hello {who}!", populate={"who": user.mention})

load_embed#

Loads an embed you saved on the dashboard. Variables in it, like {user.mention}, are filled in.

python
load_embed(embed_id, **values)
ArgumentWhat it does
embed_idThe embed's ID from the dashboard.
**valuesExtra values for the embed's placeholders. They win over your variables.
python
set_embed(load_embed("welcome-card"))
python
# Fill {card} in the saved embed with a rendered image
card = await render_template("welcome", avatar=user.avatar_url)
send_message(channel, embed=load_embed("welcome-card", card=card))

Fails with "Embed with id: ... not found" when the ID is wrong.

load_components#

Loads buttons and menus you saved under Components on the dashboard.

python
load_components(id)
python
set_components(load_components("support-buttons"))

Attachment#

A file to send with a message.

python
Attachment(file, filename)
ArgumentWhat it does
fileThe file's bytes.
filenameThe name Discord shows, like "report.txt".
python
data = "Name,Coins\nAlex,120\n".encode()
send_message(channel, "Here is the list.", attachments=[Attachment(data, "coins.csv")])

To send a file from a link, use load_file instead. See Web and files.

Embed methods#

Sometimes you get a raw Discord embed, for example from message.embeds. You can read and change it with these:

NameWhat it does
title, description, url, color, timestampRead the main parts.
author, footer, image, thumbnail, fieldsRead the other parts.
add_field(name, value, inline=False)Adds a field.
edit_field(index, ...)Changes a field.
remove_field(index)Removes a field.
set_author(name=..., url=..., icon=...)Sets the author line.
set_footer(text=..., icon=...)Sets the footer.
set_image(url)Sets the big image.
set_thumbnail(url)Sets the small image.
clear_fields()Removes all fields.
total_length()Counts every character in the embed.

Tip

Use Message(...) or load_embed(...) when you can. They are shorter and handle images for you.

Discord limits for embeds#

PartMost allowed
Title256 characters
Description4,096 characters
Fields25
Field name256 characters
Field value1,024 characters
Footer2,048 characters
Whole embed6,000 characters
PreviousMessagesNext Members and roles

On this page

  • Message
  • Add fields one at a time
  • Fill placeholders with populate
  • load_embed
  • load_components
  • Attachment
  • Embed methods
  • Discord limits for embeds
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