Message
Learn how to configure messages in ItsMyBot.
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.
If you want a faster starting point, open the Message Builder. It lets you compose your message with an interactive interface and generates the configuration for you. You can also use it to edit an existing message 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.
Prop
Type
ephemeral: true
components:
- type: "text-display"
content: "Hello there !"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:
Prop
Type
components:
- type: "text-display"
content: "Hello there !"
conditions:
- id: aboveMembers
args:
amount: 10Text Display
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!
Prop
Type
components:
- type: text-display
content: "Hello there !" # A simple text displayContainer
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.
Prop
Type
components:
- type: container
color: "#00ff00"
components:
- type: text-display
content: "This is a container with a text display."
- type: action-row
components:
- type: button
label: "Click me !"
style: "primary"
custom-id: "button1"Section
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.
Prop
Type
components:
- type: section
components:
- type: text-display
content: "This is a section with a text display."
- type: text-display
content: "You can add multiple components in a section."
accessory: # The accessory of the section, it can be a button or an image.
type: button
label: "Click me !"
style: "url"
url: "https://itsmy.studio/discord"Action Row
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.
Prop
Type
components:
- type: action-row
components: # A row of buttons, maximum 5 buttons per row
- type: button
label: "First Button"
style: "primary"
custom-id: "button1"
- type: button
label: "Second Button"
style: "url"
url: "https://itsmy.studio/discord"
- type: action-row
components: # Only one select menu can be in an action row
- type: select-menu
custom-id: "select1"
options:
- label: "Option 1"
value: "option1"
- label: "Option 2"
value: "option2"Media Gallery
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.
Prop
Type
Media Gallery Item
A media item is an object that represents a media file in the media gallery. It has the following properties:
Prop
Type
components:
- type: media-gallery
items: # A list of media items
- url: "https://example.com/image1.png" # The URL of the image
spoiler: true # Optional, if true the image will be a spoiler
- url: "https://example.com/image2.png" # The URL of the image
- url: "https://example.com/image3.png" # The URL of the image
description: "This is an image" # Optional, the description of the imageSeparator
separator
A separator is a component that adds a separator between components. It is used to separate components visually.
Prop
Type
components:
- type: separator
spacing: 1
- type: separator
spacing: 2 # A separator with more spacing
- type: separator
spacing: 1
divider: false # An invisible separatorFile
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.
Prop
Type
components:
- type: file
url: "https://example.com/file.txt" # The URL of the file
- type: file
url: "https://example.com/image.png" # The URL of the image
spoiler: true # Optional, if true the file will be a spoilerButton
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.
Prop
Type
components:
- type: action-row
components:
- type: button
label: "Click me !"
style: "primary" # The style of the button, can be primary, secondary, success, danger, link
custom-id: "button1" # The custom id of the button, used to identify the button when it is clicked
- type: button
label: "Go to Discord"
style: "link" # The style of the button, can be primary, secondary, success, danger, link
url: "https://itsmy.studio/discord" # The URL to navigate to when the button is clicked
- type: button
label: "Script Button"
style: "primary"
custom-id: "script_my_script" # Can be detected with a script
emoji: "👋" # The emoji to display on the button
- type: button
label: "Disabled Button"
style: "secondary"
disabled: true # The button is disabled, it cannot be clickedSelect Menu
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.
Prop
Type
Select Option
A select option is an object that represents an option in the select menu. It has the following properties:
Prop
Type
components:
- type: action-row
components: # A select menu, only one select menu can be in an action row
- type: select-menu
custom-id: "select1" # The custom id of the select menu, used to identify the select menu when it is selected
options: # The options of the select menu
- label: "Option 1"
value: "option1" # The value of the option, used to identify the option when it is selected
- label: "Option 2"
value: "option2"
- label: "Option 3"
value: "option3"
placeholder: "Select an option" # Optional, the placeholder of the select menu
min-values: 1 # Optional, the minimum number of values that can be selected
max-values: 2 # Optional, the maximum number of values that can be selectedThumbnail
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.
Prop
Type
components:
- type: section
components:
- type: text-display
content: "This is a section with a thumbnail."
accessory: # The accessory of the section, it can be a button or an image.
type: thumbnail
url: "https://example.com/image.png" # The URL of the imageRepeat
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.
Prop
Type
components:
- type: repeat
data-source: "pagination-items" # The data source to use for the repeat component.
template: # The template to use for the repeat component, it can be a list of components
- type: section
components:
- type: text-display
content: "This is a section with a text display."
accessory:
type: button
label: "Click me !"
style: "primary"
custom-id: "button1"
- type: separator
spacing: 1Script Interactions
Buttons and select menus can trigger scripts when their custom-id starts with script_.
See Script interaction custom-id format for the format and arguments, buttonClick for button variables, and selectMenuSubmit for select menu variables.