Expand description
Object shapes shared by command bodies, responses and events (specification §8–§10).
Enum convention (§7): values the spec writes bare (category, pause_joins, …) or as
{t, c} use the tagged form {"t": .., "c": ..}. SPEC: values the spec writes as quoted
string alternatives ("open" | "reviewing", "invite" | "request", "stored",
"access_gained", and "community"/"member"/"channel" in the §10 JSON examples) are
plain JSON strings here, because the §10.1 and §10.3 examples show them that way. §7 says
every enum inside a body is tagged; the two rules disagree for these fields.
Re-exports§
pub use role::COLOR_MAX;
Modules§
- bot_
events - Which events a bot gets (specification §8.13 “Events”): a manifest’s
eventsnames wire event types, groups of them, or*; some groups also need a capability. - flags
- Message flags (u32, Discord’s values).
Structs§
- Action
Row - Type 1.
- Activity
- An activity (§10.5).
- Admission
- How a member was admitted (§8.3).
- Admission
Overrides invite.create.admission_overrides: stricter-only admission settings (§8.6).- Admission
Policy - The full admission policy (§8.9). Visible to
MANAGE_SAFETYholders. - Application
Command - An application command (§8.14).
- Attachment
- An attachment record (§8.5): what a message carries, and what
attachment.downloadandattachment.updatedanswer. - Audit
Change changes: [{field, old, new}]. SPEC: value types are never given; raw JSON.- Audit
Entry - An audit entry (§8.8).
- Audit
Target target: {t, c}of an audit entry.- Ban
- One entry of
member.bans(§8.3). - Binding
session.welcome.binding(§6.2).- BotCard
- The public description of an installed bot, visible to every member (§8.13).
- Button
- Type 2.
- Capabilities
- What a bot may do beyond its permission bits. Every field defaults to “no”.
- Channel
- A channel or category as members see it (§8.2).
- Channel
After {channel_id, after}(sync.resume, §10.3).- Channel
Cursor {channel_id, seq}(sync.ack, §10.5).- Channel
Floor {channel_id, floor}(sync.resume.floors, §10.3, §10.6).- Channel
Head {channel_id, head_seq, floor}(sync.resume.new, §10.3).- Channel
Position - One entry of
channel.reorderandchannel.reordered(§8.2, §9.2). - Checkbox
- Type 23. Never required; use a one-option checkbox group for that.
- Checkbox
Group - Type 22.
- Choice
- A predefined choice of an option, or an autocomplete result.
- Command
Option - An option of a command or subcommand.
- Community
Profile - The host-managed community profile (§8.1
community.update;community.get;community.updated). - Config
Key - One setting a bot declares in its manifest’s
configtable; the owner sets its value. - Container
- Type 17.
- Cursors
- The cursors a binding command returns (
community.create,invite.redeem,membership.request). - Default
Value - A preselected entity of a user, role, mentionable or channel select.
- Embed
- An embed (§8.5). Every text is optional, but an embed shows something: a title, a
description, an author, a footer, a picture or a field (
color,timestampandurlalone do not count). - Embed
Author author: {name, url?, icon?}of an embed.- Embed
Field fields: [{name, value, inline}]of an embed.- Embed
Footer footer: {text, icon?}of an embed.- Empty
- An empty body or response,
{}. Unknown fields are ignored. - Entity
Select - Types 5–8.
- Evidence
- One evidence item (§8.10).
- File
Component - Type 13.
- File
Upload - Type 19.
- Grants
- A bot’s grants: permission bits (its managed role) and capabilities.
- IceServer
- One ICE server, in the shape of WebRTC’s
RTCIceServer. - Interaction
- An interaction as delivered to its bot (
interaction.created). - Interaction
Metadata interaction_metadataof a message that answers an interaction.- Invite
Link - A
zaun://join/…link. It embeds thecrate::ids::InviteSecret, soDebugis redacted; the text is reachable only throughInviteLink::expose. - Invite
Summary - One entry of
invite.list(§8.6). Never carries the secret. - Invite
Use - One entry of
invite.uses(§8.6). - Join
Rate join_rate: {per_hour}(§8.9).- Label
- Type 18.
- Lockdown
- The full lockdown record (§8.10), for
MANAGE_SAFETYholders:{ lockdown_id, restrictions, forced_slowmode_s?, newcomer_window_s?, expires_at, reason?, actor_id }. - Lockdown
Public - The public form (§8.10), for members without
MANAGE_SAFETY:{active, restrictions_affecting_you, expires_at}. With no active lockdown (disabled or expired) it is{active: false, restrictions_affecting_you: [], expires_at: null}, sent to every member bymoderation.lockdown.updated. - Manifest
- The manifest inside a bot package (§8.13).
- Manifest
Limits - Resource limits a manifest asks for; the host may lower them.
- Media
Gallery - Type 12.
- Media
Item - One picture of a media gallery.
- Member
- A member as visible to the viewer (§8.3). Optional fields depend on the viewer’s permissions; the host filters them.
- Mentions
mentions: {everyone, members, roles}(§8.5).- Message
- A stored message as returned by
message.history(§8.5). - Message
Body - Content, embeds, components, attachments, mentions and flags of a bot’s message.
- NewProfile
profile: {display_name}of a joining or creating member (§8.1, §8.6, §8.9).- Opaque
- Opaque bytes, base64url on the wire (key packages, wrapped keys, signalling data).
- Option
Value - One option of an invoked command.
- Override
- A permission override on a channel or category (permissions §2.2).
- Policy
Summary - The public summary (§8.9):
{level, requires_approval, invite_creation, open}. Hosts MUST sendopen. - Radio
Group - Type 21.
- Reaction
Count reactions: [{emoji, count, me}](§8.5).- Report
- A report (§8.10). Only for
MANAGE_REPORTSholders and, without other reporters’ data, the reporter. - Resolution
resolution: {outcome, note?, actor_id, at}(§8.10).- Resolved
- Objects an interaction refers to, resolved by the host.
- Resync
{stream, channel_id?}ofsync.resume.resyncandRESYNC_REQUIRED(§10.2, §10.3).- Retention
- Message retention of a channel (§8.2).
- Role
- A role (§8.4). Visible to every member.
- Role
Position - One entry of
role.reorderandrole.reordered(§8.4, §9.2). - Section
- Type 9.
- Select
Option - One option of a string select, radio group or checkbox group.
- Separator
- Type 14.
- Signed
Rotation - A
SignedRootRotationin JSON (§4.6):{bytes, sig_old, sig_new}, all base64url. Kept undecoded, likecrate::json::SignedJson; thesignedmodule verifies it. - String
Select - Type 3.
- Submitted
Input - One submitted modal input.
- Text
Display - Type 10.
- Text
Input - Type 4.
- Thumbnail
- Type 11.
- Voice
Participant - One member in a voice channel.
Enums§
- Activity
Type - What the member is doing.
- Admission
Via admission.via(§8.3). SPEC: a plain string ("invite" | "request"), not{t}.- Availability
availability(§8.5). SPEC: a plain string, as written in the spec.- BotKind
kindof a bot.- BotState
stateof an installed bot.- Button
Style - Button
style: 1 primary, 2 secondary, 3 success, 4 danger, 5 link. - Choice
Value - A choice
value: a string or a number. - Command
Type typeof a command: 1CHAT_INPUT(a slash command), 2USER, 3MESSAGE(context menus).- Component
- One component (§8.14). The variant is the wire
typenumber. - Default
Value Kind default_valuesentry kind of an entity select.- IcePolicy
- Which ICE candidates clients may use.
- Interaction
Data dataof an interaction, by type.- Interaction
Type typeof an interaction (Discord’s numbers;PINGis not used).- Invite
Creation invite_creation(§8.9).- Lockdown
View - A lockdown as the viewer may see it. The full form is tried first. On disable or expiry,
moderation.lockdown.updatedcarries the inactive public form to every member,MANAGE_SAFETYholders included (§8.10). - Option
Type typeof an option (Discord’s numbers 1–11).- Option
Value Kind - An option value as the invoker gave it: a string, number, boolean or id.
- Outcome
outcome(§8.10).- Override
Target - The subject of an override:
{"t":"role","c":RoleId}or{"t":"member","c":MemberId}. - Policy
Level level(§8.9).- Policy
View - The full policy or the public summary, by the viewer’s permissions
(
admission.policy.updatedbody, §9.2). The full form is tried first. - Report
Category category(§8.10).- Report
Status status(§8.10): a plain string (§7.5), exactly"open"|"reviewing"|"resolved".- Report
Target target: {t: "member"|"message", c}(§8.10).- Restriction
- One lockdown restriction (§8.10).
- Stream
- An event stream (§9.1). SPEC: a plain string, as in the §7.4
streamfield and the §10.3 example ("stream": "channel"), not{t}. - Text
Input Style - Text input
style: 1 short, 2 paragraph. - Upload
Failure failureof an upload (§8.5): why the host does not hold it.
Constants§
- AUDIT_
ACTIONS - Every audit action of §8.8, expanded from its
a.b|cnotation.
Functions§
- check_
commands - Every command’s rules, the per-type counts and unique names; at most 8 000 scalars of text per command.
- check_
embeds - The state-free rules of a message’s embeds (§8.5): at most 10, each valid and showing
something, at most 6 000 scalars of text in all. With
attachments, every picture an embed shows must be one of them (check_pictures). - check_
message_ components - A message’s components: at most five action rows without
IS_COMPONENTS_V2, the V2 layout kinds with it; at most 40 in all, uniqueids andcustom_ids. - check_
modal - A modal (
MODALresponse):custom_id,title1–45 and 1–5 labels or text displays. - check_
pictures - Every picture an embed shows (
image,thumbnail,author.icon,footer.icon) is one of the message’sattachments, so it travels the attachment path like any file and nobody fetches it from elsewhere. - component_
attachments - Every attachment the components show (thumbnails, gallery pictures, files), with the field naming it; each must be an attachment of the same message.
- config_
key_ ok - A
configkey:[a-z][a-z0-9_]{0,63}. - find_
interactive - The enabled interactive component (button with a
custom_id, or a select) withcustom_idamong a message’s components: what aMESSAGE_COMPONENTinteraction may name. - host_
pattern_ ok - A DNS name, optionally with one leading
*.label: letters, digits and-, at least two labels, ≤ 253 bytes, lower case. - local_
address_ ok - A
local_networkentry:host:portexactly, where host islocalhost, an IPv4 literal, a bracketed IPv6 literal or a lowercase DNS name, and port 1-65535 without a leading zero. No scheme, path or wildcard. - message_
json_ len - The bytes of a message’s
contentandembedsas JSON, counted againstMESSAGE_JSON_MAX. - message_
json_ len_ with message_json_lenplus the message’s components (§8.14), which count against the sameMESSAGE_JSON_MAX.- modal_
inputs - The input components of a modal (everything inside its labels), in order.