How to configure Message
In this guide, you will learn how to configure a message and everything you can do with it. Discord recently released a new format for bots called ComponentV2. This guide will explain how to create messages using this format. If you want to use the old format, you can refer to the Old Format Message page.
Messages support placeholders, you can put them in any part of the message, and they will be replaced with the corresponding value when the message is sent.
To make things easier for you, I have implemented the format on discord.builders, allowing you to create your messages with a convenient interface and directly generate the configuration!
Message Configuration
This is the main part of the message configuration. You set everything you want to display in the message here. The message is composed of components, which are the building blocks of the message. Each component has a type and can have various options.
- Support the following components:
text-display
,container
,section
,action-row
,media-gallery
,separator
,file
&repeat
.
ephemeral: #boolean, optional, if true the bot will send the message as an ephemeral message. Only works for messages from an interaction.
disable-mention: #boolean, optional, if true the bot will not mention rolses or users in the message.
components: # list of components, the components of the message
Components
As explained above, with Discord’s new format, all the content is now done through components. Below, you will find a list of all the possible components you can include in your message. There are no components that are required in a message.
Component Conditions
Each component supports conditions, these are exactly the same conditions you can find in scripts. They allow you to display a component only in certain cases, so your message can adapt to the context. You can find the list of available conditions here. The format is as follows:
components:
- type: <component-type> # The type of the component
conditions: # Optional, the conditions of the component
- id: <condition-id> # The id of the condition
args: # The arguments of the condition
<arg-name>: <arg-value> # The arguments of the condition
text-display
Text display are the default components to use when you want to display text. They are compatible with Discord’s markdown format, so you can create titles by adding # at the beginning of the line, etc.
The content option can be a list of strings, ItsMyBot will randomly select one of the results. This means each message will be unique!
type: text-display
content: #string | list
container
A container is a component that can contain other components. It is used to group components together and display them in a more organized way.
The color option can be a list of hexadecimal colors, ItsMyBot will randomly select one of the results.
- Support the following components:
text-display
,section
,action-row
,media-gallery
,separator
,file
&repeat
.
type: container
components: # list of components
spoiler: #boolean, optional
color: #hexadecimal color | list, optional
section
A section is a component that can contain a text display and an accessory. It is used to display a text with an accessory, like a button or an image. You can add multiple text displays in a section, and they will be displayed one after the other.
- Support the following components:
text-display
&repeat
. - Support the following accessories:
button
,thumbnail
.
type: section
components: # list of components
accessory: # accessory component
action-row
An action row is a component that can contain multiple components. It is used to display a row of components, like buttons or select menus.
- Support the following components:
button
,select-menu
&repeat
.
type: action-row
components: # list of components
media-gallery
A media gallery is a component that can contain multiple images. It is used to display a gallery of media files. Item also support conditions.
The url & description options can be a list of strings, ItsMyBot will randomly select one of the results.
type: media-gallery
items: # list of media items
separator
A separator is a component that adds a separator between components. It is used to separate components visually.
type: separator
spacing: #1 or 2
divider: #boolean, optional
file
A file component allows you to attach a file to the message. It can be used to send images, documents, or any other type of file.
The url option can be a list of strings, ItsMyBot will randomly select one of the results.
type: file
url: #url | list
spoiler: #boolean, optional
button
A button is a component that can be clicked by the user. It can be used to trigger an action or to navigate to a URL. You can also use the custom-id
option to identify the button when it is clicked.
The label, style, custom-id, url & emoji option can be a list of strings, ItsMyBot will randomly select one of the results.
To detect a button click with a script, the custom-id of the button needs to starts with script_
.
type: button
label: #string | list
style: #string | list, optional, default is primary
custom-id: #string | list, optional
url: #string | list, optional
emoji: #string | list, optional
disabled: #boolean, optional, default is false
select-menu
A select menu is a component that allows the user to select an option from a list.
The placeholder options can be a string or a list of strings, ItsMyBot will randomly select one of the results.
type: select-menu
custom-id: #string
options: # list of options
placeholder: #string | list, optional
min-values: #integer, optional, default is 1
max-values: #integer, optional, default is 1
data-source: #string, optional, the data source to use for the select menu, see the repeat component for more information
template: #list, optional, the template to use for the select menu
thumbnail
A thumbnail is a component that displays an image. It's used to display an image in a section.
The url option can be a list of strings, ItsMyBot will randomly select one of the results.
type: thumbnail
url: #url | list
repeat
A repeat compoent is a special compenent that don't exist in Discord. It's allow you to repeat the template multiple time depending on the content. Primarly used for pagination messages.
type: repeat
data-source: #string, the data source to use for the repeat component
template: #list, the template to use for the repeat component