Skip to content

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;

type

Milliseconds since the Unix epoch.

type timestamp = u64;

type

A permission bitfield (permissions.md the protocol).

type permissions = u64;

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.

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.

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.

record

Member Description
attachment-id: id
name: string
size: u64
mime: string
sha3-256: string base64url SHA3-256.

record

Member Description
name: string
url: option<string>
icon: option<id>

record

Member Description
text: string
icon: option<id>

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>

enum

Button styles 1-5; premium (6) is not supported.

Member Description
primary
secondary
success
danger
link

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

record

Member Description
label: string
value: string
description: option<string>
emoji: option<string>
is-default: bool

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

enum

Types 5 (user), 6 (role), 7 (mentionable), 8 (channel).

Member Description
user
role
mentionable
channel

enum

Member Description
user
role
channel

record

Member Description
id: id
kind: default-value-kind

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

variant

Member Description
button(button)
string-select(string-select)
entity-select(entity-select)

record

Type 1: up to 5 buttons, or one select.

Member Description
id: option<u32>
components: list<row-item>

record

Type 10.

Member Description
id: option<u32>
content: string

record

Type 11: an image attachment of the same message.

Member Description
id: option<u32>
media: id
description: option<string>
spoiler: bool

variant

Member Description
button(button)
thumbnail(thumbnail)

record

Type 9: 1-3 text displays and an accessory.

Member Description
id: option<u32>
components: list<text-display>
accessory: section-accessory

record

Member Description
media: id
description: option<string>
spoiler: bool

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

enum

Member Description
small
large

record

Type 14.

Member Description
id: option<u32>
divider: bool
spacing: separator-spacing

variant

Member Description
action-row(action-row)
text-display(text-display)
section(section)
media-gallery(media-gallery)
file(file)
separator(separator)

record

Type 17.

Member Description
id: option<u32>
components: list<container-child>
accent-color: option<u32>
spoiler: bool

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)

enum

Member Description
short
paragraph

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>

record

Type 19.

Member Description
id: option<u32>
custom-id: string
min-values: option<u8>
max-values: option<u8>
required: option<bool>

record

Member Description
label: string
value: string
description: option<string>

record

Type 21: 2-10 options.

Member Description
id: option<u32>
custom-id: string
options: list<choice-option>
required: option<bool>

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>

record

Type 23.

Member Description
id: option<u32>
custom-id: string
is-default: bool

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

variant

Member Description
label(label)
text-display(text-display)

record

Member Description
custom-id: string
title: string
components: list<modal-item>

flags

the standard values: 4, 64, 4096, 32768. LOADING is host-set only.

Member Description
suppress-embeds
ephemeral
suppress-notifications
components-v2

record

Member Description
everyone: bool
members: list<id>
roles: list<id>

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

record

Member Description
interaction-id: id
kind: u8
name: option<string>
member-id: id

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>

enum

Type 1, 2, 3.

Member Description
chat-input
user
message

enum

Option types 3-11 (1 and 2 are sub-commands and groups).

Member Description
%string
integer
boolean
user
channel
role
mentionable
number
attachment

variant

Member Description
text(string)
integer(s64)
number(f64)

record

Member Description
locale: string
text: string

record

Member Description
name: string
name-localizations: list<localized>
value: choice-value

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

record

Type 1.

Member Description
name: string
name-localizations: list<localized>
description: string
description-localizations: list<localized>
options: list<command-option>

record

Type 2.

Member Description
name: string
name-localizations: list<localized>
description: string
description-localizations: list<localized>
sub-commands: list<sub-command>

variant

Member Description
value-option(command-option)
sub-command(sub-command)
group(sub-command-group)

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.

record

Member Description
command-id: id
kind: command-kind
name: string

record

What init returns.

Member Description
commands: list<application-command>

variant

Member Description
text(string)
integer(s64)
boolean(bool)
number(f64)
id(id)

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

record

Member Description
members: list<member>
roles: list<role>
channels: list<channel>
messages: list<message>
attachments: list<attachment>

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.

record

Member Description
custom-id: string
component-type: u8
values: list<string>
resolved: resolved

record

Member Description
id: option<u32>
custom-id: string
component-type: u8
value: option<string>
values: list<string>

record

Member Description
custom-id: string
components: list<modal-value>
resolved: resolved

variant

Member Description
command(command-data)
component(component-data)
autocomplete(command-data)
modal-submit(modal-data)

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

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

record

A message, and whether it is in a direct-message channel with the bot.

Member Description
message: message
is-dm: bool

record

Member Description
channel-id: id
message-id: id

record

Member Description
channel-id: id
message-ids: list<id>

record

Member Description
channel-id: id
message-id: id
emoji: string
member-id: id

record

Member Description
member-id: id
role-ids: list<id>

record

until is none when the timeout was cleared.

Member Description
member-id: id
until: option<timestamp>

record

Member Description
channel-id: id
member-ids: list<id>

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

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.

record

status: online, idle, dnd or offline (invisible members look offline).

Member Description
member-id: id
status: string
activity: option<activity>

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)

record

Member Description
kind: string
json: string