channel.send(), message.reply(), user.send(), member.send() and the first message of forum.createPost() take a MessageInput: a text, or a MessageOptions object. interaction.reply() and webhook.send() take the same options with a few changes, listed at the end.
How to use all of this is in Sending messages. The messages you receive are described in Message.
MessageInput
MessageOptions
What a message can contain, and how it is sent. A message needs at least a content, an embed, a file, a component, a sticker or a poll.Buttons, select menus and layout components, made by ChapterJS: components declared with
button(), select()… and row(), text(), container()… See Components.Who the message is allowed to notify. See AllowedMentions.
A poll to attach to the message. See PollInput.
MessageEditOptions
What can be changed in a message that was already sent:message.edit() takes a text, or these fields of MessageOptions. Only what you pass changes: an empty list removes the embeds or the components, and the files you pass replace the ones of the message.
Buttons, select menus and layout components, made by ChapterJS: components declared with
button(), select()… and row(), text(), container()…FileInput
A file to attach to a message. Each file is sent with the message, and an embed can show it withattachment://<name> as the url of its image or thumbnail.
Discord documentation
asset()
public/ folder of the project, to send with a message: files: [asset('photos/monday.png')]. The file is read when the message is sent, so a missing file is an error there.
asset is imported from 'chapterjs' like everything else, and typed for your project by the .chapterjs/ folder: PublicFile is the union of the paths of every file of public/, so the editor lists them and underlines one that does not exist. The folder is read again by chapterjs dev every time a file is added or removed, and by chapterjs sync and chapterjs build. How to use it is in Files.
PublicFile
public/ folder of your project, as a path from it: 'photos/monday.png'. never while the folder is empty or missing.
AssetOptions
What can change about a file ofpublic/ when it is sent.
AssetFile
A file of thepublic/ folder of the project, made by asset(), to put in the files of a message. It is read when the message is sent.
Embed
A rich box in a message: title, description, fields, image… The same type describes theembeds of a message you receive: the fields marked “Set by Discord” are filled in the messages Discord sends back, and ignored when you send one.
The footer of the embed.
Set by Discord: the kind of embed (always
'rich' for the embeds a bot sends).Embed limits
Going over one throws an error that names the field, before anything is sent: see Limits and errors.
AllowedMentions
Who a message is allowed to notify. Without it, a message notifies everyone it mentions.The kinds of mentions of the text that notify:
[] notifies nobody.PollInput
A poll to attach to a message. Discord documentationComponents
components only takes what ChapterJS made: the buttons, menus and forms declared with button(), select() and modal(), and the layout helpers (row(), linkButton(), text(), section(), container()…). A plain object is refused before anything is sent, so no id is ever written by hand. Buttons that follow each other are put in rows of 5; a menu gets a row of its own.
A message with a text, a section, a gallery, a file, a separator or a container is built with components only: Discord shows no content and no embeds, and the message says so before leaving if you pass one. The pieces and their types are listed in Layout; how to use them is in Buttons and Embeds and layout.
Discord documentation
InteractionReplyOptions
The options of an answer: everything a message takes, exceptreplyTo and stickers. It is what interaction.reply() and interaction.followUp() take, as a text or as an object (InteractionReply); interaction.edit() takes a MessageEditOptions. See Interaction.
Only show the answer to who used the command. By default: what the command says with its own
ephemeral, else visible to everyone.WebhookMessageOptions
What a message posted with a webhook can contain: everything a message takes, exceptreplyTo, and these. It is what webhook.send() takes, as a text or as an object.
Discord documentation
Limits and errors
Every message is checked before it is sent, so a mistake is an error in your code with a plain message, not a refusal of Discord. The numbers are the ones of your message.
The text of an embed is counted without the spaces around it. What these checks don’t cover (a wrong
customId, an unknown sticker…) is refused by Discord with a DiscordApiError that says which field.