Skip to main content

Module command

Module command 

Source
Expand description

Command bodies and their responses (specification §6.2, §8, §10).

The envelope module hands Command::parse the envelope’s type and raw body JSON. Bodies never carry authorship, timestamps, sequence numbers or ids for new objects (§7.1); unknown fields are ignored. Optional fields (x?) may be absent or null; fields written without ? are required, and x: T | null without ? is required but nullable. In update commands an absent field keeps the value and null clears it (crate::json::Patch); null on a non-nullable field is BAD_REQUEST.

Command::parse decodes and runs the state-free checks (Validate); checks that need community state (permissions, hierarchy, existence) are the engine’s.

Modules§

app
command.set and command.list (specification §8.14).
attachment
Attachment commands (specification §8.5, “Attachments”). Both are channel-scoped: the channel is the envelope’s channel_id.
audit
audit.list (specification §8.8).
bot
Bot management commands (specification §8.13). Install, update, grant, enable, disable, remove and register are the owner’s alone; list and get are open to every member.
channel
Channel commands (specification §8.2, permissions §2, §4.4). Responses are Channel or {}.
community
Community commands (specification §8.1).
dm
Direct messages between a bot and a member (specification §8.15), and the member’s own setting for them.
interaction
Interaction commands (specification §8.14): interaction.create from members, and the bot’s interaction.respond, follow-ups and original edits.
invite
Invitation commands (specification §8.6, permissions §4.7).
lockdown
Emergency lockdown commands (specification §8.10, governance §9).
member
Member commands (specification §8.3). Most respond with a Member or {}. Paged lists answer with next?, the after of the next page, absent on the last page (§8.3).
membership
Membership and admission commands (specification §8.9, §6.4).
message
Message and reaction commands (specification §8.5). All are channel-scoped: the channel is the envelope’s channel_id.
migration
Host migration commands (specification §13 migration.*, migration.md, ADR-0013).
object
Object shapes shared by command bodies, responses and events (specification §8–§10).
presence
A member’s custom status text (member.status.set, kept by the host) and the current presences (presence.list, live only) (specification §8.3, §10.5).
report
Report commands (specification §8.10). Most respond with a Report.
role
Role commands (specification §8.4, permissions §4.2). Responses are Role or {}.
session
session.hello and its session.welcome response (specification §6.2).
signal
Ephemeral signals (specification §10.5): commands without responses (request_id null), never journaled.
sync
Synchronization commands (specification §10.1–§10.3, §10.5).
voice
Voice commands (specification §8.12, “Voice channels”).

Enums§

BodyError
A body that cannot be accepted. Each variant maps to one error code of §11; the envelope layer adds request_id, the message text and the extra fields.
Command
A decoded command body: one variant per command of §8 and §10.5.
TypeClass
What a command type string is to a v1 host.

Constants§

RESERVED_COMMANDS
The reserved governance commands of §8.11: answered with UNSUPPORTED_FEATURE.
RESERVED_NAMESPACES
Reserved type namespaces of §13 (prefixes including the dot): answered with UNSUPPORTED_COMMAND; v1 clients ignore events in them.

Traits§

Body
A command body type: its wire name and response body type.
BodyVisitor
Something done with a command body of a type known only at run time (Command::visit).
Validate
State-free checks of one body.

Functions§

classify
Classifies a command type. Exact, case-sensitive matching.
max_envelope
The largest command envelope for type_ in bytes (§12): max_frame for community.create and community.descriptor.publish, else 65 536.