Skip to main content

Module limits

Module limits 

Source
Expand description

Protocol limits (specification §5.2, §10.5, §12). Hosts may be stricter and report the effective values in session.welcome.limits.

Human-text limits count Unicode scalar values; each also has a byte ceiling of 4× that.

Constants§

ACK_CHANNELS
sync.ack channels.
ACTIVITY_MAX
Presence activity, maximum scalars.
APP_CHOICE_TEXT
Choice name and string value, scalars.
APP_COMMANDS
Application commands per bot: CHAT_INPUT, USER, MESSAGE (§8.14).
APP_COMMAND_DESCRIPTION
Command and option description (CHAT_INPUT), scalars.
APP_COMMAND_NAME
Command and option name, scalars.
APP_COMMAND_OPTIONS
Options per command or subcommand, and choices per option.
APP_COMMAND_TEXT_TOTAL
All names, descriptions, choice names and values of one command, scalars.
APP_LOCALIZATIONS
Localized names per field.
APP_OPTION_LENGTH_MAX
String option min_length / max_length bound.
ATTACHMENTS_PER_MESSAGE
Attachments per message.
ATTACHMENT_MIME_MAX
Attachment media type, bytes.
ATTACHMENT_NAME
Attachment file name, scalars.
ATTACHMENT_SIZE_MAX
Largest attachment the protocol allows, in bytes (XFTP’s 1 GiB); hosts set lower limits.
AUTOCOMPLETE_CHOICES
Autocomplete choices.
BAN_DELETE_WINDOW_MAX_MS
Ban message-deletion window upper bound in milliseconds (7 days).
BOTS_PER_COMMUNITY
Bots per community.
BOT_COMPONENT_MAX
The WebAssembly component inside a bot package, bytes.
BOT_CONFIG_KEYS
Settings a bot may declare (config).
BOT_CONFIG_VALUE_MAX
A setting’s value or default, bytes.
BOT_DESCRIPTION_MAX
A bot’s description, scalars.
BOT_HEADER_MAX
Bot package header, manifest and component sizes, bytes (§4.9).
BOT_LOCAL_NETWORK
local_network addresses a bot may ask for.
BOT_MANIFEST_MAX
The manifest JSON inside a bot package, bytes.
BOT_NETWORK_HOSTS
Network hosts a bot may ask for.
BOT_STORAGE_MAX
A bot’s key-value storage quota, bytes.
BULK_DELETE_MAX
Most message ids in one messages.bulk_deleted event (§9.2).
BUTTON_LABEL_MAX
Button label, scalars.
CAPABILITIES
session.hello capabilities: count and bytes each.
CHANNELS_PER_COMMUNITY
Channels per community, including categories.
CHANNEL_NAME
Channel name length.
CHANNEL_TOPIC_MAX
Channel topic, maximum scalars.
CHECKBOX_OPTIONS
Checkbox group options.
COLOR_MAX
Largest role colour, 0xFFFFFF (§8.4).
COMMUNITY_DESCRIPTION_MAX
Community description, maximum scalars.
COMMUNITY_NAME
Community name length (scalars).
COMPONENTS_TOTAL
Components in one message, counting nested ones.
COMPONENT_CUSTOM_ID
Component custom_id, bytes.
COMPONENT_ROWS
Top-level action rows of a message without IS_COMPONENTS_V2.
COMPONENT_ROW_BUTTONS
Buttons per action row.
DAY_MS
One day in milliseconds.
DISPLAY_NAME
Member display name length.
DM_OPENS_PER_MINUTE
New DMs one bot may open per minute (§8.15).
DM_UNANSWERED_PER_HOUR
Messages a bot may write into a DM per hour while the member has never written in it.
EMBEDS_PER_MESSAGE
Embeds per message (§8.5).
EMBED_AUTHOR_NAME
Embed author.name, scalars.
EMBED_DESCRIPTION
Embed description, scalars.
EMBED_FIELDS
Fields per embed.
EMBED_FIELD_NAME
Embed field name, scalars.
EMBED_FIELD_VALUE
Embed field value, scalars.
EMBED_FOOTER_TEXT
Embed footer.text, scalars.
EMBED_TEXT_TOTAL
The text of all of a message’s embeds together (titles, descriptions, field names and values, author names, footer texts), scalars.
EMBED_TITLE
Embed title, scalars.
EMBED_URL_MAX
Embed url and author.url, maximum bytes.
EMOJI_MAX_BYTES
Emoji, maximum bytes.
FILE_UPLOAD_MAX
Files in one file upload.
FRAGMENT_TIMEOUT_MS
Milliseconds from the first to the last fragment before a reassembly is discarded.
ICE_FIELD_MAX
Longest ICE server URL, username or credential, in bytes.
ICE_SERVERS_MAX
Most ICE servers a host lists in voice.join.
ICON_MAX
Descriptor icon, maximum bytes (PNG or WebP).
IDEMPOTENCY_RETENTION_MS
Idempotency record retention lower bound in milliseconds.
INTERACTION_ANSWER_MS
Interaction answer deadline, ms (§8.14).
INTERACTION_FOLLOWUPS
Follow-ups per interaction.
INTERACTION_LIFETIME_MS
Follow-ups, edits and modal submits are accepted this long after the interaction, ms.
INVITE_EXPIRY_MAX_MS
Invite expiry upper bound in milliseconds (30 days).
INVITE_MAX_USES
Invite max_uses upper bound (0 means unlimited).
IN_FLIGHT_DEFAULT
Default in-flight window in SMP messages per member.
IN_FLIGHT_MAX
Highest configurable in-flight window (half the 128-message SMP queue stays free).
IN_FLIGHT_MIN
Lowest configurable in-flight window (the largest frame must fit).
LABEL_TEXT
Label label and description, scalars.
LAST_N
last_n history bounds.
LOCKDOWN_MS
Lockdown duration bounds in milliseconds per enable (60 s – 7 days).
MAX_CANONICAL_FIELD
Unlisted variable-length fields in canonical encodings (specification §3.1).
MAX_COMMAND
Maximum command envelope, except community.create and community.descriptor.publish.
MAX_FRAGMENTS
Fragments per frame.
MAX_FRAME
Maximum reassembled envelope in bytes.
MAX_OPEN_REASSEMBLIES
Open reassemblies per connection; a further one discards the oldest.
MEDIA_DESCRIPTION_MAX
Media description, scalars.
MEDIA_GALLERY_ITEMS
Media gallery items.
MENTION_MEMBERS
Member mentions per message.
MENTION_ROLES
Role mentions per message.
MESSAGE_CONTENT
Message content length. The content may be empty when the message has an attachment or an embed (§8.5).
MESSAGE_JSON_MAX
A message’s content and embeds together, as JSON bytes the host writes them (message_json_len), so that every message, message event and report fits a page. One message.send never exceeds it (its envelope is at most MAX_COMMAND); an edit that adds long content beside large stored embeds can.
MODAL_ITEMS
Top-level modal items.
MODAL_TITLE
Modal title, scalars.
NEWCOMER_WINDOW_MAX_S
Largest lockdown newcomer_window_s: 30 days, in seconds (§8.10).
OVERRIDES_PER_CHANNEL
Overrides per channel.
PAGE_BYTES
The items of one paged response (message.history messages, sync.events events, report.list reports; for sync.resume, the whole body), as JSON bytes: below MAX_FRAME by enough for the envelope, so a page always fits one frame. A host stops before it would exceed this and signals the rest (has_more, next); it always keeps the first item, except in sync.resume, whose streams continue with sync.events.
PAGE_LARGE
Page size: member.list, sync.events.
PAGE_SMALL
Page size: message.history, audit.list, invite.list, invite.uses, member.bans, membership.pending, report.list.
PENDING_EXPIRY_MAX_MS
Pending expiry upper bound in milliseconds (30 days); default 7 days.
PENDING_PER_COMMUNITY
Pending members per community.
PROTOCOL_VERSION
Protocol version defined by this crate (specification §1.1).
RADIO_OPTIONS
Radio group options.
REACTIONS_PER_MESSAGE
Distinct reaction emoji per message.
REASON_MAX
Moderation reason, maximum scalars.
REPORT_DESCRIPTION_MAX
Report description, maximum scalars.
REPORT_EVIDENCE_MAX
Report evidence, maximum messages.
REPORT_NOTE_MAX
Report resolution note, maximum scalars.
REPORT_SNAPSHOT_BYTES
The evidence snapshots (content and embeds as JSON) one rendered report carries; the first snapshot always goes, and evidence_next names where the rest continue.
REQUEST_NOTE_MAX
Membership request note, maximum scalars.
RESUME_CHANNELS
sync.resume: channels per request.
RESUME_EVENTS_PER_STREAM
sync.resume: events per stream.
ROLES_PER_COMMUNITY
Roles per community, including @everyone.
ROLES_PER_MEMBER
Roles per member.
ROLE_NAME
Role name length.
ROTATIONS_PAGE
Page size: community.rotations (§8.1).
SECTION_TEXTS
Section text displays.
SELECT_OPTIONS
Select options.
SELECT_OPTION_TEXT
Select option label, value, description, scalars.
SELECT_PLACEHOLDER_MAX
Select placeholder, scalars.
SIGNAL_INTERVAL_MS
Minimum interval between signals per member per channel, in milliseconds.
SLOWMODE_MAX_S
Slowmode upper bound in seconds.
SNAPSHOT_PAGE
sync.snapshot page.
SUSPENSION_MAX_MS
Suspension upper bound in milliseconds (90 days), or until restored.
TEXT_DISPLAY_TOTAL
All text displays of one message or modal together, scalars.
TEXT_INPUT_MAX
Text input value and length bounds, scalars.
TEXT_INPUT_PLACEHOLDER_MAX
Text input placeholder, scalars.
TIMEOUT_MAX_MS
Timeout upper bound in milliseconds (28 days).
TYPING_COUNT_CAP
The largest count of an anonymous signal.typing (§10.5): 3 means “three or more”, so a larger channel never learns exactly how many are typing.
UNBOUND_DEADLINE_MS
Unbound connection deadline (default) in milliseconds.
VOICE_KEY_PACKAGE_MAX
Largest key_package of voice.join, decoded bytes (opaque to the host; the media layer’s packages are 4 680 bytes).
VOICE_MESH_MAX
The most participants a voice channel can have on any host (mesh_max ≤ this). Every participant’s key package is in the voice.join response, which must fit in MAX_FRAME (9 base64 packages of VOICE_KEY_PACKAGE_MAX bytes are about 74 KiB), and one voice.keys for the whole mesh must fit in MAX_COMMAND.
VOICE_SENDER_KEYS_MAX
Largest sender_keys of voice.keys, decoded bytes: the sender’s signed message for one epoch, the same for every recipient (the media layer’s are at most 5 468 bytes).
VOICE_SIGNAL_MAX
Largest data of voice.signal (WebRTC SDP or ICE), decoded bytes.
VOICE_USER_LIMIT
user_limit of a voice channel.
VOICE_WRAPPED_KEY_MAX
Largest wrapped key of one voice.keys entry, decoded bytes (the media layer’s are 1 168 bytes).

Functions§

text_within
Whether text has between min and max Unicode scalar values and at most 4× max bytes.