Interface: types
Generated from zaun:bot@0.2.0 (wit/ in zaun-bot). Do not edit.
Shared data types. Shapes follow the protocol. WIT has no recursive types, so nesting (containers, sections, sub-commands) is spelled out level by level.
type
A Zaun id: base64url without padding (22 characters for 16-byte ids).
type id = string;timestamp
Section titled “timestamp”type
Milliseconds since the Unix epoch.
type timestamp = u64;permissions
Section titled “permissions”type
A permission bitfield (permissions.md the protocol).
type permissions = u64;host-error
Section titled “host-error”record
What the host refused, mirroring the protocol’s error codes.
| Member | Description |
|---|---|
code: string |
FORBIDDEN, NOT_FOUND, BAD_REQUEST, RATE_LIMITED, CONFLICT, PAYLOAD_TOO_LARGE, NOT_GRANTED (a capability the bot lacks), UNSUPPORTED (this host does not implement the call or this case of it yet), … |
detail: option<string> |
The reason or field the host gave, if any. |
retry-after-ms: option<u64> |
For RATE_LIMITED and BUSY. |
member
Section titled “member”record
| Member | Description |
|---|---|
member-id: id |
|
display-name: string |
|
role-ids: list<id> |
|
joined-at: timestamp |
|
bot-id: option<id> |
Present only for bots. |
voice-channel: option<id> |
The voice channel the member is in, if any and if the bot can see that channel. Always filled for an interaction’s invoker, so /play can join the caller. |
record
| Member | Description |
|---|---|
role-id: id |
|
name: string |
|
color: option<u32> |
|
position: u32 |
|
permissions: permissions |
|
managed-by: option<id> |
Set on a bot’s managed role. |
channel
Section titled “channel”record
| Member | Description |
|---|---|
channel-id: id |
|
name: string |
|
kind: string |
text, announcement, voice, category, dm, … |
topic: option<string> |
|
parent-id: option<id> |
|
position: u32 |
|
participants: list<id> |
A dm channel’s two members (the bot and the person); empty otherwise. |
attachment
Section titled “attachment”record
| Member | Description |
|---|---|
attachment-id: id |
|
name: string |
|
size: u64 |
|
mime: string |
|
sha3-256: string |
base64url SHA3-256. |
embed-author
Section titled “embed-author”record
| Member | Description |
|---|---|
name: string |
|
url: option<string> |
|
icon: option<id> |
embed-footer
Section titled “embed-footer”record
| Member | Description |
|---|---|
text: string |
|
icon: option<id> |
embed-field
Section titled “embed-field”record
| Member | Description |
|---|---|
name: string |
|
value: string |
|
inline: bool |
record
| Member | Description |
|---|---|
title: option<string> |
|
description: option<string> |
|
url: option<string> |
https:// only. |
color: option<u32> |
|
timestamp: option<timestamp> |
|
author: option<embed-author> |
|
footer: option<embed-footer> |
|
image: option<id> |
Attachment ids of the same message, never URLs. |
thumbnail: option<id> |
|
fields: list<embed-field> |
button-style
Section titled “button-style”enum
Button styles 1-5; premium (6) is not supported.
| Member | Description |
|---|---|
primary |
|
secondary |
|
success |
|
danger |
|
link |
button
Section titled “button”record
Type 2.
| Member | Description |
|---|---|
id: option<u32> |
|
style: button-style |
|
label: option<string> |
|
emoji: option<string> |
A Unicode emoji. |
custom-id: option<string> |
Styles 1-4. |
url: option<string> |
Style 5 only: an https:// link, opened after the reader confirms. |
disabled: bool |
select-option
Section titled “select-option”record
| Member | Description |
|---|---|
label: string |
|
value: string |
|
description: option<string> |
|
emoji: option<string> |
|
is-default: bool |
string-select
Section titled “string-select”record
Type 3.
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
options: list<select-option> |
|
placeholder: option<string> |
|
min-values: option<u8> |
|
max-values: option<u8> |
|
required: option<bool> |
In a modal. |
disabled: bool |
entity-kind
Section titled “entity-kind”enum
Types 5 (user), 6 (role), 7 (mentionable), 8 (channel).
| Member | Description |
|---|---|
user |
|
role |
|
mentionable |
|
channel |
default-value-kind
Section titled “default-value-kind”enum
| Member | Description |
|---|---|
user |
|
role |
|
channel |
default-value
Section titled “default-value”record
| Member | Description |
|---|---|
id: id |
|
kind: default-value-kind |
entity-select
Section titled “entity-select”record
| Member | Description |
|---|---|
id: option<u32> |
|
kind: entity-kind |
|
custom-id: string |
|
placeholder: option<string> |
|
min-values: option<u8> |
|
max-values: option<u8> |
|
default-values: list<default-value> |
|
channel-types: list<string> |
Channel select only. |
required: option<bool> |
|
disabled: bool |
row-item
Section titled “row-item”variant
| Member | Description |
|---|---|
button(button) |
|
string-select(string-select) |
|
entity-select(entity-select) |
action-row
Section titled “action-row”record
Type 1: up to 5 buttons, or one select.
| Member | Description |
|---|---|
id: option<u32> |
|
components: list<row-item> |
text-display
Section titled “text-display”record
Type 10.
| Member | Description |
|---|---|
id: option<u32> |
|
content: string |
thumbnail
Section titled “thumbnail”record
Type 11: an image attachment of the same message.
| Member | Description |
|---|---|
id: option<u32> |
|
media: id |
|
description: option<string> |
|
spoiler: bool |
section-accessory
Section titled “section-accessory”variant
| Member | Description |
|---|---|
button(button) |
|
thumbnail(thumbnail) |
section
Section titled “section”record
Type 9: 1-3 text displays and an accessory.
| Member | Description |
|---|---|
id: option<u32> |
|
components: list<text-display> |
|
accessory: section-accessory |
media-item
Section titled “media-item”record
| Member | Description |
|---|---|
media: id |
|
description: option<string> |
|
spoiler: bool |
media-gallery
Section titled “media-gallery”record
Type 12: 1-10 items.
| Member | Description |
|---|---|
id: option<u32> |
|
items: list<media-item> |
record
Type 13.
| Member | Description |
|---|---|
id: option<u32> |
|
file: id |
|
spoiler: bool |
separator-spacing
Section titled “separator-spacing”enum
| Member | Description |
|---|---|
small |
|
large |
separator
Section titled “separator”record
Type 14.
| Member | Description |
|---|---|
id: option<u32> |
|
divider: bool |
|
spacing: separator-spacing |
container-child
Section titled “container-child”variant
| Member | Description |
|---|---|
action-row(action-row) |
|
text-display(text-display) |
|
section(section) |
|
media-gallery(media-gallery) |
|
file(file) |
|
separator(separator) |
container
Section titled “container”record
Type 17.
| Member | Description |
|---|---|
id: option<u32> |
|
components: list<container-child> |
|
accent-color: option<u32> |
|
spoiler: bool |
component
Section titled “component”variant
A top-level message component. Without components-v2 only action-row is allowed.
| Member | Description |
|---|---|
action-row(action-row) |
|
text-display(text-display) |
|
section(section) |
|
media-gallery(media-gallery) |
|
file(file) |
|
separator(separator) |
|
container(container) |
text-input-style
Section titled “text-input-style”enum
| Member | Description |
|---|---|
short |
|
paragraph |
text-input
Section titled “text-input”record
Type 4.
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
style: text-input-style |
|
min-length: option<u16> |
|
max-length: option<u16> |
|
required: option<bool> |
|
value: option<string> |
|
placeholder: option<string> |
file-upload
Section titled “file-upload”record
Type 19.
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
min-values: option<u8> |
|
max-values: option<u8> |
|
required: option<bool> |
choice-option
Section titled “choice-option”record
| Member | Description |
|---|---|
label: string |
|
value: string |
|
description: option<string> |
radio-group
Section titled “radio-group”record
Type 21: 2-10 options.
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
options: list<choice-option> |
|
required: option<bool> |
checkbox-group
Section titled “checkbox-group”record
Type 22: 1-10 options.
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
options: list<choice-option> |
|
min-values: option<u8> |
|
max-values: option<u8> |
|
required: option<bool> |
checkbox
Section titled “checkbox”record
Type 23.
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
is-default: bool |
label-child
Section titled “label-child”variant
| Member | Description |
|---|---|
text-input(text-input) |
|
string-select(string-select) |
|
entity-select(entity-select) |
|
file-upload(file-upload) |
|
radio-group(radio-group) |
|
checkbox-group(checkbox-group) |
|
checkbox(checkbox) |
record
Type 18.
| Member | Description |
|---|---|
id: option<u32> |
|
label: string |
|
description: option<string> |
|
component: label-child |
modal-item
Section titled “modal-item”variant
| Member | Description |
|---|---|
label(label) |
|
text-display(text-display) |
record
| Member | Description |
|---|---|
custom-id: string |
|
title: string |
|
components: list<modal-item> |
message-flags
Section titled “message-flags”flags
the standard values: 4, 64, 4096, 32768. LOADING is host-set only.
| Member | Description |
|---|---|
suppress-embeds |
|
ephemeral |
|
suppress-notifications |
|
components-v2 |
mentions
Section titled “mentions”record
| Member | Description |
|---|---|
everyone: bool |
|
members: list<id> |
|
roles: list<id> |
message-body
Section titled “message-body”record
What a bot sends: message.send, responses, follow-ups and edits.
| Member | Description |
|---|---|
content: option<string> |
|
embeds: list<embed> |
|
components: list<component> |
|
attachments: list<id> |
Attachment ids the bot uploaded (messages.upload). |
mentions: option<mentions> |
|
%flags: message-flags |
interaction-metadata
Section titled “interaction-metadata”record
| Member | Description |
|---|---|
interaction-id: id |
|
kind: u8 |
|
name: option<string> |
|
member-id: id |
message
Section titled “message”record
| Member | Description |
|---|---|
message-id: id |
|
channel-id: id |
|
sequence: u64 |
|
author-id: id |
|
created-at: timestamp |
|
edited-at: option<timestamp> |
|
content: string |
Empty when the bot lacks message_content (unless it is mentioned). |
embeds: list<embed> |
|
components: list<component> |
|
%flags: u32 |
Raw flag bits. |
reply-to: option<id> |
|
mentions: mentions |
|
attachments: list<attachment> |
|
interaction: option<interaction-metadata> |
command-kind
Section titled “command-kind”enum
Type 1, 2, 3.
| Member | Description |
|---|---|
chat-input |
|
user |
|
message |
option-kind
Section titled “option-kind”enum
Option types 3-11 (1 and 2 are sub-commands and groups).
| Member | Description |
|---|---|
%string |
|
integer |
|
boolean |
|
user |
|
channel |
|
role |
|
mentionable |
|
number |
|
attachment |
choice-value
Section titled “choice-value”variant
| Member | Description |
|---|---|
text(string) |
|
integer(s64) |
|
number(f64) |
localized
Section titled “localized”record
| Member | Description |
|---|---|
locale: string |
|
text: string |
choice
Section titled “choice”record
| Member | Description |
|---|---|
name: string |
|
name-localizations: list<localized> |
|
value: choice-value |
command-option
Section titled “command-option”record
| Member | Description |
|---|---|
kind: option-kind |
|
name: string |
|
name-localizations: list<localized> |
|
description: string |
|
description-localizations: list<localized> |
|
required: bool |
|
choices: list<choice> |
|
channel-types: list<string> |
|
min-value: option<f64> |
|
max-value: option<f64> |
|
min-length: option<u16> |
|
max-length: option<u16> |
|
autocomplete: bool |
sub-command
Section titled “sub-command”record
Type 1.
| Member | Description |
|---|---|
name: string |
|
name-localizations: list<localized> |
|
description: string |
|
description-localizations: list<localized> |
|
options: list<command-option> |
sub-command-group
Section titled “sub-command-group”record
Type 2.
| Member | Description |
|---|---|
name: string |
|
name-localizations: list<localized> |
|
description: string |
|
description-localizations: list<localized> |
|
sub-commands: list<sub-command> |
command-entry
Section titled “command-entry”variant
| Member | Description |
|---|---|
value-option(command-option) |
|
sub-command(sub-command) |
|
group(sub-command-group) |
application-command
Section titled “application-command”record
| Member | Description |
|---|---|
kind: command-kind |
|
name: string |
|
name-localizations: list<localized> |
|
description: string |
Empty for user and message commands. |
description-localizations: list<localized> |
|
options: list<command-entry> |
|
default-member-permissions: option<permissions> |
Bits the invoker needs in the channel. some(0): owner only; none: everyone. |
registered-command
Section titled “registered-command”record
| Member | Description |
|---|---|
command-id: id |
|
kind: command-kind |
|
name: string |
registration
Section titled “registration”record
What init returns.
| Member | Description |
|---|---|
commands: list<application-command> |
option-value
Section titled “option-value”variant
| Member | Description |
|---|---|
text(string) |
|
integer(s64) |
|
boolean(bool) |
|
number(f64) |
|
id(id) |
received-option
Section titled “received-option”record
One option the invoker filled in, with the sub-command path flattened onto the data.
| Member | Description |
|---|---|
name: string |
|
kind: option-kind |
|
value: option-value |
|
focused: bool |
resolved
Section titled “resolved”record
| Member | Description |
|---|---|
members: list<member> |
|
roles: list<role> |
|
channels: list<channel> |
|
messages: list<message> |
|
attachments: list<attachment> |
command-data
Section titled “command-data”record
| Member | Description |
|---|---|
command-id: id |
|
name: string |
|
kind: command-kind |
|
group: option<string> |
|
sub-command: option<string> |
|
options: list<received-option> |
|
resolved: resolved |
|
target-id: option<id> |
The member (user commands) or message (message commands) acted on. |
component-data
Section titled “component-data”record
| Member | Description |
|---|---|
custom-id: string |
|
component-type: u8 |
|
values: list<string> |
|
resolved: resolved |
modal-value
Section titled “modal-value”record
| Member | Description |
|---|---|
id: option<u32> |
|
custom-id: string |
|
component-type: u8 |
|
value: option<string> |
|
values: list<string> |
modal-data
Section titled “modal-data”record
| Member | Description |
|---|---|
custom-id: string |
|
components: list<modal-value> |
|
resolved: resolved |
interaction-data
Section titled “interaction-data”variant
| Member | Description |
|---|---|
command(command-data) |
|
component(component-data) |
|
autocomplete(command-data) |
|
modal-submit(modal-data) |
interaction
Section titled “interaction”record
| Member | Description |
|---|---|
interaction-id: id |
|
bot-id: id |
|
channel-id: id |
|
member: member |
The invoker. |
app-permissions: permissions |
The bot’s effective permissions in the channel. |
locale: option<string> |
|
message: option<message> |
For component interactions: the message holding the component. |
data: interaction-data |
|
created-at: timestamp |
response
Section titled “response”variant
Callback types 4-9 (8, the autocomplete result, is the return value of
on-autocomplete).
| Member | Description |
|---|---|
message(message-body) |
4: CHANNEL_MESSAGE_WITH_SOURCE. |
deferred-message(bool) |
5: DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE; true = ephemeral. |
deferred-update |
6: DEFERRED_UPDATE_MESSAGE. |
update-message(message-body) |
7: UPDATE_MESSAGE. |
modal(modal) |
9: MODAL. |
record
The bot’s own identity, once its connection is up.
| Member | Description |
|---|---|
bot-id: id |
|
member-id: id |
|
community-id: id |
message-event
Section titled “message-event”record
A message, and whether it is in a direct-message channel with the bot.
| Member | Description |
|---|---|
message: message |
|
is-dm: bool |
message-deleted
Section titled “message-deleted”record
| Member | Description |
|---|---|
channel-id: id |
|
message-id: id |
messages-deleted
Section titled “messages-deleted”record
| Member | Description |
|---|---|
channel-id: id |
|
message-ids: list<id> |
reaction
Section titled “reaction”record
| Member | Description |
|---|---|
channel-id: id |
|
message-id: id |
|
emoji: string |
|
member-id: id |
member-roles
Section titled “member-roles”record
| Member | Description |
|---|---|
member-id: id |
|
role-ids: list<id> |
member-timeout
Section titled “member-timeout”record
until is none when the timeout was cleared.
| Member | Description |
|---|---|
member-id: id |
|
until: option<timestamp> |
typing
Section titled “typing”record
| Member | Description |
|---|---|
channel-id: id |
|
member-ids: list<id> |
activity-type
Section titled “activity-type”enum
“Playing {name}”, “Streaming {name}”, “Listening to {name}”, “Watching {name}”,
“Competing in {name}”, or free text (custom).
| Member | Description |
|---|---|
playing |
|
streaming |
|
listening |
|
watching |
|
competing |
|
custom |
activity
Section titled “activity”record
What a member (or the bot) is doing.
| Member | Description |
|---|---|
kind: activity-type |
|
name: string |
1-128 characters. |
details: option<string> |
<= 128: e.g. the track. |
state: option<string> |
<= 128: e.g. the artist. |
url: option<string> |
streaming only: an https:// link (open only after the reader confirms). |
started-at: option<timestamp> |
When it started, ms since the epoch. |
emoji: option<string> |
custom only: a Unicode emoji. |
presence
Section titled “presence”record
status: online, idle, dnd or offline (invisible members look offline).
| Member | Description |
|---|---|
member-id: id |
|
status: string |
|
activity: option<activity> |
community-profile
Section titled “community-profile”record
| Member | Description |
|---|---|
system-channel-id: option<id> |
|
default-slowmode-s: u32 |
variant
The events a bot asked for in its manifest (events: wire types, groups such as
messages, members, dms, or *). Anything without a typed case arrives as
other with the event’s JSON body.
| Member | Description |
|---|---|
ready(ready) |
Always delivered first, once the bot’s connection is up. |
message-created(message-event) |
|
message-updated(message-event) |
|
message-deleted(message-deleted) |
|
messages-bulk-deleted(messages-deleted) |
|
reaction-added(reaction) |
|
reaction-removed(reaction) |
|
member-joined(member) |
Group members (capability members). |
member-updated(member) |
|
member-left(id) |
|
member-removed(string) |
The bot itself was removed; reason is kicked, banned, … |
member-roles-updated(member-roles) |
|
member-timed-out(member-timeout) |
|
channel-created(channel) |
|
channel-updated(channel) |
|
channel-deleted(id) |
|
role-created(role) |
|
role-updated(role) |
|
role-deleted(id) |
|
typing-started(typing) |
|
presence-updated(presence) |
Group presence (capability presence). |
community-updated(community-profile) |
|
command-updated(id) |
A bot’s command list changed; the bot’s id. |
dm-created(channel) |
Group dms (capability dms): a DM with the bot was opened, or the bot closed one. |
dm-closed(id) |
|
other(raw-event) |
raw-event
Section titled “raw-event”record
| Member | Description |
|---|---|
kind: string |
|
json: string |