DISCORD_LIMITS
Per-element ceilings the Discord API enforces — the renderer degrades (truncate/clamp) rather than failing when a limit is hit.
Overview
DISCORD_LIMITS is the typed constant the renderer (renderComponents) uses to enforce every Discord API ceiling in one place. Import it when you need to validate or pre-truncate data yourself before passing it to the renderer.
import { DISCORD_LIMITS } from "@copilotkit/bot-discord";Limits table
| Key | Value | Applies to |
|---|---|---|
componentsPerMessage | 40 | total components (nested counted) in a Components V2 message |
textDisplayChars | 2000 | chars per TextDisplay component |
totalTextChars | 4000 | total text chars summed across the message |
buttonsPerRow | 5 | buttons per action row |
actionRows | 5 | action rows per message |
selectOptions | 25 | options per StringSelectMenu |
selectPlaceholder | 150 | chars per select placeholder |
customId | 100 | custom_id chars (buttons and selects) |
buttonLabel | 80 | button label chars |
headerText | 256 | header line chars (a TextDisplay rendered with # prefix) |
Degradation behavior
The renderer degrades instead of failing when a limit is hit:
- Text truncation — over-long text in
TextDisplay, button labels, andcustom_idvalues is truncated with a trailing…so the output never exceeds the limit. - Array clamping — sub-collections (select options, action rows, buttons per row) are sliced to their cap. Overflow items are dropped without a marker.
- Unknown intrinsics — component types the renderer does not recognise are silently skipped; nothing ever throws.
Related
- renderComponents — the renderer that enforces these limits
- discord() — the adapter