Skip to main content

Module object

Module object 

Source
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 events names wire event types, groups of them, or *; some groups also need a capability.
flags
Message flags (u32, Discord’s values).

Structs§

ActionRow
Type 1.
Activity
An activity (§10.5).
Admission
How a member was admitted (§8.3).
AdmissionOverrides
invite.create.admission_overrides: stricter-only admission settings (§8.6).
AdmissionPolicy
The full admission policy (§8.9). Visible to MANAGE_SAFETY holders.
ApplicationCommand
An application command (§8.14).
Attachment
An attachment record (§8.5): what a message carries, and what attachment.download and attachment.updated answer.
AuditChange
changes: [{field, old, new}]. SPEC: value types are never given; raw JSON.
AuditEntry
An audit entry (§8.8).
AuditTarget
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).
ChannelAfter
{channel_id, after} (sync.resume, §10.3).
ChannelCursor
{channel_id, seq} (sync.ack, §10.5).
ChannelFloor
{channel_id, floor} (sync.resume.floors, §10.3, §10.6).
ChannelHead
{channel_id, head_seq, floor} (sync.resume.new, §10.3).
ChannelPosition
One entry of channel.reorder and channel.reordered (§8.2, §9.2).
Checkbox
Type 23. Never required; use a one-option checkbox group for that.
CheckboxGroup
Type 22.
Choice
A predefined choice of an option, or an autocomplete result.
CommandOption
An option of a command or subcommand.
CommunityProfile
The host-managed community profile (§8.1 community.update; community.get; community.updated).
ConfigKey
One setting a bot declares in its manifest’s config table; the owner sets its value.
Container
Type 17.
Cursors
The cursors a binding command returns (community.create, invite.redeem, membership.request).
DefaultValue
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, timestamp and url alone do not count).
EmbedAuthor
author: {name, url?, icon?} of an embed.
EmbedField
fields: [{name, value, inline}] of an embed.
EmbedFooter
footer: {text, icon?} of an embed.
Empty
An empty body or response, {}. Unknown fields are ignored.
EntitySelect
Types 5–8.
Evidence
One evidence item (§8.10).
FileComponent
Type 13.
FileUpload
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).
InteractionMetadata
interaction_metadata of a message that answers an interaction.
InviteLink
A zaun://join/… link. It embeds the crate::ids::InviteSecret, so Debug is redacted; the text is reachable only through InviteLink::expose.
InviteSummary
One entry of invite.list (§8.6). Never carries the secret.
InviteUse
One entry of invite.uses (§8.6).
JoinRate
join_rate: {per_hour} (§8.9).
Label
Type 18.
Lockdown
The full lockdown record (§8.10), for MANAGE_SAFETY holders: { lockdown_id, restrictions, forced_slowmode_s?, newcomer_window_s?, expires_at, reason?, actor_id }.
LockdownPublic
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 by moderation.lockdown.updated.
Manifest
The manifest inside a bot package (§8.13).
ManifestLimits
Resource limits a manifest asks for; the host may lower them.
MediaGallery
Type 12.
MediaItem
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).
MessageBody
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).
OptionValue
One option of an invoked command.
Override
A permission override on a channel or category (permissions §2.2).
PolicySummary
The public summary (§8.9): {level, requires_approval, invite_creation, open}. Hosts MUST send open.
RadioGroup
Type 21.
ReactionCount
reactions: [{emoji, count, me}] (§8.5).
Report
A report (§8.10). Only for MANAGE_REPORTS holders 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?} of sync.resume.resync and RESYNC_REQUIRED (§10.2, §10.3).
Retention
Message retention of a channel (§8.2).
Role
A role (§8.4). Visible to every member.
RolePosition
One entry of role.reorder and role.reordered (§8.4, §9.2).
Section
Type 9.
SelectOption
One option of a string select, radio group or checkbox group.
Separator
Type 14.
SignedRotation
A SignedRootRotation in JSON (§4.6): {bytes, sig_old, sig_new}, all base64url. Kept undecoded, like crate::json::SignedJson; the signed module verifies it.
StringSelect
Type 3.
SubmittedInput
One submitted modal input.
TextDisplay
Type 10.
TextInput
Type 4.
Thumbnail
Type 11.
VoiceParticipant
One member in a voice channel.

Enums§

ActivityType
What the member is doing.
AdmissionVia
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
kind of a bot.
BotState
state of an installed bot.
ButtonStyle
Button style: 1 primary, 2 secondary, 3 success, 4 danger, 5 link.
ChoiceValue
A choice value: a string or a number.
CommandType
type of a command: 1 CHAT_INPUT (a slash command), 2 USER, 3 MESSAGE (context menus).
Component
One component (§8.14). The variant is the wire type number.
DefaultValueKind
default_values entry kind of an entity select.
IcePolicy
Which ICE candidates clients may use.
InteractionData
data of an interaction, by type.
InteractionType
type of an interaction (Discord’s numbers; PING is not used).
InviteCreation
invite_creation (§8.9).
LockdownView
A lockdown as the viewer may see it. The full form is tried first. On disable or expiry, moderation.lockdown.updated carries the inactive public form to every member, MANAGE_SAFETY holders included (§8.10).
OptionType
type of an option (Discord’s numbers 1–11).
OptionValueKind
An option value as the invoker gave it: a string, number, boolean or id.
Outcome
outcome (§8.10).
OverrideTarget
The subject of an override: {"t":"role","c":RoleId} or {"t":"member","c":MemberId}.
PolicyLevel
level (§8.9).
PolicyView
The full policy or the public summary, by the viewer’s permissions (admission.policy.updated body, §9.2). The full form is tried first.
ReportCategory
category (§8.10).
ReportStatus
status (§8.10): a plain string (§7.5), exactly "open"|"reviewing"|"resolved".
ReportTarget
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 stream field and the §10.3 example ("stream": "channel"), not {t}.
TextInputStyle
Text input style: 1 short, 2 paragraph.
UploadFailure
failure of 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|c notation.

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, unique ids and custom_ids.
check_modal
A modal (MODAL response): custom_id, title 1–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’s attachments, 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 config key: [a-z][a-z0-9_]{0,63}.
find_interactive
The enabled interactive component (button with a custom_id, or a select) with custom_id among a message’s components: what a MESSAGE_COMPONENT interaction 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_network entry: host:port exactly, where host is localhost, 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 content and embeds as JSON, counted against MESSAGE_JSON_MAX.
message_json_len_with
message_json_len plus the message’s components (§8.14), which count against the same MESSAGE_JSON_MAX.
modal_inputs
The input components of a modal (everything inside its labels), in order.