Send & Edit a Message
Last updated
Last updated
Both the send and edit message action blocks are similar, both featuring a message builder as their main component. Here, you can start to create a new message that can contain embeds, buttons, select menus and much more.
Starting at the message content, a message builder has four tabs: content, embeds, components and flags. Each tab will allow you to customise your message further, and even change the way it acts (e.g., whether you would like your message to be hidden).
With each message, you must either have content or an embed with a description.
Embeds are essentially boxes of text, yet unlike any other message, embeds are much more customisable. Within a single embed, you can set a title, colour, footer, add fields etc. On a message builder, a single message can have up to ten embeds.
In a single embed, you can edit the author, body, fields, footer and images. Starting with the author, you can edit its name, icon URL and URL. Author properties will be visible at the top of the embed, as shown below.
Next, the body of an embed is one of the most important parts of an embed, allowing you to set a title, description, URL and colour. Embed descriptions can have up to 4000 characters each, and titles will automatically be bold. With an author set and multiple body components, this is how an embed looks:
Moving onto an embed's fields, fields can be a way to organize your embed's description into sections. With each field you create, you can name it and set it's value (description). However, fields can also be toggled to be inline. Meaning, the fields will instead line up horizontally. See below for an example.
Footers, similar to authors, allow you to set a icon URL along with some text. Though, footers will appear at the bottom of an embed, and a timestamp can be toggled. The timestamp will signify when the embed was sent e.g., "Today at 3:59 PM".
Footer timestamps are relative, meaning that they will change with time. For instance, after a day passes, the timestamp will automatically change to "Yesterday at 3:59 PM" without the embed being marked as edited.
Lastly, you can add images to your embed. Featuring two different types, the first image will be shown at the bottom of an embed above the footer. Next, a thumbnail image can be set which will appear in the top right corner.
You can overcome the requirement of an embed description by setting the description to simply a space character. From here, you can create distinctive types of embeds, such as an image-only embed. Used mainly for decoration, it goes to show how customisable embeds are!
Only an embed description can feature Discord fonts, such as bold or italic. This includes the ability to tag members, channels and other formats such as timestamps.
Featuring multiple types, components allow you to add buttons and select menus to your message. These components can be used to offer the interacting user a selection of actions or options. For example, a user select menu will allow the member to pick a user from the current server.
In the image above, there are four buttons available for users to pick from. Each button serves a different purpose, and some are locked for some users by using permission or role conditions. Unlike select menus, buttons are simple, whereby users can only interact by clicking it.
Select menus, however, can be more complicated. Featuring several different types: string, channel, role, user and mentionable, users can interact with select menus in multiple ways. For a string select menu, users can pick from multiple options that you create.
With each select menu you create, you will always be able to set a placeholder. Without an option pre-set (such as in the example above), the placeholder on a select menu will be visible. For example, in the image below, the placeholder is "Make a selection here...".
All other select menu types, such as the channel select menu, will permit you to select from a list of channels. Handy for selecting a user to moderate, for example, a mentionable select menu provides a list of both members and roles for the member to choose from.
To refer to what a user selected in a select menu, you can use {interaction[values.0]}
. The number in the variable will be which component you grab the value of, and this starts counting at 0. So, if your select menu is the 2nd component, you can use {interaction[values.1]}
.
Flags are simply a list of settings for your message, such as enabling whether you want the message's replies to be hidden. Or, toggling the pings on the message, to avoid accidental pings. Below is an example of the flags page, and all of the options you can modify.
Apart from the message builder, a send message block will have more options to customize. Starting with the message location, you can select whether you want your message to be a reply. Its important to note, that ephemeral (hidden) messages must be set as replies.
Else, messages that do not reply to another can be set to send to the current channel, a specific guild channel, to a channel ID or to a user's DMs. Variables can also be used for a channels location.
Lastly, your bot can auto-react to your new message if you add emojis in the reactions tab. This can include regular and custom emojis from any server your bot is in.
This block has a few options, as you simply select the message you wish to edit and modify the message builder into your new message. When selecting a message, you can either enter a message ID, variable or select a block from your current builder.