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

Objects

Every attribute you can read on a user, server, channel, message, role and interaction.

Your code gets ready-made objects, like user, server and channel. This page lists what you can read on each one.

Use these names exactly. A guessed name, like user.name, fails.

Read here, act with helpers

Read attributes from these objects. To do something, like send, add a role or edit, use the helper functions in the API reference. channel.send(...), message.respond(...), member.add_role(...) and member.remove_role(...) are blocked.

Which objects you get depends on where your code runs. See Event variables.

user#

The member who ran the command, or the member an event is about.

AttributeWhat it is
idThe user ID.
mentionA ping, like @Alex.
usernameThe account name.
global_nameThe display name set on the account.
display_nameThe name shown in this server. Use this for most text.
nicknameThe server nickname, or None.
avatar_urlThe avatar link, or None.
banner_urlThe banner link, or None.
display_avatar_urlThe avatar link, with Discord's default as a fallback.
rolesThe member's roles.
role_namesRole names, without @everyone.
role_mentionsRole pings, without @everyone.
role_idsRole IDs.
top_roleThe highest role.
is_botTrue for bots.
is_boostingTrue when they boost the server.
is_timed_outTrue when they are timed out.
joined_atWhen they joined the server.
created_atWhen the account was made.
unix_joined_atJoin time as a Unix number, for <t:...:R>.
unix_created_atAccount age as a Unix number.
premium_sinceWhen they started boosting, or None.
accent_colorTheir profile color.
statusTheir online status.

Methods: get_roles(), get_top_role(), get_guild(), get_presence(), communication_disabled_until().

python
set_content(f"{user.display_name} joined <t:{user.unix_joined_at}:R>.")

server#

The server the code runs in.

AttributeWhat it is
idThe server ID.
nameThe server name.
descriptionThe server description.
member_countHow many members it has.
owner_idThe owner's user ID.
ownerThe owner.
icon_urlThe icon link, or None.
banner_urlThe banner link, or None.
created_atWhen the server was made.
premium_tierThe boost level, 0 to 3.
premium_subscription_countHow many boosts it has.
vanity_url_codeThe custom invite code, or None.
verification_levelThe verification setting.
preferred_localeThe server language.
featuresDiscord features the server has.
rules_channel_idThe rules channel ID.
system_channel_idThe system messages channel ID.
afk_channel_idThe AFK voice channel ID.

Methods: get_member(id), get_members(), get_channel(id), get_channels(), get_role(id), get_roles(), get_emoji(id), get_emojis(), get_voice_state(user), get_my_member().

python
set_content(f"**{server.name}** has {server.member_count} members and {server.premium_subscription_count} boosts.")

channel#

A text, voice or thread channel.

AttributeWhat it is
idThe channel ID.
nameThe channel name.
mentionA link, like #general.
typeThe kind of channel.
topicThe channel topic.
positionIts place in the list.
parent_idThe category ID.
is_nsfwTrue for age-restricted channels.
rate_limit_per_userThe slowmode, in seconds.
last_message_idThe newest message ID.
created_atWhen it was made.

Methods: get_guild(), fetch_message(id), fetch_history(), fetch_pins().

message#

A Discord message, for example in a message event.

AttributeWhat it is
idThe message ID.
contentThe text.
authorWho sent it.
memberThe sender as a member.
channel_idWhere it was sent.
created_atWhen it was sent.
edited_timestampWhen it was last edited, or None.
attachmentsFiles on the message.
embedsEmbeds on the message.
reactionsReactions on the message.
stickersStickers on the message.
pollThe poll, if it is one.
is_pinnedTrue when pinned.
mentions_everyoneTrue when it pings @everyone.
user_mentions_idsIDs of users it pings.
role_mention_idsIDs of roles it pings.
channel_mention_idsIDs of channels it links.
referenced_messageThe message it replies to.
webhook_idSet when a webhook sent it.

Methods: get_member_mentions(), get_role_mentions(), make_link().

To edit or delete, use edit_message and delete_message. See Messages.

Role#

What you get from get_role(...), user.roles or user.top_role.

AttributeWhat it is
idThe role ID.
nameThe role name.
mentionA ping, like @VIP.
colorThe role color.
positionIts height in the role list.
permissionsWhat the role allows.
is_hoistedTrue when shown apart in the member list.
is_mentionableTrue when anyone can ping it.
is_managedTrue when a bot or app owns it.
unicode_emojiThe role icon emoji, if any.
created_atWhen it was made.

interaction#

The slash command, click or form submit that started the code.

AttributeWhat it is
idThe interaction ID.
guild_idThe server ID.
channel_idThe channel ID.
memberWho used it.
userWho used it, as a user.
localeThe user's Discord language.
created_atWhen it happened.
command_nameThe command name. Slash commands only.
optionsThe options typed in. Slash commands only.
custom_idThe button, menu or form ID. Clicks and forms only.
valuesWhat was picked in a menu, as a list. Clicks only.
messageThe message the button is on. Clicks only.

There is no interaction.get_channel(). Use the channel variable, or get_channel(...).

To reply, use defer_response, respond_interaction and send_modal. See Interactions.

Embed objects#

See Embeds for what you can read and change on an embed.

Constants#

NameUse
PermissionsPermission names, like Permissions.BAN_MEMBERS.
ColorA color, like Color.from_hex_code("#ff0000").
SpacingGap sizes for the separator in new-style messages.
PreviousUtilitiesNext Event variables

On this page

  • user
  • server
  • channel
  • message
  • Role
  • interaction
  • Embed objects
  • Constants
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