API: Discord Limits¶
Discord's limits on a message, its components, modals, and interactions, and where each one is caught. A limit is caught in one of three places:
- When built. discord.py, or a CascadeUI constructor or builder, raises as the component is made or added.
- Before the send. CascadeUI checks the tree at
send(), atrefresh(), and at the edit apush()orpop()makes, andvalidate()runs the same checks with nothing sent. A refusal raisesValueErrornaming the component and the fix, and nothing reaches Discord. - Discord. Nothing checks it first. Discord refuses the request with HTTP 400, which discord.py raises as
discord.HTTPException, and the error names the field.
The values are Discord's, from its API reference, unless a row says otherwise, and a row says so where CascadeUI refuses more than Discord does. Layout Rules and Limits explains where each component can go and how to count what a panel holds.
Components¶
| Limit | Value | Caught |
|---|---|---|
| Components in a V2 message, counted through the tree | 40 | When built: discord.py refuses the 41st add_item(), and CascadeUI's error names the count and a fix |
| Rows in a V1 message | 5 | When built: discord.py refuses an item with no room, and CascadeUI's error names what each row holds |
| Buttons in an action row | 5 | When built (discord.py) |
| A select | A row to itself | When built: discord.py gives a V1 select a row of its own, and refuses a V2 select added after a button. Before the send, for a V2 select added first |
| Text in a section | 1 to 3, beside one button or thumbnail | When built, for a fourth text or no accessory= (discord.py). Before the send, for none |
| Children of a container | No count of its own beyond the message's 40. CascadeUI refuses an empty one | Before the send |
| Items in a media gallery | 1 to 10 | When built, for an 11th added (discord.py) and for gallery(). Before the send, for a gallery built with more or none |
| Options in a string select | Up to 25. CascadeUI refuses a select with none | When built, for StatefulSelect, Dropdown, choice_row(), and a 26th add_option(). Before the send, for any select |
A select's min_values and max_values |
0 to 25, and 1 to 25 | When built, for CascadeUI's selects. Before the send, for any select, and for a minimum above the maximum or above the options |
default_values on a user, role, channel, or mentionable select |
From min_values to max_values |
Before the send |
Options marked default in a string select |
At most max_values. Fewer than min_values is accepted |
Before the send |
| A button's or a select option's emoji | A standard emoji or a custom emoji. An empty one, a plain word such as fire, and a custom emoji whose id is not 13 to 20 digits are refused |
When built, for CascadeUI's buttons, options, builders, and *_emoji class attributes. Before the send, for a discord.py button or option. Discord, for a symbol that is not an emoji and an id that names no emoji |
custom_id |
Unique in the message | Before the send |
Component id |
1 to 2147483647, unique in the message | When built, for a builder's id=. Before the send, for any component. Discord reads 0 as no id and picks one, and CascadeUI refuses 0 instead |
A panel with more controls than one message holds can spread them across pages or
tabs. On V2, text joined into one TextDisplay counts as one component, however many
lines it holds.
Text¶
| Text | Characters | Caught |
|---|---|---|
custom_id |
1 to 100 | Before the send. When built, for an id a builder composes from its custom_id= and a key |
| Button label | 80 | Before the send. When built, for a tab's name and a roles panel's format_button_label(). When the class is defined, for a *_button_label attribute and a PaginatedRegion subclass's labels |
| Link button URL | 512 | Before the send |
| Select placeholder | 150 | Before the send |
| Option label, value, and description | 100 each | Before the send. When built, for a modal input's options |
TextDisplay content |
4000 | Before the send |
Text of spaces, tabs, or line breaks alone, in a TextDisplay, a button label, or an option label |
Counts as empty | When built, for card() and the other text builders, button_row, and tab_nav. Before the send, for the rest |
All TextDisplay content in one V2 message |
4000 | Not refused. The send or edit that takes a message past it logs a warning naming the total |
| Media description, on a thumbnail or a gallery item | 1024 (MAX_MEDIA_DESCRIPTION_CHARACTERS) |
Before the send |
The two 4000 figures are discord.py's, and Discord's component reference gives neither. A display past 4000 is refused before the send. The total only warns, since a refusal there could turn away a message Discord accepts.
content_length() gives a V2 view's running total and count_characters() what a part
would add, to compare against MAX_MESSAGE_CHARACTERS. Both count TextDisplay content only: a button's label or an
option's text fills the message without reaching either total.
Messages¶
| Limit | Value | Caught |
|---|---|---|
content, on a V1 message |
2000 characters | Discord. A PaginatedView page refuses longer text when the view is built |
| Files | 10 | Discord. Its reference gives no number, and a request with 11 is refused ("Must be 10 or fewer"). CascadeUI logs a warning when the files it adds take a request past 10 |
A V2 message takes no content or embeds: its text is in its components.
Embeds¶
| Limit | Value |
|---|---|
| Embeds on a message | 10 |
| Title | 256 characters |
| Description | 4096 characters |
| Fields | 25 |
| Field name | 256 characters |
| Field value | 1024 characters |
| Footer text | 2048 characters |
| Author name | 256 characters |
| Title, description, field names and values, footer text, and author name, across every embed on the message | 6000 characters |
discord.py refuses an 11th embed before the request, and Discord refuses the rest. len(embed) gives one embed's share
of the 6000.
Modals¶
| Limit | Value | Caught |
|---|---|---|
| Components in a modal | 1 to 5 | When built, for a sixth (discord.py). At open_modal(), for none |
| Title | 45 characters | When built |
| An input's label | 45 characters | When built |
| An input's description | 100 characters | When built |
A TextInput's placeholder |
100 characters | When built |
A TextInput's default |
4000 characters | When built |
A TextInput's min_length and max_length |
0 to 4000, and 1 to 4000 | When built |
A TextInput's default against its min_length and max_length |
Within both. An empty default is not sent | When built |
Options in a CheckboxGroup |
1 to 10 | When built |
Options in a RadioGroup |
2 to 10 | When built |
min_values and max_values on a CheckboxGroup or FileUpload |
0 to 10, and 1 to 10 | When built |
"When built" here is CascadeUI's Modal and its inputs (TextInput, Checkbox, CheckboxGroup, RadioGroup,
FileUpload), each refusing as it is made. See Modals and Inputs.
Interactions¶
| Limit | Value |
|---|---|
| Time to answer an interaction | 3 seconds |
| Life of its token, for followups and edits of the answer | 15 minutes |
- By default a view acknowledges a click its callback has not answered by
auto_defer_delay(2.5 seconds), so a slow callback does not miss the 3 seconds. See One Answer Within 3 Seconds. - An ephemeral message is edited only through an interaction: the one that sent it, for its 15 minutes, or a click on the message. See The 15-Minute Limit.
- A modal opens only as the first answer to an interaction. A modal's submission is one, so its callback can open another modal.