Skip to main content
An embed used in several messages is declared with embed(), in any file of src/, and exported. It is the embed itself, or a function of what it shows.
src/components/welcome.ts
src/events/greet.ts
That is all: welcome(member) returns the embed, checked against the limits of Discord when the message is sent. An embed that always looks the same is given directly, and used without calling it:
src/components/rules.ts
src/commands/rules.ts
A static embed is checked when the file loads, so a title over 256 characters is an error in chapterjs dev before anything is sent. What an embed can hold is in Embed.
embed() and EmbedDeclaration are in the reference; every layout helper of this page is in Layout.

Messages made of components

Discord can show a message made of components only: texts, sections with a thumbnail or a button beside them, galleries of images, files, separators, and containers with a colored line like an embed. Write them with the helpers of 'chapterjs', where the message is:
src/commands/profile.ts
As soon as a message has one of these, Discord shows components only: it takes no content and no embeds, and ChapterJS says so before sending if you pass one. Put the text in text(), and the look of an embed in a container(). A picture of a gallery or a thumbnail is a link, or a file of the message with attachment://name. The files of your bot live in public/, and asset() picks one with the help of your editor:
src/commands/photos.ts
A message of buttons and menus only holds 5 rows at most (a menu takes a row by itself). A message built with these pieces holds 40 components at most, rows and the pieces inside containers included. Going over a limit throws before anything is sent, with the limit in the message.

Sending messages

Everything a message can contain, and where it goes.

Buttons

Run code when a button is clicked.