Bot administrators may define custom commands that users can use in Discord chat.

  • Bot commands are only operational in channels that are not ignored.
  • Commands may be reordered by dragging the checkerboard icons.
  • Unchecking the visible checkbox will remove the command from the !help menu.
  • To disable a command, either set a high authority level, or assign the command to a private category.

Command locale

If a locale is specified, the command will only be available in channels with that locale set or to channels with ‘All’ locales set.

  • Commands set to apply to all locales will work in any channel regardless of the locale setting.
  • To view all commands for all locales, check the box on the top right corner of the command admin page.

NOTE: Commands do not consider a user’s language if one applies to them.

Command keyword

The command will be triggered if a user enters one or more of its command keywords in chat.

  • Separate multiple command keywords with the ‘|’ symbol (don’t add spaces).

Example

!command1|!command2

Command authority

Select the minimum authority level of Bot users required use this command in chat. This refers to a bot authority, not a Discord role.

  • Specifying - All - will allow any Discord user (with chat permissions in the applicable channel) to trigger the command.

This does not apply to scheduled messages.

Command category

Select a category to restrict this command to channels within that category.

  • Specifying – All – will disable category restrictions on this command.

This does not apply to slash commands or scheduled messages.

Command cooldown

Select the cooldown period for this command.

  • Specifying - None - will use the default cooldown globally set for the server.

This does not apply to slash commands or scheduled messages.

Publish as slash command

  • Checking this option will publish the command as a Discord slash command.
    • Slash commands must begin with a /.
    • Additional command variables are available for slash commands.
    • There may be a delay before slash commands are published.

Remove previous

  • The trailing checkmark indicates that previous responses to this keyword will be removed.

This does not apply to slash commands.

Command text

When a command is triggered the Bot will output its associated text to Discord chat in the channel where the command was issued.

Command variables

Variables may be specified within the command text.

VariableDescriptionSlash*Msg**
${addField:NAME:TEXT}Add field NAME to the embed with the value TEXT.
${addReaction:EMOJI_ID}Add a Discord reaction identified by EMOJI_ID. EMOJI_ID is the internal Discord ID of the reaction. This is the numeric value obtained by typing a backslash \ followed by an emote in Discord chat (number part only). Only emoji that the Bot can access are possible.
– For regular commands, this will add the reaction to the message that triggered the command.
– For welcome messages, this will add the reaction to the welcome message.
– No reactions are added for DM messages.
${addRole:ROLE_ID}Add a Discord role identified by ROLE_ID to the user. Only roles that the Bot can assign are possible. ROLE_ID is the internal Discord ID of the role.
${addRoles:ROLE_IDS}Add all Discord roles identified by the comma-separated ROLE_IDS list to the user. Only roles that the Bot can assign are possible. ROLE_IDS are the internal Discord IDs of each role.
${alert:TEXT}Display TEXT as a non-modal alert at the top of the Bot UI whenever this command or message is updated by the user.
${announce:BOOL} If BOOL is non-zero and the output channel is an announcement channel, the message will be sent as an announcement, otherwise the message is sent as normal.
${argN[:DEFAULT]}Output the Nth argument provided to the command. If the argument is not set then DEFAULT is output. Example: The second argument was ${arg2}
${args[:DEFAULT]}Output all arguments provided to the command. If the command has no arguments, then DEFAULT is output. Example: You just typed ${command} followed by ${args}
${assert:EXPRESSION}Generates an error if the result of evaluating EXPRESSION is false. Example: ${assert:4+2==7} will throw an error that will trigger the ${catch} block.
${attach:URL=FILENAME}Attach file at URL to the message with the given FILENAME. Example: ${attach:https://picsum.photos/id/237/200/300=dog.jpg}
${autocountdown:DATE}Outputs a countdown to DATE in the applicable locale. The countdown will be auto decremented. Previous auto countdown messages will be deleted if the command is issued again, even if remove previous is not checked. Auto countdown messages will be automatically deleted when the countdown time expires.
${autotimer:DD:HH:MM} Outputs a timer counting down until the specified time. The timer will be auto decremented. Previous auto timer messages will be deleted if the command is issued again, even if remove previous is not checked. Auto timer messages will be automatically deleted when the timer expires.
${botName}Output the name of the Bot.
${buttonPressed}Outputs the UNIQUEID if the Button component that was pressed. This does not apply to LINK buttons that redirect to a URL.
${case:CASE}Text following this variable will be output by a ${switch:CONDITION} variable when CONDITION matches CASE.
${catch}Text following this variable will be output in the case of an error instead of the preceding text. Example: Channel topic is: ${channelTopic} ${catch} This channel has no topic! will output This channel has no topic! if no topic is set for the current channel, otherwise it will output Channel topic is: TOPIC
${categoryName}Output the name of the category.
${channelLocale}Output the locale code of the channel, if the channel has one set.
${channelName}Output the name of the channel.
${channelTopic}Output the topic of the current channel, if any.
${command}Output the command that was specified. Example: You just typed ${command}
${count:LIST}Outputs the number of items in LIST. Example: ${count:Apples,Pears,Bananas} will output 3.
${countdown:DATE}Outputs a countdown to DATE in the applicable locale. Example: The next livestream will be in ${countdown:Jan 1, 2021 10:00 PST}
${createButtonComponents[:UNIQUEIDS]}Output Button components specified by ${setButton...:} methods. If UNIQUEIDS (comma-separated) is specified then only output those components. If more than 5 buttons are defined, then this will output up to 5 rows of 5 button components each.
${createModalComponent[:UNIQUEID]}Output the modal dialog specified by ${createTextInputComponent:} methods. If UNIQUEID is specified then only output that component. Example: ${setTextInputLabel:INPUT1=Enter your height.}
${createTextInputComponent:INPUT1:MODAL1}
${createModalComponent:MODAL1}
${createSelectComponents[:UNIQUEIDS]}Output SelectMenu components specified by ${setSelect...:} methods. If UNIQUEIDS (comma-separated) is specified then only output those components. If more than 5 select menus are defined, then this will output up to 5 rows of 5 select menu components each.
${createTextInputComponent:UNIQUEID:MODALID}Output the Text input component identified by UNIQUEID in the modal dialog identified by MODALID. The ${setTextInput…:} methods must be called first.
${customapi:API}Output text from the specified custom API.
${date:DATE}Output the specified DATE in the applicable locale. If DATE is not specified, the current UTC date will be used.
${error}The error that caused the command to fail. Use this in ${catch} blocks.
${eval:EXPRESSION}Outputs the result of evaluating EXPRESSION. Example: ${eval:4+2} will output 6.
${expiry}Date and time the command will expire.
${finally}...${/finally}Processes the block ... at the end of the current section of the script. If multiple finally blocks are specified they will be processed in the reverse order that they were defined.
${form[:MODALID]}...${/form[:MODALID]}Denotes a form context for a Discord slash command Modal components. A command with multiple forms may designate the unique MODALID of the modal that can trigger the form. Multi-form modals are not currently supported by the API.
${get:VARIABLE}Output the value from VARIABLE. Example: ${set:FOO=BAR} The variable FOO is set to "${get:FOO}"
${getCommandData:FIELD}Output command data from FIELD. Common fields include: visible, publish, command_name, help_text.
${getComponentXXXX}Get the value XXXX for component for the current component. Example: ${getComponentLabel} will return the label set for the button that was pressed.
${getFieldValue:UNIQUEID[:DEFAULT]}Output the value of the Discord slash command Text input field identified by UNIQUEID.If no value is set, use DEFAULT.
${getOption:OPTION}Get the value of a Discord slash command OPTION. Example: ${getOption:color}
${getRoleName:ID}Outputs the name of the role identified by ID.
${getRoleNames:ID1,ID2,...}Outputs the names of the roles identified by ID1, ID2,....
${getSelectedOption:UNIQUEID}Output the selected option of the Discord slash command SelectMenu component identified by UNIQUEID. Useful for single value selections.
${getSelectedOptions:UNIQUEID}Output the selected options of the Discord slash command SelectMenu component identified by UNIQUEID. These will be returned in a comma-separated list. Useful for multi-selections.
${getValue:UNIQUEID[:DEFAULT]}Output the value(s) of the SelectMenu component identified by UNIQUEID. Multi-value components will return a comma-separated list. If no value(s) are set, use DEFAULT.
$(hasRole:ROLE_ID} Outputs 1 if the user has ROLE_ID, otherwise 0. ROLE_ID is the internal Discord ID of the role.
${help}Output the list of available commands for the current channel.
${i18n:TEXT}Output localized TEXT. If a translation can’t be found in the Bot’s localization database, TEXT will be output.
${if:EXPRESSION,TRUE,FALSE}Output TRUE if EXPRESSION is true, otherwise output FALSE.
${ifdef:VARIABLE,TRUE,FALSE}Output TRUE if VARIABLE is defined, otherwise output FALSE.
${ifset:VALUE}...${/ifset:VALUE}Output the contents ... if VALUE is non-empty and non-zero. Example: ${ifset:${channelTopic}}
The topic for this channel is "${channelTopic}"
${/ifset:${channelTopic}}
${ifunset:VALUE}...${/ifunset:VALUE}Output the contents ... if VALUE is empty or zero.
${ifset:VALUE,TRUE,FALSE}Output TRUE if VALUE is non-empty and non-zero, otherwise output FALSE.
${in:LIST1,LIST2}Output all the entries in LIST2 that are in LIST1.
${isPressed:UNIQUEID}Outputs true if the Button component identified by UNIQUEID has been pressed.
${joinedDiscord}Output the date/time that the user joined Discord (in the applicable date/time locale).
${joinedServer}Output the date/time that the user joined the server (in the applicable date/time locale).
${locale}Output the computed locale based on the locale fallback priority.
${memberID}Output the numeric Discord member id of the user.
${memberLevel}The member’s level.
${memberLocale}Output the locale code of the user, if the user has chosen a language role.
${memberName}Output the Discord username of the user (Nickname will be used if present).
${memberTag}Output the user’s Discord tag (clickable link to the user’s profile). Note that this will not ping/notify the user if output in an embed.
${notin:LIST1,LIST2}Output all the entries in LIST2 that are not in LIST1.
${numericautocountdown:DATE} Same as ${autocountdown:DATE} but with a numeric output. Example: 00:30:21
${numericautotimer:DD:HH:MM} Same as ${autotimer:DD:HH:MM} but with a numeric output.
${numericcountdown:DATE} Same as ${countdown:DATE} but with a numeric output.
${numericdate:DATE}Same as ${date:DATE} but with a numeric output.
${numerictime:TIME} Same as ${time:TIME} but with a numeric output.
${popup:TEXT}Display TEXT as a modal popup message in Bot UI whenever this command or message is updated by the user.
${popupalert:TEXT}Display TEXT as a modal popup alert message in Bot UI whenever this command or message is updated by the user.
${prompt:ID[:DEFAULT]} Get prompt ID value from the Command admin UI. If not set then use DEFAULT.
${replace:TEXT,A,B}Output TEXT with all occurrences of A replaced with B.
${random:MIN,MAX}Output a random integer between MIN and MAX. Example: Rolling a D20 ... ${random:1,20}
${randomWord}Output a random word.
${removeRole:ROLE_ID} Remove the Discord role identified by ROLE_ID from the user. ROLE_ID is the internal Discord ID of the role.
${removeRoles:ROLE_IDS} Remove the Discord roles identified by the comma-separated ROLE_IDS list from the user. ROLE_IDS are the internal Discord IDs of each role.
${response} Text following this variable will be output in response to message components.
${schedule:DATE} Schedules a command to be posted on DATE or a scheduled message to start on DATE.
${sendDM:TEXT}TEXT is sent to the user via DM.
${sendText:TEXT}Output TEXT in chat without using an embed.
${sendReminder:REMINDER} Broadcast REMINDER to bot users.
${set:VARIABLE=VALUE} Set VARIABLE to VALUE.
${setAuthor:AUTHOR}Set the author field of the embed to AUTHOR.
${setButtonEmoji:UNIQUEID=EMOJI_ID}Set the Emoji of the Button component identified by UNIQUEID. EMOJI_ID is the numeric value obtained by typing a backslash \ followed by an emote in Discord chat (number part only). Only emoji that the Bot can access are possible.
${setButtonDisable:UNIQUEID=BOOL}Disable the Button component identified by UNIQUEID if BOOL is true.
${setButtonLabel:UNIQUEID=LABEL}Set the Label of the Button component identified by UNIQUEID.
${setButtonStyle:UNIQUEID=STYLE}Set the Style of the Button component identified by UNIQUEID. STYLE may be Danger, Link, Primary, Secondary, Success. Default is Primary
${setButtonURL:UNIQUEID=URL}Set the URL of the Button component identified by UNIQUEID. This only applies to buttons with Style set to Link.
${setColor:#COLOR}Set the color of the embed to #COLOR.
${setDefer:BOOL}Defers the command or component response if BOOL is true. Note: For deferred ephemeral responses, specify this last. Example: ${setEphemeral:TRUE}${setDefer:TRUE}
${setEphemeral:BOOL}Sets the command or component response to ephemeral if BOOL is true. Note: For deferred ephemeral responses, specify this first. Example: ${setEphemeral:TRUE}${setDefer:TRUE}
${setFooter:FOOTER}Set the footer of the embed to FOOTER.
${setFollowUp:BOOL}Sends the Discord slash command response as a follow up message if BOOL is true.
${setImage:IMAGE}Set the embed’s image to IMAGE.
${setModalTitle:UNIQUEID=TITLE}Set the title of the Discord slash command Modal dialog component identified by UNIQUEID.
${setNoReply:BOOL}Removes the reply part of the Discord slash command if BOOL is true.
${setOptionChoice:OPTION=CHOICE}Set an OPTION choice for Discord slash commands of type Integer or String. Multiple choices can be specified. Example: ${setOptionChoice:color=red} ${setOptionChoice:color=green}${setOptionChoice:color=blue}
${setOptionDescription:OPTION=DESC} Set the description of the OPTION for Discord slash commands.
${setOptionRequired:OPTION=BOOL} Set if the OPTION is required for Discord slash commands. Option will be required if BOOL is true, otherwise it will be optional.
${setOptionType:OPTION=TYPE}Set the type of the OPTION for Discord slash commands. Valid option types include: String, Integer, Number , Boolean, User, Channel, Role.
${setOutputChannel:CHANNELID}Sends the output of the command to the the numeric CHANNELID instead of the channel the command was executed in.
${setPromptHelp:ID=HELP}Set the HELP text for prompt ID.
${setPromptLabel:ID=LABEL} Set the LABEL for prompt ID. Default is to use ID.
${setPromptOption:ID=OPTION[,VALUE]}Set an option and optional value for prompt ID. ID must be defined as a SELECT type. Example: ${setPromptType:COLOR=SELECT}${setPromptOption:COLOR=0000FF,Blue}
${setPromptOption:COLOR=00FF00,Green}${setPromptOption:COLOR=FF0000,Red}
${setPromptRequired:ID=BOOL} Set if the prompt ID is required for input in the Command admin UI. Prompt will be required if BOOL is true, otherwise it will be optional.
${setPromptType:ID=TYPE} Prompts the Bot user for input of TYPE in the Command admin UI. TYPE may be Boolean, Date, Emoji, Channel, Integer, Number, Role, Select, String, Text, Time, User. Default is String
${setProtectionMode:MODE} Sets the protection mode for the command or scheduled message.
0: Source is visible and editable by all Bot users with the Change server settings authority.
1: The Bot user must have the Change server settings and Advanced admin authorities before they can view or edit the source.
2: Only the original author of the command or scheduled message may view or modify the source.
${setSelectDescription:UNIQUEID=DESC}Set the description of the SelectMenu component identified by UNIQUEID.
${setSelectMinCount:UNIQUEID=COUNT}Set the minimum number of selections possible for a SelectMenu component identified by UNIQUEID. Only required for multi-selections.
${setSelectMaxCount:UNIQUEID=COUNT}Set the maximum number of selections possible for a SelectMenu component identified by UNIQUEID. Only required for multi-selections.
${setSelectOption:UNIQUEID=OPTION[,VALUE]}Set an option and optional value for a SelectMenu component identified by UNIQUEID.
${setSelectType:UNIQUEID=TYPE}Set the TYPE of a SelectMenu component identified by UNIQUEID. TYPE may be String. Default is String
${setTargetArg:n}Set the target of the command to the user specified in argument n. The argument must either be a Discord user @tag or a numeric Discord user id. Other command operations will then reference this user.
${setTextInputLabel:LABEL}Set the Label of the Discord slash command Text input component identified by UNIQUEID.
${setTextInputMaxLength:UNIQUEID=MAX}Set the maximum number of characters for the Discord slash command Text input component identified by UNIQUEID.
${setTextInputMinLength:UNIQUEID=MIN}Set the minimum number of characters for the Discord slash command Text input component identified by
${setTextInputPlaceholder:UNIQUEID=TEXT}Set the placeholder text for the Discord slash command Text input component identified by UNIQUEID.
${setTextInputRequired:UNIQUEID=BOOL}Set the Discord slash command Text input component identified by UNIQUEID as required if BOOL is true, otherwise it will be optional.
${setTextInputStyle:UNIQUEID=STYLE}Set the Style of the Discord slash command Text input component identified by UNIQUEID. STYLE may be Paragraph, Short. Default is Short
${setTextInputValue:UNIQUEID=VALUE}Set the default value of the Discord slash command Text input component identified by UNIQUEID.
${setThumbnail:THUMBNAIL}Set the embed thumbnail to THUMBNAIL.
${setTitle:TITLE}Set the embed’s title to TITLE.
${setURL:URL}Set the embed’s URL to URL.
${shift[:DEFAULT]}Output the first argument then shift argument list to the left. If the argument is not set then DEFAULT is output. Example: The first 3 arguments are: ${shift},${shift},${shift}
${stop:DATE} Stops a command or scheduled message on DATE.
${switch:CONDITION}The text of a matching ${case:CASE} variable will be output if CASE matches CONDITION. For example: ${switch:Apple} will output the text that follows the ${case:Apple} variable. Multiple case variables can be contained within a single command.
${then} Text following this variable will be otput when a timed event has completed or for non-timed commands it will be output last, unless an error triggers a ${catch} block. Ensure this is the last block in the command. Timed commands such as ${autocountdown} and ${autocounttimer} are not permitted in ${then} blocks.
${time:TIME}Output the specified TIME in the applicable locale. If TIME is not specified, the current UTC time will be used.
${toLowerCase:TEXT}Outputs lower-case TEXT.
${toUpperCase:TEXT}Outputs capitalized TEXT.
${trigger:COMMAND[ ARGS]}Triggers another COMMAND, passing any arguments. A command cannot trigger itself.
${triggerNew:COMMAND[ ARGS]} Triggers another COMMAND in a new message, passing any arguments. A command cannot trigger itself.
${trim:TEXT}Trims leading and trailing whitespace from TEXT.
${tz}Outputs the timezone of the Bot user. This is only available in commands or scheduled messages inside a UI operation such as ${popup}.
${tznumericdate:TIMEZONE[:LOCALE]}Output the current numeric date in TIMEZONE and optional LOCALE.
${tznumerictime:TIMEZONE[:LOCALE]}Output the current numeric time in TIMEZONE and optional LOCALE.
${tzdate:TIMEZONE[:LOCALE]}Output the current formatted date in TIMEZONE and optional LOCALE. Example: ${tzdate:Europe/Paris:en-US} may output 8/15/2023.
${tztime:TIMEZONE[:LOCALE]}Output the current formatted time in TIMEZONE and optional LOCALE. Example: ${tztime:Europe/Paris:en-US} may output 12:00:54 AM.
${unixtimestamp:DATE TIME TZ}Outputs DATE and TIME as a Unix epoch timestamp that can be used in Discords <t:UNIXTIMESTAMP:R>format. Example: ${unixtimestamp: 22/12/2023 13:37 PDT}
${urlEncode:URL}Will escape the URL.
${userCount}Output the number of active users on the server.
* Checked if available in slash commands. ** Checked if available in scheduled messages.

Discord text formatting

CodeDescription
*text*Italic text
**text**Bold text
***text***Bold and italic text
_text_Underscore text
~~text~~Strikethrough
``text`` Fixed pitch text
```
text
text
```
Multi-line fixed pitch text
> textQuoted text
||text||Spoiler text
<t:timestamp:FORMAT>Format unix timestamp. FORMAT can be:
t 5:35 PM
T 5:35:00 PM
d 07/25/2022
D July 25, 2022
f July 25, 2022 5:35 PM
F Monday, July 25, 2022 5:35 PM
R in 2 minutes
<#ID>Mention channel with numeric ID
<@ID>Mention user with numeric ID
<@&ID>Mention role with numeric ID
<:CustomEmote:ID>Show a custom emote with numeric ID
<a:CustomEmote:ID>Show an animated custom emote with numeric ID
[text](URL)Masked links
# Big header
## Smaller header
### Even smaller header
Heading styles
- List item
* List item
- Indented list item
* Indented list item
List formatting
The above formats may be used inside certain Discord messages and embeds.

Debugging commands

The last error(s) that occured when a command is executed will be displayed beneath the command text in the Bot UI.

Security

Command administration requires that the Bot user has the ‘Change server settings’ authority.

Viewing and editing source of protected commands requires that the Bot user has the ‘Advanced admin’ authority.

  • The source code of commands set with protection mode 2 may only be viewed or edited by the original creator of that command.

See also

Was this page helpful?