Skip to main content
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

A message to send: its text, or its options.

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.
string
The text of the message (up to 2000 characters).
(Embed | EmbedDeclaration<[]>)[]
Up to 10 embeds: written here, or declared with embed(). See Embed and embed().
MessageComponent[]
Buttons, select menus and layout components, made by ChapterJS: components declared with button(), select()… and row(), text(), container()… See Components.
(FileInput | AssetFile)[]
Up to 10 files to attach: their content, or asset() for a file of public/. See FileInput and asset().
AllowedMentions
Who the message is allowed to notify. See AllowedMentions.
Snowflake[]
The ids of up to 3 stickers of the server.
PollInput
A poll to attach to the message. See PollInput.
boolean
Reads the message aloud.
boolean
Sends the message without a notification sound.
boolean
Does not show the previews of the links of the message.
Snowflake | { id: Snowflake }
The message to reply to.
Discord documentation

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.
string
The text of the message (up to 2000 characters).
(Embed | EmbedDeclaration<[]>)[]
Up to 10 embeds: written here, or declared with embed().
MessageComponent[]
Buttons, select menus and layout components, made by ChapterJS: components declared with button(), select()… and row(), text(), container()…
(FileInput | AssetFile)[]
Up to 10 files to attach: their content, or asset() for a file of public/.
AllowedMentions
Who the message is allowed to notify.
boolean
Does not show the previews of the links of the message. false shows them again.
Discord documentation

FileInput

A file to attach to a message. Each file is sent with the message, and an embed can show it with attachment://<name> as the url of its image or thumbnail.
string
required
The name of the file, with its extension: chart.png.
Blob | Uint8Array | ArrayBuffer | string
required
The content of the file.
string
What the file shows, for people who can’t see it.
boolean
Hides the file until it is clicked.
string
The media type of the file (image/png); guessed from the name when missing.
Discord documentation

asset()

A file of the 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

A file of the 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 of public/ when it is sent.
string
The name the file is sent under; by default its own name.
string
What the file shows, for people who can’t see it.
boolean
Hides the file until it is clicked.
string
The media type of the file (image/png); guessed from the name when missing.

AssetFile

A file of the public/ folder of the project, made by asset(), to put in the files of a message. It is read when the message is sent.
string
required
The name the file is sent under, with its extension.
string
required
The path of the file inside public/.
string
What the file shows, for people who can’t see it.
boolean
Hides the file until it is clicked.
string
The media type of the file; guessed from the name when missing.

Embed

A rich box in a message: title, description, fields, image… The same type describes the embeds 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.
string
The title of the embed (256 characters at most).
string
The text of the embed (4096 characters at most).
string
The link the title opens.
string
A date shown in the footer, as an ISO 8601 text: new Date().toISOString().
number
The color of the left border, as a number: 0x5865f2.
The footer of the embed.
EmbedImage
The large image of the embed.
EmbedImage
The small image in the top right corner. Same fields as image.
EmbedAuthor
The author line, above the title.
EmbedField[]
Up to 25 fields, shown under the description.
'rich' | 'image' | 'video' | 'gifv' | 'article' | 'link' | 'poll_result'
Set by Discord: the kind of embed (always 'rich' for the embeds a bot sends).
EmbedVideo
Set by Discord: the video of an embed made from a link.
EmbedProvider
Set by Discord: the site an embed made from a link comes from.
number
Set by Discord: the flags of the embed, as a bitfield.
Discord documentation

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.
('roles' | 'users' | 'everyone')[]
The kinds of mentions of the text that notify: [] notifies nobody.
Snowflake[]
The ids of the roles to notify (100 at most).
Snowflake[]
The ids of the users to notify (100 at most).
boolean
For a reply, whether to notify the author of the message replied to. By default false.
Discord documentation

PollInput

A poll to attach to a message.
PollMedia
required
The question of the poll. Only text is supported.
PollAnswer[]
required
Each of the answers available in the poll, up to 10.
number
How many hours the poll stays open, up to 32 days. By default 24.
boolean
Whether a person can pick several answers. By default false.
1
The layout of the poll. There is only one: 1, the default.
Discord documentation

Components

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, except replyTo 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.
boolean
Only show the answer to who used the command. By default: what the command says with its own ephemeral, else visible to everyone.
Discord documentation

WebhookMessageOptions

What a message posted with a webhook can contain: everything a message takes, except replyTo, and these. It is what webhook.send() takes, as a text or as an object.
string
Shows this name instead of the name of the webhook.
string
Shows this avatar instead of the avatar of the webhook.
Snowflake
Sends the message in this thread of the channel of the webhook.
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.