# Zaun documentation (full text) All guide, example and reference pages of the Zaun docs, as Markdown. Each page starts with its URL. --- url: https://zaunchat.github.io/docs/guide/introduction/ --- # Introduction > What these docs cover, who they are for, and how to read them. Welcome! These docs cover the three parts of Zaun you can build with: | Project | What it is | Language | |---|---|---| | [`zaun-host`](https://github.com/zaunchat/zaun-community) | The program that runs a community: channels, roles, permissions, history, voice signalling, bots. | Rust (one binary or a Docker image) | | [`zaun-client`](https://github.com/zaunchat/zaun-client) | The library apps and bots use to talk to a host. | Rust, and JavaScript/WebAssembly for browsers, Node.js and Bun | | [`zaun-bot`](https://github.com/zaunchat/zaun-bot) | SDKs for bots that run *inside* a host as sandboxed WebAssembly. | TypeScript and Rust | ## How these docs are organised - **Guide**: step-by-step pages. Start with [What is Zaun?](/docs/guide/what-is-zaun/) and the [quick start](/docs/guide/quick-start/), then follow the section you need: running a host, building a client, or writing bots. - **Examples**: complete, working programs with explanations. - **Reference**: generated API documentation for every public type and function, plus the `zaun-host` command line and configuration. ## What you should know first - **For a host:** basic command-line use. Docker makes it easiest; building from source needs Rust. - **For a client or an external bot:** Rust, or JavaScript (async/await, `npm`). - **For a hosted bot:** TypeScript (`@zaun/bot`, the default in these docs) or Rust. See [TypeScript or Rust?](/docs/guide/bots/typescript-or-rust/). If you have written an interactions-based bot elsewhere, read [Porting an existing bot](/docs/guide/bots/porting-a-bot/). > **Tip: Status** > > Zaun is in alpha. APIs may change before 1.0, nothing is published to crates.io or npm yet (you > build from the Git repositories), and the software has not had a security audit. ## Getting help Open an issue in the repository the question is about: [zaun-community](https://github.com/zaunchat/zaun-community/issues), [zaun-client](https://github.com/zaunchat/zaun-client/issues) or [zaun-bot](https://github.com/zaunchat/zaun-bot/issues). Found a mistake in the docs? Use "Edit page" at the bottom of any page. --- url: https://zaunchat.github.io/docs/guide/what-is-zaun/ --- # What is Zaun? > Zaun in five minutes, how a community, its host, apps and bots fit together, and the one trade-off to know. Zaun is a community platform with **channels, roles, permissions, invites, moderation, voice and bots**, but without accounts and without a company in the middle. ## The pieces ``` members' apps and external bots the community's host ┌──────────────────────────────┐ ┌─────────────────────────┐ │ zaun-client (Rust or JS) │ ◀── SimpleX ─▶ │ zaun-host │ │ cache · events · voice │ post-quantum │ roles · channels │ └──────────────────────────────┘ encrypted │ history · bans │ │ hosted bots (WASM) ◀─┐ │ └───────────────────────┼─┘ in-process, no network ``` - **A community** is owned by a person (the owner), who holds the community's signing key. - **A host** (`zaun-host`) runs the community. The owner signs a delegation that says which host serves the community; anyone can run a host, and a community can [move to another one](/docs/guide/host/moving-a-community/). - **Members** connect to the host over [SimpleX](https://simplex.chat), a private messaging network with no user identifiers. Each member has its own post-quantum key. - **Apps and external bots** use [`zaun-client`](/docs/guide/client/installation/). - **Hosted bots** are WebAssembly packages the host runs for a community, with only the permissions they were granted. See [Bots](/docs/guide/bots/why-bots-in-the-host/). ## What a community has - Text and announcement channels, categories, edits, deletes, reactions and history. - Attachments (25 MB by default), sent as encrypted SimpleX files. - Voice channels, end-to-end encrypted, relayed through the host's TURN server by default. - Roles and permissions, with per-channel overrides and a hierarchy. - Invites with use limits, expiry and optional approval. - Moderation: probation for newcomers, kicks, bans, timeouts, suspensions, reports, an audit log, and an emergency lockdown. - Rate limits that never rely on IP addresses. - Rich embeds, and for bots: slash commands, buttons, selects and modals, events, direct messages and music in voice channels. - Typing indicators per channel: with names, anonymous, or off. - Status and presence: online, idle, do not disturb or invisible, an activity ("Listening to …"), and a custom status text, for members and bots alike. ## The one trade-off to know **Connections are end-to-end encrypted between each member and the host, but the host can read the channels.** Channel messages are not end-to-end encrypted between members. Whoever runs the host is trusted, and you can run it yourself. That is what makes large communities work: one host sends each post to thousands of members, search and moderation are simple, and members who were offline catch up by asking for "everything after message 41". Voice audio is the exception: it is end-to-end encrypted between participants, and the host never hears it. ## Next steps - [Quick start](/docs/guide/quick-start/): a host, a community and a bot, end to end. - [Concepts](/docs/guide/concepts/communities-and-hosts/): the ideas in a little more depth. --- url: https://zaunchat.github.io/docs/guide/quick-start/ --- # Quick start > Run a host with Docker, create a community from a script, and invite yourself, in about ten minutes. This page takes you from nothing to a running community you own. You need Docker, and either Rust or Node.js 22+ for the small script that creates the community. 1. **Start a host.** ```sh docker run -d --name zaun-host --restart unless-stopped --memory 512m \ -v zaun-host:/var/lib/zaun-host ghcr.io/zaunchat/zaun-host ``` The first start creates the host's keys, database and configuration in the `zaun-host` volume, then serves. There are no ports to publish: members reach it through SimpleX relays. 2. **Allow community creation, once.** By default nobody may create communities on a host. Open it while you create yours: ```sh docker exec zaun-host sed -i 's/^community_creation = .*/community_creation = "open"/' \ /var/lib/zaun-host/zaun-host.toml docker restart zaun-host ``` 3. **Note the host's address and key.** ```sh docker exec zaun-host zaun-host address # the SimpleX address docker exec zaun-host zaun-host id # the host id and public key ``` 4. **Create the community** with `zaun-client`. You become its owner, and its root key (its identity) is saved in the client's directory: back it up. **JavaScript:** ```js import { Client } from "zaun-client"; const client = await Client.start({ name: "Me", key: "a store passphrase" }); const community = await client.createCommunity({ host: "
", hostKey: "", name: "My community", displayName: "Me", }); console.log(await community.createInvite({ maxUses: 10 })); ``` **Rust:** ```rust use zaun_client::Client; use zaun_client::protocol::{b64, keys::PublicKey}; let client = Client::builder("./owner").name("Me").key("a store passphrase").start()?; let host_key = PublicKey::from_bytes(&b64::decode("")?)?; let community = client.create_community("
", host_key, "My community", "Me")?; let invite = community.create_invite(10, None)?; // 10 uses, no expiry println!("{invite}"); ``` 5. **Close creation again**, so strangers can't create communities on your host: ```sh docker exec zaun-host sed -i 's/^community_creation = .*/community_creation = "closed"/' \ /var/lib/zaun-host/zaun-host.toml docker restart zaun-host ``` 6. **Invite people** with the `zaun://join/…` link. Treat it as a secret: anyone with it can join. > **Caution: Back up the owner's directory** > > The community's root key lives in the owner's client directory (`./owner/zaun//root.key`). > Without it you can never move the community to another host or change its signed profile. ## What next? - [Install a bot](/docs/guide/bots/quickstart/) that answers `/ping`. - [Configure the host](/docs/guide/host/configuration/): attachments, voice, bots, your own relays. - [Build an app](/docs/guide/client/connecting/) with `zaun-client`. --- url: https://zaunchat.github.io/docs/guide/concepts/communities-and-hosts/ --- # Communities and hosts > Who owns a community, what a host does, and how a community can move between hosts. ## A community has an owner, not an account When someone creates a community, their client makes a **root key**. The community's id is derived from that key, so the community *is* its key: nobody can take the name, and nothing depends on a central registry. The owner signs a small **descriptor** (name, description, icon, rules) with it. ## A host serves the community The owner also signs a **delegation**: "this host serves my community". The host proves it holds that delegation every time a member connects, so a fake host can't pretend to be the community. A host: - stores the community's state in SQLite: members, roles, channels, messages, bans, the audit log; - checks every command against the permission rules; - sends events (new messages, edits, role changes…) to every member who may see them; - keeps attachments, relays voice signalling and keys, and runs hosted bots. One host can serve many communities. Anyone can run one: on a PC, a VPS or a Raspberry Pi 4/5. ## Moving to another host A community isn't tied to its host. The owner signs a new delegation for a new host, the old host's operator exports the community (one encrypted, signed file), and the new host imports it. Members' apps follow on their own and keep their identity, roles and history; bans stay in force. See [Moving a community](/docs/guide/host/moving-a-community/). ## Who decides what | Who | Can | |---|---| | **Owner** | Everything in the community; signs the descriptor and delegation; installs bots. | | **Host operator** | Runs the program; sets limits for every community on the host (attachments, voice, a ceiling on bot grants); can read host-readable channels. | | **Members** | What their roles allow. | --- url: https://zaunchat.github.io/docs/guide/concepts/members-roles-permissions/ --- # Members, roles and permissions > How membership, roles, per-channel overrides and the management hierarchy work. ## Members A member is a key, not an account. When you join with an invite, your client makes a **member key** (a hybrid of ML-DSA-65 and Ed25519, safe against future quantum computers) and registers it. Your display name is per community. Membership has states: **pending** (waiting for approval, when the invite or community requires it), **probation** (new members, with newcomer restrictions the community chooses), **active**, **suspended**, **banned** and **left**. ## Roles Each role has a name, a colour, a position and a set of permission bits. Everyone has the implicit `@everyone` role. A member's permissions are the union of their roles' bits, then adjusted per channel. ## Per-channel overrides A channel can **allow** or **deny** bits for a role or a member, on top of the community-wide roles. Categories can pass their overrides to synced channels. ## The hierarchy Nobody can act above their own rank: - you can only manage roles below your highest role; - you can only kick, ban or time out members whose highest role is below yours; - nobody can act on the owner; - you can't grant a permission you don't have yourself (unless you are the owner or an administrator). ## Permission names The same names appear in the Rust API (`Permissions::SEND_MESSAGES`), the JavaScript API (`"SendMessages"`) and bot manifests (`SEND_MESSAGES`): | Permission | Lets a member | |---|---| | `VIEW_CHANNEL` | see a channel and its messages | | `SEND_MESSAGES` | post | | `READ_MESSAGE_HISTORY` | read older messages | | `MANAGE_MESSAGES` | delete others' messages | | `ATTACH_FILES`, `EMBED_LINKS`, `ADD_REACTIONS`, `MENTION_EVERYONE` | as named | | `MANAGE_CHANNELS`, `MANAGE_ROLES`, `MANAGE_COMMUNITY` | edit structure and settings | | `CREATE_INVITE`, `MANAGE_INVITES` | invite, and manage everyone's invites | | `KICK_MEMBERS`, `BAN_MEMBERS`, `TIMEOUT_MEMBERS` | moderate | | `APPROVE_MEMBERS` | approve pending members | | `VIEW_AUDIT_LOG`, `MANAGE_REPORTS`, `MANAGE_SAFETY` | read the audit log, handle reports, run lockdowns and admission policy | | `CHANGE_NICKNAME`, `MANAGE_NICKNAMES` | rename yourself, or others | | `BYPASS_SLOWMODE` | ignore a channel's slowmode | | `CONNECT`, `SPEAK`, `MUTE_MEMBERS`, `DEAFEN_MEMBERS`, `MOVE_MEMBERS` | voice | | `USE_APPLICATION_COMMANDS` | use bots' slash commands and components (on `@everyone` by default) | | `ADMINISTRATOR` | everything, still within the hierarchy | > **Note** > > Client libraries can check permissions locally (`member.can(...)` in Rust, > `member.permissions(channel).has(...)` in JavaScript) to hide buttons a member can't use. The > host always has the final say: it also applies lockdowns and newcomer rules the client can't see. --- url: https://zaunchat.github.io/docs/guide/concepts/channels-and-messages/ --- # Channels, messages and sync > Channel kinds, messages, attachments, embeds, and how members never miss anything. ## Channels | Kind | What it is | |---|---| | `text` | messages, reactions, attachments, embeds | | `announcement` | like text, usually posting-restricted | | `voice` | voice chat (with text chat too) | | `category` | groups channels; can pass permission overrides to them | Channels have a topic, a position, optional **slowmode**, an optional **locked** flag, and a retention and history policy the community chooses (for example, newcomers see only messages from after they joined). ## Messages A message has text (up to 4 000 characters), optional **embeds**, **attachments**, **mentions** (named explicitly, never parsed from text) and reactions. Messages from bots can also carry **components** (buttons, selects, layouts). ### Attachments Files travel as SimpleX files over the same post-quantum connection; each is encrypted with a fresh key. The host checks each file's size and SHA3-256 before keeping it, and is the archive: members download from the host. ### Embeds Embeds are rich cards (title, description, colour, fields, author, footer, image, thumbnail), with one rule that matters: **pictures are attachments of the same message, never URLs**, so no reader's app ever fetches an image from a third party (which would reveal its IP address). ## Nobody misses anything Every channel's events are numbered. An app that was offline reconnects and asks for "everything after number 41"; nothing is lost or doubled. Clients keep a cursor per channel and acknowledge what they received, so the host knows what to resend. --- url: https://zaunchat.github.io/docs/guide/concepts/transport-and-trust/ --- # SimpleX transport and trust > How members reach a host over SimpleX, what is encrypted, what the host can see, and the post-quantum design. ## SimpleX, in one paragraph [SimpleX](https://simplex.chat) is a messaging network with **no user identifiers**: not even random ones. Messages go through relay servers (SMP for messages, XFTP for files) that only see encrypted packets and can't tell who talks to whom. Zaun uses the official SimpleX servers by default; a host can use its own. ## What is encrypted | Between | Protection | |---|---| | A member and the host | SimpleX's end-to-end encryption, with post-quantum key exchange required: a client refuses a connection that isn't post-quantum | | Attachments | a fresh symmetric key per file, sent only inside that connection | | Voice | end to end between participants: SFrame (RFC 9605) with keys exchanged using X-Wing, a post-quantum hybrid, and signed by each member's key | | Relays | see only ciphertext and timing | ## What the host can see The host reads **channel content** (that's how it sends one post to thousands of members, keeps history and enforces moderation). It does **not** hear voice, and it never learns members' IP addresses (SimpleX hides them). So whoever runs the host is trusted with the community's text, and that can be the owner themselves. End-to-end encrypted channels between members are [planned](/docs/resources/coming-soon/). ## Keys and signatures Every key in Zaun (the community's root key, the host's key, each member's key, bot publishers' keys) is a **composite** of ML-DSA-65 and Ed25519: a signature is valid only if both parts are. An attacker would have to break both a post-quantum and a classical scheme. ## Voice and IP addresses Voice media goes **through the host's TURN relay** by default, so participants don't learn each other's IP addresses. A direct peer-to-peer path is an option apps can turn on (`allow_direct`), and a host with no TURN relay only gets voice from apps that allow direct connections. --- url: https://zaunchat.github.io/docs/guide/concepts/typing-indicators/ --- # Typing indicators > Each channel decides how typing shows: with names, anonymously as a count, or not at all. While a member writes, their app tells the host they are typing, and the host passes it on to the others in the channel. How it is passed on is a **per-channel setting**, `typing`, which anyone with `MANAGE_CHANNELS` can change: | Mode | What others see | |---|---| | `named` (default) | who is typing: "Ada and Bea are typing…" | | `anonymous` | only how many: "Someone is typing…", "2 people are typing…", "Several people are typing…" | | `off` | nothing; apps don't even send typing signals there | ## Anonymous, precisely - The host never puts member ids in an anonymous channel's typing event; apps and bots get only a count. - The count is capped at **1, 2 or 3**, where 3 means "three or more": an exact number would add little and could help someone work out who is typing in a larger channel. - Your own typing is never counted in what you see. - In a very small channel, "someone is typing" can still give a person away. Anonymous typing hides names; it can't hide that someone is there. ## Off The host drops typing signals in an `off` channel, and well-behaved apps stop sending them. Use it for announcement channels or anywhere typing would be noise. Direct messages with bots always use `named` typing: there are only two people in them. Categories don't pass the setting down; set it on each channel. Bots subscribed to typing events get the same shape as members' apps. For the client API, see [Typing indicators](/docs/guide/client/typing/). --- url: https://zaunchat.github.io/docs/guide/host/installing/ --- # Installing zaun-host > Run zaun-host with Docker, Docker Compose, systemd, or a binary you build from source. `zaun-host` is one static binary. It runs on Linux, x86_64 or aarch64 (Raspberry Pi 4/5), in about 512 MB of memory. Pick one way to run it: **Docker:** ```sh docker run -d --name zaun-host --restart unless-stopped --memory 512m \ -v zaun-host:/var/lib/zaun-host ghcr.io/zaunchat/zaun-host docker exec zaun-host zaun-host address # the address members and owners connect to ``` The first start runs `zaun-host init` for you, then serves. The image is Alpine with one static binary, runs as an unprivileged user, and is built for amd64 and arm64. There are **no ports to publish**: members reach the host through SimpleX relays. **Docker Compose:** The repository's `deploy/compose.yaml` runs the same image with a read-only root file system and no Linux capabilities: ```sh curl -O https://raw.githubusercontent.com/zaunchat/zaun-community/main/deploy/compose.yaml docker compose up -d docker compose exec zaun-host zaun-host address ``` **From source:** You need Rust; the exact version is pinned in `rust-toolchain.toml` and installed for you by `rustup`. ```sh git clone https://github.com/zaunchat/zaun-community && cd zaun-community cargo build --release -p zaun-host ./target/release/zaun-host init --data-dir ./zaun-data ./target/release/zaun-host run --data-dir ./zaun-data ``` **systemd:** Build or copy the binary to `/usr/local/bin/zaun-host`, then use the hardened unit from `deploy/zaun-host.service` (it runs as `zaun-host`, reads `/var/lib/zaun-host/zaun-host.toml`, and limits memory to 512 MB): ```sh sudo useradd --system --no-create-home zaun-host sudo install -d -o zaun-host -g zaun-host -m 0700 /var/lib/zaun-host sudo -u zaun-host zaun-host init --data-dir /var/lib/zaun-host sudo cp deploy/zaun-host.service /etc/systemd/system/ sudo systemctl enable --now zaun-host ``` ## Choosing relays By default the host uses the official SimpleX servers. To use your own `smp-server` (or anyone else's), pass `--smp smp://@` to `init`, or list servers in `smp_servers`. With your own SMP servers, also list an XFTP server (`--xftp`), or attachments are off. > **Note** > > Server addresses that embed a queue-creation password are refused in the configuration: that's a > secret, and the config file never holds secrets. ## Next [First run](/docs/guide/host/first-run/): check the host and create your first community. --- url: https://zaunchat.github.io/docs/guide/host/first-run/ --- # First run > Check the host's health, find its address and key, and allow community creation. ## Files a host keeps `zaun-host init --data-dir D` creates `D` (mode 0700) with: | File | What it is | |---|---| | `host.key` | the host's signing key (mode 0600) | | `simplex.key` | the SimpleX store's passphrase (mode 0600), unless you use `ZAUN_HOST_PASSPHRASE` | | `host.db` | the communities' state (SQLite) | | `zaun-host.toml` | the configuration, with no secrets in it | | `simplex/` | the SimpleX client's encrypted store and attachment files | | `bots/` | installed bots' compiled code cache and storage | `init` refuses to overwrite any of them. ## Health checks ```sh zaun-host status --data-dir D # config, files and permissions; non-zero exit on a failure zaun-host doctor --data-dir D # offline read-only checks, each ok / warn / FAIL ``` Both connect to nothing and are safe while the host is running. ## Address and key ```sh zaun-host address --data-dir D # the SimpleX address (after the first run) zaun-host id --data-dir D # the host id and public key ``` An owner needs both to create a community on your host. ## Who may create communities `community_creation` in `zaun-host.toml` decides: | Value | Who may create a community | |---|---| | `"closed"` (default) | nobody | | `"allow_list"` | owners whose community ids are listed in `creation_allow_list` | | `"open"` | anyone who connects (rate-limited) | For your own community, open creation briefly (see the [quick start](/docs/guide/quick-start/)), or create the community's root key first and allow-list its id (`create_community_with_root` in `zaun-client`). ## Logs The host logs to stderr (good for systemd and containers) at `log_level` (`off`, `error`, `warn`, `info`, `debug`). It never logs message content, keys, passphrases or invite links. --- url: https://zaunchat.github.io/docs/guide/host/configuration/ --- # Configuring a host > zaun-host.toml explained, section by section; relays, community creation, attachments, voice and bots. The configuration is one TOML file: `/zaun-host.toml`, or `--config F`, or `$ZAUN_HOST_CONFIG`, or `/etc/zaun-host/zaun-host.toml`. **It holds no secrets and refuses unknown keys**, so a secret pasted into it stops the host instead of being used. Restart the host after editing it. Every key is listed in the [configuration reference](/docs/reference/configuration/). ## The basics ```toml data_dir = "/var/lib/zaun-host" smp_servers = [] # empty: the official SimpleX servers xftp_servers = [] # file servers; see below max_connections = 1000 # connected or connecting, before new requests are refused community_creation = "closed" log_level = "info" ``` The store passphrase comes from `simplex.key`, `$ZAUN_HOST_PASSPHRASE`, or a file named by `passphrase_file` (for example a systemd credential), never from this file. ## Attachments ```toml [attachments] enabled = true max_file_mb = 25 # largest file community_quota_mb = 2048 # what one community may store transfers = 8 # uploads and downloads at once, host-wide ``` Files travel through XFTP servers: the official ones when `smp_servers` is empty, otherwise list your own in `xftp_servers`, or attachments are off. The host keeps every file under its data directory and re-sends it for each download, so keep limits modest on shared machines. ## Voice ```toml [voice] enabled = true mesh_max = 8 # participants per voice channel, up to 10 ice_servers = ["turn:turn.example.net:3478"] ice_policy = "relay" # media only through TURN, hiding participants' IP addresses ice_credentials_file = "/run/credentials/zaun-host.service/turn.toml" ``` Audio never passes through the host: participants send it to each other, end-to-end encrypted. The host only relays signalling and keys. List a TURN server and keep `ice_policy = "relay"` so participants don't learn each other's addresses. TURN credentials live in their own file (mode 0600), never here. ## Bots ```toml [bots] enabled = true allow_remote_install = true # community owners may install bots from their app allow_unsigned = false # development only max_bots = 20 # per community allow_network = false # may any bot be granted internet access? network_allow_list = [] # if set, granted hosts must be among these max_memory_mb = 64 cpu_ms_per_call = 500 max_storage_mb = 64 allow_update_checks = false allow_voice = true # bots may be granted voice: join voice channels and play audio allow_dms = true # bots may be granted direct messages with members # http_proxy = "socks5h://127.0.0.1:9050" # send bots' requests through Tor ``` Every value is a **ceiling**: a community owner can grant a bot less, never more. A bot's internet requests leave from the host, so they reveal the host's IP address to the server it contacts; keep `allow_network = false` unless you need it, or route requests through a proxy. A bot in voice streams through the host's own media relay; set `allow_voice = false` to keep bots out of voice channels, and `allow_dms = false` to stop any bot from messaging members privately. See [Installing bots on a host](/docs/guide/bots/installing/). --- url: https://zaunchat.github.io/docs/guide/host/moving-a-community/ --- # Moving a community and backups > Hand a community to a new host with zaun-host export and import, and what members see. A community belongs to its owner, not to its host. Moving it takes three steps: 1. **The owner signs a new delegation** naming the new host (from their app), and publishes it on the old host, so members learn where to go. 2. **The old host's operator exports** the community: ```sh zaun-host export --data-dir D --community --out community.zaun --passphrase-file pass.txt ``` The bundle holds the members, roles, channels, bans, admission policy, history, audit log and attachment files, is signed by the old host and encrypted with the passphrase (mode 0600, at least 16 bytes). Invitation secrets never leave. Stop `run` first. 3. **The new host's operator imports** it: ```sh zaun-host import --data-dir D --passphrase-file pass.txt community.zaun ``` The import checks every signature and hash first, and that the owner's delegation names this host. If the owner published the delegation after the export, pass it with `--descriptor F` (JSON with `descriptor` and `delegation`). Stop `run` first. Members' apps follow on their own (`communityMoving`, then `communityMoved` events in `zaun-client`) and keep their identity, roles and history. Bans stay in force. ## Backups An export is also a backup of one community. Back up, too: - `host.key`: without it, owners must delegate to a new host key; - the owner's client directory: the community's **root key** lives there, and nothing can replace it. --- url: https://zaunchat.github.io/docs/guide/client/installation/ --- # Installing zaun-client > Add zaun-client to a Rust project, or build its JavaScript/WebAssembly package for browsers, Node.js and Bun. `zaun-client` is Zaun's client library: objects that act for themselves (`message.reply(...)`, `member.kick(...)`) and named events (`messageCreate`, `memberAdd`). It is not on crates.io or npm yet; you use it from Git. **JavaScript:** The JavaScript package is the same Rust code compiled to WebAssembly, so you build it once: ```sh git clone https://github.com/zaunchat/zaun-client && cd zaun-client rustup target add wasm32-unknown-unknown cargo install wasm-bindgen-cli --version 0.2.130 scripts/build-zaun-js.sh # writes zaun/pkg/web and zaun/pkg/node ``` Then add it to your project (Node.js 22+, Bun, or a bundler for browsers): ```sh npm install /path/to/zaun-client/zaun ``` ```js ``` Node.js and Bun need `werift` for voice (`npm install werift@0.27`). **Rust:** ```toml title="Cargo.toml" [dependencies] zaun-client = { git = "https://github.com/zaunchat/zaun-client" } ``` The crate needs Rust 1.95 or newer. Native builds link `aws-lc` (for voice's DTLS certificates), so a C compiler must be available. ## Browsers need a tunnel Browsers can't open raw TCP connections, and SimpleX relays listen on TCP. The browser build connects through a **WebSocket tunnel** that only pipes bytes: TLS runs inside the WebAssembly client, pinned to the relay's certificate fingerprint, so the tunnel only sees ciphertext. The zaun-client repository's `worker/` is such a tunnel as a Cloudflare Worker; pass its URL as `tunnel` to `Client.start`. ## Next [Connecting and joining](/docs/guide/client/connecting/). --- url: https://zaunchat.github.io/docs/guide/client/connecting/ --- # Connecting and joining > Start a client, join a community with an invite, keep its state between runs, and handle your first events. 1. **Start a client.** A client keeps its keys and state in a store sealed with a passphrase. **JavaScript:** ```js import fs from "node:fs"; import { Client } from "zaun-client"; const file = "bot.snapshot"; const snapshot = fs.existsSync(file) ? fs.readFileSync(file) : undefined; const client = await Client.start({ name: "Ping bot", key: process.env.ZAUN_KEY, snapshot }); client.on("change", () => fs.writeFileSync(file, client.save())); // keep the store ``` **Rust:** ```rust use zaun_client::Client; // Keys and state live under ./bot/zaun/ (key files mode 0600). let client = Client::builder("./bot").name("Ping bot").key("store passphrase").start()?; ``` Without relays named, the official SimpleX servers are used. Name your own with `.relay("smp://…")` (Rust) or `relays: ["smp://…"]` (JavaScript). 2. **Join a community** with an invite link, **only the first time**. Later runs reconnect from the saved state. **JavaScript:** ```js if (client.saved.size === 0) { await client.join(process.env.ZAUN_INVITE, "Ping bot"); // the link is a secret: never log it } ``` **Rust:** ```rust let community = client.join("zaun://join/…", "Ping bot")?; println!("joined {community}"); ``` Joining opens a post-quantum SimpleX connection to the host, checks the host's signed proof that it serves the community, makes your member key and registers it, then loads the community into the local cache. 3. **Handle events.** **JavaScript:** ```js client.on("ready", (community) => console.log(`ready in ${community.name}`)); client.on("messageCreate", async (message) => { if (message.mine) return; if (message.content === "!ping") await message.reply("pong"); }); ``` **Rust:** ```rust use zaun_client::Event; for event in client.events() { match event { Event::Ready(community) => println!("ready in {community}"), Event::MessageCreate(message) if !message.is_mine() => { if message.content() == "!ping" { message.reply("pong")?; } } _ => {} } } ``` ## Resulting code See the complete [ping bot example](/docs/examples/client-ping-bot/), in Rust and JavaScript. ## Creating a community instead An owner creates a community on a host that allows it (see [First run](/docs/guide/host/first-run/)): `client.create_community(address, host_key, name, display_name)` in Rust, `client.createCommunity({ host, hostKey, name, displayName })` in JavaScript. The community's root key is saved in the client's store: back it up. --- url: https://zaunchat.github.io/docs/guide/client/messages/ --- # Sending and managing messages > Send, reply, edit, delete and react to messages, and read a channel's history. ## Send and reply **JavaScript:** ```js const general = community.channels.find((c) => c.name === "general"); const sent = await general.send("hello"); await sent.reply("replying to myself"); ``` **Rust:** ```rust let general = community.channel_by_name("general").expect("a general channel"); let sent = general.send("hello")?; sent.reply("replying to myself")?; ``` ## Edit, delete, react **JavaScript:** ```js const message = await general.send("typo"); await message.edit("fixed"); await message.react("👍"); await message.delete(); ``` **Rust:** ```rust let mut message = general.send("typo")?; message.edit("fixed")?; message.react("👍")?; message.delete()?; ``` You can edit and delete your own messages; deleting someone else's needs `MANAGE_MESSAGES`. ## History The client keeps no message history of its own; fetch pages from the host: **JavaScript:** ```js const latest = await general.messages.fetch({ limit: 50 }); ``` **Rust:** ```rust // Up to 50 messages before sequence number `before` (the newest without it), oldest first. let latest = general.messages(None, 50)?; ``` ## Partial messages An edit or deletion event only says what changed, so it carries a **partial** message: its id, and for an edit its new text. It still acts (`reply`, `edit`, `delete`, `react`), but fields the event didn't include are empty. --- url: https://zaunchat.github.io/docs/guide/client/embeds-and-attachments/ --- # Embeds and attachments > Rich embeds built with EmbedBuilder, and files sent as encrypted attachments. ## Embeds Embeds have a title, description, link, colour, timestamp, author, footer, up to 25 fields, an image and a thumbnail. Up to 10 per message. **JavaScript:** ```js const embed = new EmbedBuilder() .setTitle("Release 1.2") .setURL("https://example.com/releases/1.2") .setDescription("What changed") .setColor(0x5865f2) .addFields({ name: "Fixes", value: "12", inline: true }, { name: "Features", value: "3", inline: true }) .setImage({ name: "screenshot.png", data: bytes }) .setFooter({ text: "zaun" }); await channel.send({ embeds: [embed] }); ``` **Rust:** ```rust use zaun_client::{EmbedBuilder, MessageOptions, Picture}; let embed = EmbedBuilder::new() .title("Release 1.2") .url("https://example.com/releases/1.2") .description("What changed") .color(0x5865F2) .field("Fixes", "12", true) .field("Features", "3", true) .image(Picture::file("screenshot.png")) .footer("zaun", None); channel.send(MessageOptions::new().embed(embed))?; ``` > **Caution: Pictures are files, never URLs** > > An embed's image, thumbnail and icons are **attachments of the same message**: the client uploads > them with the message. No reader's app ever fetches an image from a third party, which would show > that server the reader's IP address. Links (`url`) must be `https://` and open only when clicked. ## Attachments **JavaScript:** ```js await channel.send({ content: "my cat", files: [{ name: "cat.png", data: bytes }] }); // on the other side const bytes = await message.attachments.first().download(); ``` **Rust:** ```rust channel.send_files("my cat", &["cat.png"])?; // on the other side, from an Event::MessageCreate let saved = message.attachments()[0].download("./downloads")?; ``` Files travel as SimpleX files over the same post-quantum connection, each encrypted with a fresh key. Sending returns once the host has checked and stored the files; downloading checks the size and SHA3-256 before anything is saved. The host's `[attachments]` settings cap the size (25 MB by default). With your own SMP relay, add an XFTP relay too, or there is no file server. --- url: https://zaunchat.github.io/docs/guide/client/members-and-moderation/ --- # Members, roles and moderation > Read members and roles, check permissions, and kick, ban and time out from code. ## Members and roles The cache has the community's roles and channels, and the members it has seen. Fetch the full member list when you need it: **JavaScript:** ```js const members = await community.members.fetch(); const mods = await community.roles.create("Moderators", { permissions: ["KickMembers", "TimeoutMembers"] }); await members.first().roles.add(mods); ``` **Rust:** ```rust let members = community.fetch_members()?; let mods = community.create_role("Moderators", Permissions::KICK_MEMBERS | Permissions::TIMEOUT_MEMBERS)?; members[0].add_role(&mods)?; ``` ## Checking permissions **JavaScript:** ```js if (member.permissions(channel).has("SendMessages")) { /* … */ } ``` **Rust:** ```rust use zaun_client::protocol::bits::Permissions; if author.can(Permissions::SEND_MESSAGES, Some(message.channel())) { /* … */ } ``` This uses the same resolver as the host, applied to the cache. Use it to hide what a member can't do; the host still decides (it also applies lockdowns and newcomer rules). ## Moderation **JavaScript:** ```js await target.timeout(10 * 60_000, "cool down"); await target.kick("asked to"); await target.ban("spam"); ``` **Rust:** ```rust use std::time::Duration; target.timeout(Some(Duration::from_secs(600)), Some("cool down"))?; target.kick(Some("asked to"))?; target.ban(Some("spam"))?; ``` Each needs the matching permission (`TIMEOUT_MEMBERS`, `KICK_MEMBERS`, `BAN_MEMBERS`) and a highest role above the target's. Nobody can act on the owner. Bans follow the member's key, so a banned member can't come back with the same identity. ## Invites and channels **JavaScript:** ```js const link = await community.createInvite({ maxUses: 5, expiresIn: 86_400 }); const lounge = await community.channels.create("lounge", { type: "voice" }); ``` **Rust:** ```rust use zaun_client::protocol::model::ChannelKind; let link = community.create_invite(5, Some(Duration::from_secs(86_400)))?; // 5 uses, one day let lounge = community.create_channel("lounge", ChannelKind::Voice)?; ``` --- url: https://zaunchat.github.io/docs/guide/client/voice/ --- # Voice > Join voice channels, send and receive audio, and play music with an audio player; end-to-end encrypted. Voice in Zaun is a mesh of WebRTC connections, one per other participant (up to 10 per channel). Every audio frame is **end-to-end encrypted** on top of WebRTC's own encryption: each sender seals its Opus frames with SFrame (RFC 9605) under a key that reaches the others only wrapped with X-Wing (a post-quantum hybrid) and signed with its member key. Keys change whenever someone joins or leaves. The host relays signalling and keys and **never hears audio**. ## Join and talk **Rust:** ```rust use std::time::Duration; use zaun_client::VoiceEvent; let voice = community.channel_by_name("lounge").expect("a voice channel").join()?; voice.send_audio(&opus_frame); // one 20 ms Opus frame if let Some(VoiceEvent::Audio { member, frame }) = voice.next_event(Duration::from_millis(100)) { play(member, &frame); } ``` Rust uses str0m and reaches the host's TURN relay over UDP, TCP or TLS (`turns:`, TLS 1.3 with the post-quantum X25519MLKEM768 key exchange only). Your app encodes and plays Opus, or uses the built-in `AudioPlayer` below. **Browser:** ```js const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); const voice = await channel.join({ track: stream.getAudioTracks()[0] }); voice.on("track", ({ member, stream }) => playStream(member, stream)); ``` Browsers use their own WebRTC with an encoded transform (`RTCRtpScriptTransform` in Firefox, Safari and Chromium; Chromium's older encoded streams as a fallback). Pages with a Content-Security-Policy need `worker-src blob:`. **Node.js / Bun:** ```js const voice = await channel.join(); const { finished } = voice.play("song.opus"); // an Ogg Opus file, in real time voice.on("audio", ({ member, frame }) => decode(member, frame)); await finished; ``` Node.js and Bun use werift (`npm install werift@0.27`). `voice.sendAudio(frame)` sends one Opus frame. ## Playing music (Rust) `AudioPlayer` plays resources into every voice session subscribed to it, on absolute 20 ms deadlines so the stream keeps real time. ```rust use zaun_client::{AudioPlayer, AudioPlayerEvent, AudioResource}; let voice = community.channel_by_name("music").expect("a voice channel").join()?; let player = AudioPlayer::new()?; voice.subscribe(&player); player.play(AudioResource::ogg_file("intro.opus")?); // no transcoding player.enqueue(AudioResource::ffmpeg_file("song.flac", Default::default())?); // anything ffmpeg reads for event in player.events() { if let AudioPlayerEvent::TrackEnd { .. } = event { // pick the next song } } ``` A player with nobody able to hear it (no subscriber, or everyone muted) pauses itself, and resumes when someone can hear it again. ## Privacy Media goes only through the host's TURN relay unless both the host and your app allow a direct connection (`allow_direct` / `allowDirect`), since a direct connection shows your IP address to the other participants. Each member's key is **pinned** the first time the client sees it; if a host later lists another key for that member, the participant is skipped with a `KeyChanged` event, and `member.fingerprint()` gives people something to compare out of band. --- url: https://zaunchat.github.io/docs/guide/client/bots/ --- # Using bots > List a community's bots and commands, run commands, click components, submit modals, and (as the owner) install and manage bots. Bots answer through the same connection as everything else, so an app uses them with a few calls. This page is about an app **using** bots; to write one, see [Bots](/docs/guide/bots/quickstart/) (hosted) or [External bots](/docs/guide/bots/external-bots/). ## Bots and their commands The client keeps the community's bot commands and bot cards up to date, and loads them once the community is ready. **JavaScript:** ```js client.on("appsReady", (community) => { for (const command of community.commands.values()) console.log(`/${command.name}`); for (const card of community.bots.values()) console.log(card.name, card.capabilities); }); client.on("commandsUpdate", (community, botId) => { /* a bot changed its commands */ }); client.on("botUpdate", (community, card) => { /* installed, updated, re-granted, disabled */ }); const me = community.member(community.data.me); const usable = [...community.commands.values()].filter((c) => me.canUse(c, channel)); ``` A member's `isBot` and `botId` tell whether it is a bot; `community.bot(botId)` fetches its card. **Rust:** ```rust use zaun_client::Event; for event in client.events() { match event { Event::AppsReady(community) => { for command in community.commands() { println!("/{}", command.name); } for card in community.bots() { println!("{} {:?}", card.name, card.capabilities); } } Event::CommandsUpdate { .. } | Event::BotUpdate { .. } => { /* refresh the picker */ } _ => {} } } ``` `Member::is_bot()`, `Member::bot_id()` and `can_use(command, channel)` mirror the JavaScript calls. Every member can read every bot's card: its permissions, whether it can read message content, the hosts it may contact, its storage, voice and direct-message capabilities. Show it wherever a bot's name appears (the BOT badge). ## Running commands, clicking, submitting The host passes each use to the bot; the bot's answer arrives as an event (a normal message, or one of the events below). **JavaScript:** ```js // /weather city: Cairo await channel.invokeCommand(weather, [{ name: "city", type: 3, value: "Cairo" }]); // A button or select on a bot's message await message.click("vote:yes"); // Suggestions while typing: they come as `autocomplete` await channel.autocomplete(weather, [{ name: "city", type: 3, value: "Ca", focused: true }]); client.on("autocomplete", ({ choices }) => showSuggestions(choices)); // A modal the bot opened client.on("modalOpen", async ({ channel, interaction, customId, components }) => { await channel.submitModal(interaction, customId, [{ custom_id: "subject", value: "Hello" }]); }); // Replies only you see, and failures client.on("interactionReply", ({ op, message }) => { /* ephemeral: created, updated, deleted */ }); client.on("interactionFail", ({ reason }) => { /* "timeout", "bot_error" or "bot_unavailable" */ }); ``` **Rust:** ```rust let interaction = channel.invoke_command(weather.command_id, options, None)?; message.click("vote:yes", vec![])?; channel.autocomplete(weather.command_id, focused_options)?; channel.submit_modal(modal_interaction, "feedback", inputs)?; ``` The answers arrive as `Event::InteractionReply`, `Event::ModalOpen`, `Event::Autocomplete` and `Event::InteractionFail`. Using a command needs `USE_APPLICATION_COMMANDS` (on `@everyone` by default) and whatever default permissions the command asks for. ## Installing and managing bots (owners) Only the community's owner, or the host's operator with `zaun-host bot`, installs bots. Upload the `.zbot` file as an attachment first, then install it; show the owner what it asks for before they confirm. **JavaScript:** ```js const card = await community.installBot(attachmentId); // grants: what the manifest asks, within the host's ceiling await community.grantBot(card.bot_id, { capabilities: { message_content: false } }); await community.disableBot(card.bot_id); await community.enableBot(card.bot_id); await community.updateBot(card.bot_id, newAttachmentId); // wider requests wait for approval await community.removeBot(card.bot_id); await community.registerBot(member, "Helper"); // mark a member as an external bot ``` **Rust:** `Community::install_bot`, `grant_bot`, `enable_bot`, `disable_bot`, `update_bot`, `remove_bot` and `register_bot` mirror the JavaScript calls. --- url: https://zaunchat.github.io/docs/guide/client/direct-messages/ --- # Direct messages with bots > Open, read, send in and close direct messages with bots, and let members turn DMs from bots off. A **direct message** (DM) is a private channel between one bot and one member, relayed by the host. Only those two can see it: not the owner, not administrators. Members can open a DM with any bot that has the `dms` capability; bots can open one with a member who allows DMs from bots. ## Opening and sending **JavaScript:** ```js const bot = community.member(botMemberId); const dm = await bot.dm(); // the DM channel, opened if needed await dm.send("hi!"); await bot.send("hi again"); // the same, in one call for (const channel of community.dms) { // this member's open DMs console.log(channel.recipient?.displayName, channel.isDM); } await dm.closeDm(); // hides it for this member ``` **Rust:** ```rust let bot = community.member(bot_member_id); let dm = bot.dm()?; // the DM channel, opened if needed dm.send("hi!")?; bot.send("hi again")?; for channel in community.dms() { println!("{:?} {}", channel.recipient(), channel.is_dm()); } dm.close_dm()?; ``` A DM is a channel: messages, replies, reactions, embeds, a bot's components and modals, and that bot's slash commands all work in it. Message events in a DM are marked as such. ## Events **JavaScript:** ```js client.on("dmCreate", (channel, recipient) => { /* opened by either side, or found at load */ }); client.on("dmDelete", (channel) => { /* this member closed it */ }); client.on("messageCreate", (message) => { if (message.channel.isDM) { /* a message in a DM */ } }); ``` **Rust:** `Event::DmCreate { channel, recipient }` and `Event::DmDelete(channel)`; messages in DMs come as `Event::MessageCreate` like any other. ## The member decides Each member chooses, per community, whether bots may open DMs with them: **JavaScript:** ```js const { dms_from_bots } = await community.dmSettings(); await community.setDmsFromBots(false); ``` **Rust:** ```rust let settings = community.dm_settings()?; community.set_dms_from_bots(false)?; ``` A closed DM stays closed to the bot until the member writes in it or opens it again. Bots are also rate limited (at most 10 new DMs a minute, and 5 messages an hour into a DM the member never wrote in). Errors your app may show: `FORBIDDEN` with reason `dms_closed`, `RATE_LIMITED` with category `dms`, and `NOT_FOUND` for a DM the member isn't part of. --- url: https://zaunchat.github.io/docs/guide/client/typing/ --- # Typing indicators > Send and show typing, and set a channel's typing mode: named, anonymous or off. Each channel has a **typing mode** (see [Typing indicators](/docs/guide/concepts/typing-indicators/)): `named` (the default) shows who is typing, `anonymous` only how many, and `off` nothing at all. The client knows each channel's mode and does the right thing. ## Sending **JavaScript:** ```js // Call on keystrokes; it sends at most what the host accepts, and nothing where typing is off. const sent = channel.startTyping(); // false: typing is off here, nothing was sent ``` **Rust:** ```rust let sent = channel.start_typing()?; // false: typing is off here, nothing was sent ``` ## Showing **JavaScript:** ```js client.on("typingStart", ({ channel, anonymous, count, members }) => { const text = anonymous ? count === 1 ? "Someone is typing…" : count === 2 ? "2 people are typing…" : "Several people are typing…" : `${members.map((m) => m.displayName).join(", ")} typing…`; showTyping(channel, text); }); channel.typing; // now: { kind: "named", member_ids } | { kind: "anonymous", count } | null ``` **Rust:** ```rust use zaun_client::{Event, TypingNow}; if let Event::TypingStart { channel, typing } = event { match typing { TypingNow::Named { member_ids } => { /* show names */ } TypingNow::Anonymous { count } => { /* 1, 2, or 3 meaning "three or more" */ } } } let now = channel.typing(); // Option ``` In an anonymous channel the count is capped: 1, 2, or 3 meaning "three or more", and your own typing is never counted. A typing state lasts a few seconds unless it's repeated. ## Setting a channel's mode Needs `MANAGE_CHANNELS`: **JavaScript:** ```js await channel.setTypingMode("anonymous"); // "named", "anonymous" or "off" channel.typingMode; // the current mode ``` **Rust:** ```rust use zaun_client::protocol::model::TypingMode; channel.set_typing_mode(TypingMode::Anonymous)?; let mode = channel.typing_mode(); ``` --- url: https://zaunchat.github.io/docs/guide/client/status-and-presence/ --- # Status and presence > Set your status, activity and custom status text, and show everyone else's: online, idle, do not disturb, invisible. Every member has a **presence**: a status (online, idle, do not disturb, or offline) and optionally an **activity**, what they are doing ("Playing chess", "Listening to lofi radio"). A member can also set a **custom status text** with an emoji, which the host keeps until it is changed or expires. Bots have the same presence as members ([bots: status and presence](/docs/guide/bots/status-and-presence/)). ## Setting your status and activity Presence is set once for the whole client and goes to every community it is connected to. **JavaScript:** ```js client.setPresence("online", { type: "listening", name: "lofi radio", state: "ChilledCow" }); client.setPresence("dnd"); // no activity client.setPresence("invisible"); // everyone else sees you offline ``` `setPresence` returns `false`, and sends nothing, when the status or the activity is not valid. **Rust:** ```rust use zaun_client::presence::{activity, ActivityType, Status}; let mut listening = activity(ActivityType::Listening, "lofi radio"); listening.state = Some("ChilledCow".into()); client.set_presence(Status::Online, Some(listening))?; client.set_presence(Status::Dnd, None)?; // no activity client.set_presence(Status::Invisible, None)?; // everyone else sees you offline ``` | Status | Everyone else sees | |---|---| | `online` | online | | `idle` | idle (away) | | `dnd` | do not disturb | | `invisible` | offline, with no activity | An activity has a `type` (`kind` in Rust): `playing`, `streaming`, `listening`, `watching`, `competing` or `custom`; a `name`; and optionally `details` and `state` (a second and third line), `started_at` (ms since the epoch, to show an elapsed time), `url` (an `https://` link, streaming only) and `emoji` (custom only). The host shows at most one change per member every 3 seconds. Call it as often as you like: the client keeps the latest, sends it when the window allows, and sends it again after each reconnection. ## Custom status text The custom status is set per community, and the host keeps it (presence is live only). **JavaScript:** ```js await community.setStatusText("Back soon", { emoji: "☕", expiresAt: new Date(Date.now() + 3_600_000) }); await community.setStatusText("Reviewing PRs"); // kept until changed await community.setStatusText(null); // clears it ``` **Rust:** ```rust community.set_status_text(Some("Back soon"), Some("☕"), Some(expires_at_ms))?; community.set_status_text(Some("Reviewing PRs"), None, None)?; // kept until changed community.set_status_text(None, None, None)?; // clears it ``` When it is set, changed, cleared or expires, everyone else gets a **member update** (`memberUpdate` / `Event::MemberUpdate`). ## Showing presence **JavaScript:** ```js const verbs = { playing: "Playing", streaming: "Streaming", listening: "Listening to", watching: "Watching", competing: "Competing in" }; const line = (a) => a.type === "custom" ? `${a.emoji ?? ""} ${a.name}`.trim() : `${verbs[a.type]} ${a.name}`; client.on("presenceUpdate", ({ member, status, activity }) => { showPresence(member, status, activity ? line(activity) : null); }); member.presence; // { status: "online" | "idle" | "dnd" | "offline", activity } member.statusText; // custom status text, or null member.statusEmoji; // its emoji, or null community.presences; // every member who is not offline: [{ member, status, activity }] ``` **Rust:** ```rust use zaun_client::Event; use zaun_client::presence::Status; if let Event::PresenceUpdate { community, presence } = event { let member = community.member(presence.member); let away = presence.status == Status::Idle; let line = presence.activity_line(); // "Listening to lofi radio", or the custom text } let p = member.presence(); // offline when unknown let text = member.status_text(); // Option let emoji = member.status_emoji(); // Option let online = community.presences(); // every member who is not offline ``` After a community is ready, the client loads who is online and emits `presencesReady` (`Event::PresencesReady`); from then on each change arrives as `presenceUpdate` (`Event::PresenceUpdate`). Invisible members look offline, and a member who goes offline leaves `community.presences`. A streaming activity's link should open only after the reader confirms. Activities carry no pictures and no other links, so showing one never makes your app fetch anything. ## Limits | Item | Limit | |---|---| | Activity name | 1–128 characters | | Activity details, state | 0–128 characters each | | Custom status text | 1–128 characters, plus an optional emoji | | Emoji | one Unicode emoji, ≤ 64 bytes | | Presence changes shown | one every 3 s per member; the latest wins | --- url: https://zaunchat.github.io/docs/guide/client/events-and-cache/ --- # Events and the cache > Every event zaun-client emits, in Rust and JavaScript, and what the local cache holds. ## The cache For each community the client keeps a local copy of its profile, channels, roles and the members it has seen, kept current from the host's events. Reading it needs no network round trip: `community.channels()`, `community.roles()`, `community.members()` in Rust; `community.channels`, `.roles`, `.members` (`Collection`s, maps with `find`/`filter`/`map`) in JavaScript. The client keeps **no message history**: fetch it from the host when you need it. ## Events Rust delivers events from `client.events()` (blocking) or `client.next_event(timeout)`; JavaScript from `client.on(name, handler)`. | Rust `Event::` | JavaScript event | When | |---|---|---| | `Ready(community)` | `ready` | a community is loaded and current | | `MessageCreate(message)` | `messageCreate` | a message was posted | | `MessageUpdate { .. }` | `messageUpdate` | a message was edited (partial message) | | `MessageDelete { .. }` | `messageDelete` | a message was deleted (partial message) | | `MessageDeleteBulk { .. }` | `messageDeleteBulk` | many messages were deleted (a ban's cleanup) | | `ReactionAdd` / `ReactionRemove` | `messageReactionAdd` / `messageReactionRemove` | reactions | | `ChannelCreate` / `ChannelUpdate` / `ChannelDelete` | `channelCreate` / `channelUpdate` / `channelDelete` | channel changes, including access gained or lost | | `RoleCreate` / `RoleUpdate` / `RoleDelete` | `roleCreate` / `roleUpdate` / `roleDelete` | role changes | | `MemberAdd` / `MemberUpdate` / `MemberRemove` | `memberAdd` / `memberUpdate` / `memberRemove` | members joining, changing, leaving | | `PresencesReady(community)` | `presencesReady` | who is online in a community loaded (just after `ready`) | | `PresenceUpdate { .. }` | `presenceUpdate` | a member's [status or activity](/docs/guide/client/status-and-presence/) changed | | `VoiceStateUpdate` | `voiceStateUpdate` | someone joined, left or (un)muted in voice | | `CommunityUpdate` | `communityUpdate` | the community's profile changed | | `CommunityDelete { .. }` | `communityDelete` | you were kicked, banned or left | | `CommunityMoving` / `CommunityMoved` / `CommunityMoveRefused` | same names | the owner moved the community to a new host; the client follows | | `Disconnect` | `disconnect` | the connection to one host dropped | | `Offline` / `Online` | `offline` / `online` | the network went away or came back | | `Warning` | `warning` | something odd but recoverable happened | | — | `change` | the store changed: save it (`client.save()`) | | — | `raw` | every event as the host sent it | ## Any other command Objects wrap the common commands. For anything else, `client.command(community, channel, body)` (Rust) sends any protocol command with a typed body from `zaun_client::protocol::command` and decodes the answer. JavaScript has `client.raw` for the low-level client. --- url: https://zaunchat.github.io/docs/guide/bots/why-bots-in-the-host/ --- # Why bots run in the host > How Zaun bots work, and why they run as sandboxed WebAssembly inside the community's own host. On most chat platforms, a bot is somebody else's service. You invite it, and from then on your community's messages are sent to wherever it runs. In Zaun, a bot is a **package** that whoever runs the host installs, and it runs **inside the host**. ## What that gives you - **No new reader.** The host already holds the community's channels. A bot inside it sees only what it was granted, and no third party receives your messages unless you also grant the bot internet access *and* it chooses to send them out. - **No extra network hops.** A bot talks to the community in-process. Only members' own messages cross SimpleX, so bots answer as fast as the host can. - **A real sandbox.** A bot is WebAssembly with no files, no environment and no sockets. Memory and CPU time per call are capped, and its internet access is off unless granted, host by host. - **Transparency.** Every member sees a BOT badge and can open the bot's **card**: its permissions, whether it can read messages, which internet hosts it may reach, its storage. Every change is announced to everyone. - **Only the owner decides.** Only whoever controls the host installs, updates, grants or removes bots, and the operator's configuration is a ceiling even the owner can't exceed. ## A familiar interaction model Bots use a familiar interaction model: slash, user and message commands with options and autocomplete; buttons, selects and Components V2 layouts; modals; ephemeral replies; deferred responses and follow-ups. If you have written an interactions-based bot before, see [Porting an existing bot](/docs/guide/bots/porting-a-bot/). ## How it works 1. The host verifies the package's signature and hashes. 2. It creates a **member** for the bot, with a BOT marker, and a **managed role** holding exactly the granted permission bits. 3. It starts the component in the sandbox and connects it to the community **in-process**. 4. From then on the bot acts through ordinary commands, checked by the same permission engine as a human member's. There is no bot shortcut. ## External bots A program using [`zaun-client`](/docs/guide/client/installation/) that joined like any member can also act as a bot: it's slower (every exchange crosses SimpleX) and not sandboxed by the host, but the protocol is the same. See [External bots](/docs/guide/bots/external-bots/). --- url: https://zaunchat.github.io/docs/guide/bots/quickstart/ --- # Bot quick start > Write, build, pack and install a /ping bot with zbot, in TypeScript (the default) or Rust. A Zaun bot is a WebAssembly component that runs inside the community's own host. You can write it in **TypeScript** with `@zaun/bot` or in **Rust** with the `zaun-bot` crate: both build to the same kind of package and use the same host features. This guide shows TypeScript first; pick the Rust tab to follow along in Rust. [TypeScript or Rust?](/docs/guide/bots/typescript-or-rust/) compares them. 1. **Install the tools.** **TypeScript:** You need Node.js 22 or newer with npm, and `zbot`: ```sh cargo install --git https://github.com/zaunchat/zaun-bot zbot ``` Or download `zbot` for Linux, macOS or Windows from the [zaun-bot releases](https://github.com/zaunchat/zaun-bot/releases). esbuild and jco (which turn your TypeScript into a component) are installed into the project by `npm install`, so `zbot` never downloads anything itself. **Rust:** ```sh rustup target add wasm32-wasip2 cargo install --git https://github.com/zaunchat/zaun-bot zbot ``` Or download `zbot` for Linux, macOS or Windows from the [zaun-bot releases](https://github.com/zaunchat/zaun-bot/releases). 2. **Create a bot.** **TypeScript:** ```sh zbot new ping --lang ts && cd ping npm install ``` - ping/ - package.json depends on @zaun/bot - tsconfig.json - zaun-bot.toml the manifest: what the bot asks for - src/ - index.ts a /ping bot **Rust:** ```sh zbot new ping && cd ping ``` - ping/ - Cargo.toml a cdylib depending on zaun-bot - zaun-bot.toml the manifest: what the bot asks for - src/ - lib.rs a /ping bot 3. **Write the bot.** **TypeScript:** A bot is a `Bot` object: register commands with `bot.command(builder, handler)`, then export the functions the host calls, once, at the end of the entry file. ```ts title="src/index.ts" import { Bot, SlashCommandBuilder } from '@zaun/bot'; const bot = new Bot(); bot.command( new SlashCommandBuilder().setName('ping').setDescription('Check that the bot is alive'), (interaction) => { interaction.reply('pong 🏓'); }, ); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** A bot is a type implementing `Bot`, exported once with `export_bot!`. Every handler has a no-op default; implement the ones you need. ```rust title="src/lib.rs" use zaun_bot::prelude::*; #[derive(Default)] struct Ping; impl Bot for Ping { fn commands(&mut self, _: &Config) -> Vec { vec![SlashCommand::new("ping", "Check that the bot is alive").build()] } fn on_command(&mut self, ctx: Context, command: CommandData) { if command.name == "ping" { let _ = ctx.reply("pong 🏓"); } } } export_bot!(Ping); ``` 4. **Say what it needs** in the manifest. Ask for the least you can: owners see every request in plain words before they install. The manifest is the same for both languages. ```toml title="zaun-bot.toml" app_id = "org.example.ping" version = "0.1.0" name = "Ping" description = "Answers /ping with pong." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES"] [capabilities] # nothing beyond interactions: no message content, no network, no storage ``` 5. **Build, pack and inspect.** **TypeScript:** ```sh zbot build # esbuild src/index.ts → jco componentize → target/bot.wasm zbot pack --unsigned # org.example.ping-0.1.0.zbot zbot inspect *.zbot # what it is and what it asks for, in plain words ``` **Rust:** ```sh zbot build # cargo build --release --target wasm32-wasip2 zbot pack --unsigned # org.example.ping-0.1.0.zbot zbot inspect *.zbot # what it is and what it asks for, in plain words ``` 6. **Install it on a host.** For a development package, the host needs `allow_unsigned = true` in its `[bots]` configuration. ```sh zaun-host bot install --community org.example.ping-0.1.0.zbot ``` The command shows what the bot asks for and asks you to confirm. Members now see `/ping` in their command picker. > **Caution: Answer within 3 seconds** > > Every interaction must be answered within 3 seconds: with a reply, a modal, an update, or a > deferral followed later by an edit (`interaction.deferReply()` then `interaction.editReply(..)` in > TypeScript, `ctx.defer(..)` then `ctx.edit_original(..)` in Rust). The host defers for you at > 2.5 s if a handler is still running, but one handler runs at a time per bot, so slow handlers hold > up the others. > **Tip: TypeScript notes** > > > `setTimeout` and `setInterval` never fire between calls: use `bot.timers` and listen to > `timer`. There is no `fetch`; use `bot.http.fetch(..)`. An autocomplete handler must call > `interaction.respond(..)` before its first `await`. ## Next - [Slash commands](/docs/guide/bots/slash-commands/) and [options](/docs/guide/bots/options-and-autocomplete/) - [Interactions and responses](/docs/guide/bots/interactions/) - [Events](/docs/guide/bots/events/), [direct messages](/docs/guide/bots/direct-messages/) and [voice](/docs/guide/bots/voice-and-music/) - More complete [examples](/docs/examples/) --- url: https://zaunchat.github.io/docs/guide/bots/typescript-or-rust/ --- # TypeScript or Rust? > Both SDKs build the same kind of bot. How they differ in size, speed and the few TypeScript-specific rules. `@zaun/bot` (TypeScript) and the `zaun-bot` crate (Rust) are two SDKs for the same thing: a WebAssembly component the host runs in its sandbox, with the same commands, components, modals, events, direct messages, voice, storage, timers and HTTP. The manifest, `zbot pack`, signing and installing are identical. These docs show TypeScript first. | | TypeScript (`@zaun/bot`) | Rust (`zaun-bot`) | |---|---|---| | API style | builder classes and interaction objects (`SlashCommandBuilder`, `interaction.reply`) | a `Bot` trait with handler methods, builders | | Build | `zbot build`: esbuild bundles `src/index.ts`, jco makes the component | `zbot build`: `cargo build --target wasm32-wasip2` | | Package size | about **24 MB** (the JavaScript engine is inside) | about **300 KB** | | First load on a host | about **11 s** to compile, then cached | well under a second | | A warm call | tens of microseconds (about 22 µs) | under a microsecond (about 0.4 µs) | | Errors | thrown `ZaunError { code, detail, retryAfterMs }` | `Result<_, HostError>` | Either is fast enough for chat: a call is a tiny part of what a member waits for. Choose TypeScript if you know JavaScript, Rust if you want the smallest, fastest package. ## Rules that are specific to TypeScript - **No `setTimeout` or `setInterval`.** Nothing runs between calls, so they never fire. Use `bot.timers.after(ms, tag)` or `bot.timers.every(ms, tag)` and listen with `bot.on('timer', …)`. - **Autocomplete answers synchronously.** Call `interaction.respond(choices)` before the handler's first `await`: the choices are taken when the handler returns. - **Async is fine otherwise.** Host calls are synchronous, so awaiting them (or promises that are already resolved) completes inside the same call. - **No `fetch`.** Use `bot.http.fetch(url, options)`, which goes only to hosts in the bot's `network` grant. - **The entry exports the world.** End `src/index.ts` with `export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports();` - Builders check the limits (custom ids ≤ 100 bytes, ≤ 5 buttons per row, modal titles ≤ 45, …) and throw `ZaunValidationError` before anything reaches the host. ## Reference - [`@zaun/bot` API](/docs/reference/js/zaun-bot/readme/) (generated from the TypeScript source) - [`zaun-bot` crate](/docs/reference/rust/zaun-bot/) (generated from rustdoc) - [Bot WIT interface](/docs/reference/wit/), which both SDKs wrap --- url: https://zaunchat.github.io/docs/guide/bots/slash-commands/ --- # Slash commands > Register slash, user and message commands, sub-commands and groups, and control who can use them. Three kinds of application command: | Kind | `type` | Shown as | TypeScript | Rust | |---|---|---|---|---| | Slash command | 1 `CHAT_INPUT` | `/name options…` in the composer | `new SlashCommandBuilder()` | `SlashCommand::new(name, description)` | | User command | 2 `USER` | Apps → name, on a member | `new ContextMenuCommandBuilder().setType(ApplicationCommandType.User)` | `SlashCommand::user(name)` | | Message command | 3 `MESSAGE` | Apps → name, on a message | `new ContextMenuCommandBuilder().setType(ApplicationCommandType.Message)` | `SlashCommand::message(name)` | ## Registering The SDK registers your commands every time the bot starts, as a bulk overwrite: a command keeps its id as long as its name stays. **TypeScript:** Each `bot.command(builder, execute)` registers one command and its handler: ```ts const bot = new Bot(); bot.command(new SlashCommandBuilder().setName('weather').setDescription("Today's weather"), (interaction) => { interaction.reply('☀️ 24 °C'); }); bot.command(new ContextMenuCommandBuilder().setName('Show profile').setType(ApplicationCommandType.User), (interaction) => { if (!interaction.isUserContextMenuCommand()) return; interaction.reply({ content: `That is ${interaction.targetMember?.displayName}`, ephemeral: true }); }); bot.command(new ContextMenuCommandBuilder().setName('Quote').setType(ApplicationCommandType.Message), (interaction) => { if (!interaction.isMessageContextMenuCommand()) return; interaction.reply(`> ${interaction.targetMessage?.content ?? ''}`); }); ``` To change commands while running, call `setCommands([...])` (exported by `@zaun/bot`). **Rust:** Return your commands from `Bot::commands`. To change them while running, call `zaun_bot::commands::set`. ```rust fn commands(&mut self, _: &Config) -> Vec { vec![ SlashCommand::new("weather", "Today's weather").build(), SlashCommand::user("Show profile").build(), SlashCommand::message("Translate").build(), ] } ``` ## Sub-commands and groups **TypeScript:** ```ts bot.command( new SlashCommandBuilder().setName('remind').setDescription('Reminders') .addSubcommand((s) => s.setName('add').setDescription('Add a reminder') .addStringOption((o) => o.setName('what').setDescription('What to remind').setRequired(true)) .addIntegerOption((o) => o.setName('minutes').setDescription('In how many minutes').setRequired(true).setMinValue(1).setMaxValue(1440))) .addSubcommand((s) => s.setName('list').setDescription('Your reminders')), (interaction) => { if (!interaction.isChatInputCommand()) return; switch (interaction.options.getSubcommand()) { case 'add': { const what = interaction.options.getString('what', true); const minutes = interaction.options.getInteger('minutes', true); interaction.reply({ content: `I'll remind you of "${what}" in ${minutes} min.`, ephemeral: true }); break; } case 'list': interaction.reply({ content: 'No reminders yet.', ephemeral: true }); break; } }, ); ``` Groups use `addSubcommandGroup(..)`; read the path with `options.getSubcommandGroup()` and `options.getSubcommand()`. **Rust:** ```rust use zaun_bot::prelude::*; SlashCommand::new("remind", "Reminders") .sub_command( SubCommand::new("add", "Add a reminder") .option(CommandOptionBuilder::string("what", "What to remind").required()) .option(CommandOptionBuilder::integer("minutes", "In how many minutes").required().range(1.0, 1440.0)), ) .sub_command(SubCommand::new("list", "Your reminders")) .build(); ``` `on_command` then receives the path in `CommandData.group` and `CommandData.sub_command`: ```rust fn on_command(&mut self, ctx: Context, cmd: CommandData) { match (cmd.name.as_str(), cmd.sub_command.as_deref()) { ("remind", Some("add")) => { /* cmd.str("what"), cmd.int("minutes") */ } ("remind", Some("list")) => { /* … */ } _ => {} } } ``` ## Who can use a command - Members need `USE_APPLICATION_COMMANDS` (on `@everyone` by default) and `VIEW_CHANNEL`. - Default member permissions additionally require those bits in the channel: `.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)` in TypeScript, `.default_member_permissions(bits)` in Rust. `0` makes a command owner-only. - Two bots may register the same name; clients show the bot's name beside each command. - In a [direct message](/docs/guide/bots/direct-messages/), only that bot's own commands work. ## Limits 100 slash, 15 user and 15 message commands per bot; up to 25 options and 25 choices; names 1–32 characters (slash commands: lowercase letters, digits, `-` and `_`); descriptions 1–100; at most 8 000 characters of text per command. --- url: https://zaunchat.github.io/docs/guide/bots/options-and-autocomplete/ --- # Options and autocomplete > Command option types, choices, bounds, reading values, and suggesting values as members type. ## Option types | `type` | Kind | TypeScript builder / reader | Rust value | |---|---|---|---| | 3 | string | `addStringOption` / `getString` | `OptionValue::Text` | | 4 | integer (\|x\| < 2^53) | `addIntegerOption` / `getInteger` | `OptionValue::Integer` | | 5 | boolean | `addBooleanOption` / `getBoolean` | `OptionValue::Boolean` | | 6 | user | `addUserOption` / `getUser`, `getMember` | `OptionValue::Id` + `resolved.members` | | 7 | channel | `addChannelOption` / `getChannel` | `OptionValue::Id` + `resolved.channels` | | 8 | role | `addRoleOption` / `getRole` | `OptionValue::Id` + `resolved.roles` | | 9 | mentionable | `addMentionableOption` / `getMentionable` | `OptionValue::Id` + a member or role in `resolved` | | 10 | number | `addNumberOption` / `getNumber` | `OptionValue::Number` | | 11 | attachment | `addAttachmentOption` / `getAttachment` | `OptionValue::Id` + `resolved.attachments` | Types 1 and 2 are sub-commands and groups ([Slash commands](/docs/guide/bots/slash-commands/)). Per option: required (required options come first), up to 25 choices (string, integer, number), minimum and maximum values, minimum and maximum lengths (0–6 000), channel types, autocomplete (not together with choices), and localized names and descriptions. > **Tip: The host validates for you** > > Values are checked **before** the bot sees them: types, choices, bounds and required options. A bot > never receives an integer out of range or a missing required option. ## Reading values **TypeScript:** ```ts const what = interaction.options.getString('what', true); // required: never null const minutes = interaction.options.getInteger('minutes') ?? 5; const loud = interaction.options.getBoolean('loud') ?? false; const who = interaction.options.getUser('who'); // the member, resolved ``` **Rust:** The `Options` trait reads options by name: ```rust let what = cmd.str("what").unwrap_or_default(); let minutes = cmd.int("minutes").unwrap_or(5); let loud = cmd.bool("loud").unwrap_or(false); ``` ## Autocomplete Mark an option as autocomplete, then return suggestions while the member types (at most 25). During autocomplete the focused option holds what was typed so far, unvalidated. **TypeScript:** The third argument of `bot.command` is the autocomplete handler. Call `respond` **before** any `await`: the choices are taken when the handler returns. ```ts const bot = new Bot(); const cities = ['Berlin', 'Cairo', 'Lagos', 'Lima']; bot.command( new SlashCommandBuilder().setName('weather').setDescription("Today's weather") .addStringOption((o) => o.setName('city').setDescription('Which city').setRequired(true).setAutocomplete()), (interaction) => { if (!interaction.isChatInputCommand()) return; const city = interaction.options.getString('city', true); interaction.reply({ embeds: [new EmbedBuilder().setTitle(`Weather in ${city}`).setDescription('☀️ 24 °C')] }); }, (interaction) => { const typed = interaction.options.getFocused().toLowerCase(); interaction.respond(cities.filter((c) => c.toLowerCase().startsWith(typed)).map((c) => ({ name: c, value: c }))); }, ); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** Return the suggestions from `on_autocomplete`; the runtime answers with them. ```rust use zaun_bot::prelude::*; use zaun_bot::types::OptionKind; #[derive(Default)] struct Weather; impl Bot for Weather { fn commands(&mut self, _: &Config) -> Vec { let city = CommandOptionBuilder::new(OptionKind::String, "city", "Which city") .required() .autocomplete(); vec![SlashCommand::new("weather", "Today's weather").option(city).build()] } fn on_autocomplete(&mut self, _: Context, cmd: CommandData) -> Vec { let typed = cmd.str("city").unwrap_or_default().to_lowercase(); ["Berlin", "Cairo", "Lagos", "Lima"] .into_iter() .filter(|c| c.to_lowercase().starts_with(&typed)) .map(|c| text_choice(c, c)) .collect() } fn on_command(&mut self, ctx: Context, cmd: CommandData) { let city = cmd.str("city").unwrap_or("?"); let _ = ctx.reply(EmbedBuilder::new().title(format!("Weather in {city}")).description("☀️ 24 °C")); } } export_bot!(Weather); ``` --- url: https://zaunchat.github.io/docs/guide/bots/interactions/ --- # Interactions and responses > Replies, ephemeral replies, deferrals, message updates, follow-ups and modals; the 3-second and 15-minute rules. An **interaction** is a member using one of the bot's commands, clicking a component on one of its messages, typing in an autocomplete option, or submitting its modal. | `type` | Interaction | TypeScript | Rust | |---|---|---|---| | 2 | application command | `bot.command(builder, execute)` | `on_command` | | 3 | message component | `bot.component(customId, handler)` | `on_component` | | 4 | autocomplete | the third argument of `bot.command`; `interaction.respond(choices)` | `on_autocomplete` (return the choices) | | 5 | modal submit | `bot.modal(customId, handler)` | `on_modal` | In TypeScript, `bot.on('interactionCreate', …)` also sees every interaction. A custom id ending in `:` matches as a prefix (`'vote:'` matches `'vote:yes'`); a `RegExp` or a function works too. ## The first answer: within 3 seconds | Callback `type` | TypeScript | Rust | Allowed for | Effect | |---|---|---|---|---| | 4 | `reply(..)`, `reply({ ephemeral: true, .. })` | `reply`, `reply_ephemeral` | command, component, modal | a message in the channel, or one only the invoker sees | | 5 | `deferReply({ ephemeral? })` | `defer(ephemeral)` | command, component, modal | "thinking…", finished later with an edit | | 6 | `deferUpdate()` | `defer_update` | component, modal opened from a component | nothing visible yet | | 7 | `update(..)` | `update_message` | component, modal opened from a component | replaces the clicked message (it must be the bot's) | | 8 | `respond(choices)` | return from `on_autocomplete` | autocomplete | up to 25 suggestions | | 9 | `showModal(modal)` | `show_modal` | command, component | opens a form | **TypeScript:** ```ts bot.command(new SlashCommandBuilder().setName('report').setDescription('Build a report'), async (interaction) => { interaction.deferReply(); // "thinking…" const result = buildReport(); // slow work interaction.editReply(result); // replaces the thinking state }); ``` **Rust:** ```rust fn on_command(&mut self, ctx: Context, cmd: CommandData) { let _ = ctx.defer(false); // "thinking…" let result = slow_work(&cmd); let _ = ctx.edit_original(result); // replaces the thinking state } ``` ## After the first answer: 15 minutes | TypeScript | Rust | Does | |---|---|---| | `followUp(..)` | `followup(..)` | up to 10 more messages (ephemeral or not) | | `editReply(..)` | `edit_original(..)` | replaces the first answer | | `deleteReply()` | `delete_original()` | removes it | If no answer arrives in time, the invoker sees "the bot did not respond". The runtime sends a deferral by itself at 2.5 s while your handler is still running, so in practice that happens only when the bot crashes. ## Ephemeral replies An ephemeral reply (`reply({ content, ephemeral: true })` in TypeScript, `ctx.reply_ephemeral(..)` in Rust) reaches only the invoker. It is never stored in the channel and disappears with the interaction (15 minutes). Use it for confirmations, errors and private results. ## What a handler receives The interaction carries its id, the channel, the invoker (`interaction.member`, and `interaction.userId` in TypeScript), the bot's effective permissions in the channel, the invoker's locale when known, and for components the message holding the component. The data: - **Commands:** name, sub-command path, options (validated), resolved members, channels, roles and attachments, and the target of user and message commands (`targetMember`, `targetMessage` in TypeScript; `target_id` in Rust). - **Components:** `customId` and, for selects, the chosen `values`. - **Modals:** the modal's `customId` and each input (`interaction.fields.getTextInputValue('subject')` in TypeScript, `modal.text("subject")` in Rust). In TypeScript the type guards `isChatInputCommand()`, `isUserContextMenuCommand()`, `isMessageContextMenuCommand()`, `isButton()`, `isStringSelectMenu()`, `isModalSubmit()` and `isAutocomplete()` narrow the type. In TypeScript, a handler that throws is logged and emitted as `error`, and the invoker gets an ephemeral "Something went wrong." ## Security Only the bot that received an interaction can answer it: the host checks that the answer comes from that bot's own connection, so there are no tokens to leak. A click is accepted only if the member can read the message and the component exists and is enabled; a modal submission only if this member has that modal open. --- url: https://zaunchat.github.io/docs/guide/bots/components/ --- # Buttons, selects and layouts > Message components: buttons, selects, and Components V2 containers, sections and media. Only bots may send components, and **pictures and files are attachments of the same message, never URLs**: clients never load anything remote to show a component. ## Buttons and selects (classic layout) Up to 5 **action rows**; each holds up to 5 buttons or one select. **TypeScript:** ```ts interaction.reply({ content: 'Pick one', components: [ new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId('a').setLabel('Option A').setStyle(ButtonStyle.Primary), new ButtonBuilder().setCustomId('b').setLabel('Option B').setStyle(ButtonStyle.Secondary), new ButtonBuilder().setURL('https://zaun.example/help').setLabel('Help'), ), new ActionRowBuilder().addComponents( new StringSelectMenuBuilder().setCustomId('colour').setPlaceholder('Colour') .addOptions({ label: 'Red', value: 'red' }, { label: 'Blue', value: 'blue' }), ), ], }); ``` Clicks go to `bot.component(customId, handler)`. Answer with `interaction.update(..)` to change the message in place, `interaction.reply(..)` for a new message, or `interaction.deferUpdate()`. ```ts bot.component('a', (interaction) => interaction.update({ content: 'You picked A', components: [] })); bot.component('colour', (interaction) => interaction.reply({ content: `Colour: ${interaction.values.join(', ')}`, ephemeral: true })); ``` **Rust:** ```rust Reply::new() .content("Pick one") .row(ActionRow::buttons([ Button::primary("a", "Option A"), Button::secondary("b", "Option B"), Button::link("https://zaun.example/help", "Help"), ])) .row(ActionRow::select( Select::strings("colour", &[("Red", "red"), ("Blue", "blue")]).placeholder("Colour"), )); ``` Clicks arrive in `on_component` with the component's `custom_id` (and `values` for selects). Answer with `ctx.update_message(..)` to change the message in place, `ctx.reply(..)` for a new message, or `ctx.defer_update()`. ```rust fn on_component(&mut self, ctx: Context, c: ComponentData) { match c.custom_id.as_str() { "a" => { let _ = ctx.update_message(Reply::new().content("You picked A")); } "colour" => { let _ = ctx.reply_ephemeral(format!("Colour: {}", c.values.join(", "))); } _ => {} } } ``` Link buttons take `https://` only, and readers confirm before they open. ## Components V2 A Components V2 message has no content or embeds: components carry everything. The flag can't be removed later. In TypeScript, a reply whose components are layout builders (a container, section, text display, …) is sent as V2; in Rust, `Reply::v2()` or `Reply::container(..)` turns it on. **TypeScript:** ```ts import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ContainerBuilder, SectionBuilder, SeparatorBuilder, TextDisplayBuilder, } from '@zaun/bot'; interaction.reply({ components: [ new ContainerBuilder().setAccentColor(0x5865f2) .addTextDisplayComponents(new TextDisplayBuilder().setContent('## Release 1.2\nEverything new this week.')) .addSeparatorComponents(new SeparatorBuilder()) .addSectionComponents(new SectionBuilder() .addTextDisplayComponents(new TextDisplayBuilder().setContent('Read the notes')) .setButtonAccessory(new ButtonBuilder().setCustomId('notes').setLabel('Open').setStyle(ButtonStyle.Primary))) .addActionRowComponents(new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId('ok').setLabel('Got it').setStyle(ButtonStyle.Success))), ], }); ``` **Rust:** ```rust Reply::new().container( Container::new() .accent(0x5865F2) .text("## Release 1.2\nEverything new this week.") .separator() .section(Section::with_button(&["Read the notes"], Button::primary("notes", "Open"))) .row(ActionRow::buttons([Button::success("ok", "Got it")])), ); ``` ## Reference | `type` | Component | TypeScript builder | Where | Key fields and limits | |---|---|---|---|---| | 1 | Action Row | `ActionRowBuilder` | message, container | 1–5 buttons or 1 select | | 2 | Button | `ButtonBuilder` | action row, section accessory | styles 1 primary, 2 secondary, 3 success, 4 danger, 5 link; label ≤ 80; emoji; custom id for 1–4 | | 3 | String Select | `StringSelectMenuBuilder` | action row, modal label | ≤ 25 options; placeholder ≤ 150; min/max values 0–25 | | 4 | Text Input | `TextInputBuilder` | modal label | short or paragraph; length 0–4 000 | | 5–8 | User / Role / Mentionable / Channel Select | `UserSelectMenuBuilder`, `RoleSelectMenuBuilder`, `MentionableSelectMenuBuilder`, `ChannelSelectMenuBuilder` | action row, modal label | default values; channel types (8) | | 9 | Section | `SectionBuilder` | V2 message, container | 1–3 text displays + a button or thumbnail | | 10 | Text Display | `TextDisplayBuilder` | V2 message, container, section, modal | Markdown; ≤ 4 000 characters per message in all | | 11 | Thumbnail | `ThumbnailBuilder` | section accessory | an image attachment | | 12 | Media Gallery | `MediaGalleryBuilder` | V2 message, container | 1–10 attachments | | 13 | File | `FileBuilder` | V2 message, container | one attachment | | 14 | Separator | `SeparatorBuilder` | V2 message, container | divider; small or large spacing | | 17 | Container | `ContainerBuilder` | V2 message | children 1, 9, 10, 12, 13, 14; accent colour; spoiler | | 18 | Label | `LabelBuilder` | modal | label ≤ 45, description ≤ 100, one input | | 19 | File Upload | `FileUploadBuilder` | modal label | 0–10 files | | 21 | Radio Group | `RadioGroupBuilder` | modal label | 2–10 options | | 22 | Checkbox Group | `CheckboxGroupBuilder` | modal label | 1–10 options | | 23 | Checkbox | `CheckboxBuilder` | modal label | never required | Totals: classic messages up to 5 action rows; V2 messages up to 40 components counting nested ones. Custom ids are 1–100 bytes and unique per message or modal. Premium buttons are not supported. --- url: https://zaunchat.github.io/docs/guide/bots/modals/ --- # Modals > Open a form from a command or a button, and read what the member submitted. A modal is a form the client shows over the conversation. Open one in answer to a command or a component click. A modal has a custom id, a title (≤ 45 characters) and 1–5 top-level items: **labels**, each wrapping one input (text input, select, radio group, checkbox group, checkbox or file upload), and text displays. **TypeScript:** ```ts import { LabelBuilder, ModalBuilder, StringSelectMenuBuilder, TextDisplayBuilder, TextInputBuilder, TextInputStyle, } from '@zaun/bot'; interaction.showModal(new ModalBuilder().setCustomId('report').setTitle('Report a problem') .addTextDisplayComponents(new TextDisplayBuilder().setContent('Tell us what happened. Moderators will read it.')) .addTextInput('Summary', new TextInputBuilder().setCustomId('summary').setStyle(TextInputStyle.Short).setMinLength(5).setMaxLength(80)) .addTextInput('Details', new TextInputBuilder().setCustomId('details').setStyle(TextInputStyle.Paragraph).setRequired(false)) .addLabelComponents(new LabelBuilder().setLabel('Area').setComponent( new StringSelectMenuBuilder().setCustomId('area').addOptions({ label: 'Chat', value: 'chat' }, { label: 'Voice', value: 'voice' })))); ``` **Rust:** ```rust let modal = Modal::new("report", "Report a problem") .text("Tell us what happened. Moderators will read it.") .input("Summary", TextInput::short("summary").length(5, 80)) .input("Details", TextInput::paragraph("details").required(false)) .select("Area", Select::strings("area", &[("Chat", "chat"), ("Voice", "voice")])); ctx.show_modal(modal)?; ``` ## Reading the submission **TypeScript:** ```ts bot.modal('report', (interaction) => { const summary = interaction.fields.getTextInputValue('summary'); const details = interaction.fields.getTextInputValue('details') || '(none)'; const area = interaction.fields.getStringSelectValues('area')[0]; interaction.reply({ content: `Thanks! We got: ${summary} (${area})`, ephemeral: true }); }); ``` Also `getRadioValue`, `getCheckbox`, `getSelectedMembers` and `getUploadedFiles`. **Rust:** ```rust fn on_modal(&mut self, ctx: Context, modal: ModalData) { let summary = modal.text("summary").unwrap_or_default(); let details = modal.text("details").unwrap_or("(none)"); let _ = ctx.reply_ephemeral(format!("Thanks! We got: {summary}")); } ``` A text input gives its text; a checkbox gives `"true"` or `"false"`; selects, radio and checkbox groups give their chosen values; a file upload gives attachment ids. ## What the host checks The host checks every submission against the modal it showed: required inputs present, lengths and counts in bounds, choices among the options. A modal can be submitted **once**, by the member it was shown to, within 15 minutes. ## Resulting code See the [feedback form example](/docs/examples/feedback-modal/). --- url: https://zaunchat.github.io/docs/guide/bots/embeds/ --- # Embeds > Rich embed cards in bot messages, their limits, and the rules for pictures and links. Embeds are rich cards attached to a message: **TypeScript:** ```ts interaction.reply({ embeds: [ new EmbedBuilder() .setTitle('Build #412 passed') .setURL('https://ci.example.org/412') .setDescription('All 1 204 tests green.') .setColor(0x2ecc71) .addFields( { name: 'Duration', value: '6 min', inline: true }, { name: 'Commit', value: '`995900c`', inline: true }, ) .setFooter({ text: 'CI bot' }), ], }); ``` **Rust:** ```rust let _ = ctx.reply( EmbedBuilder::new() .title("Build #412 passed") .url("https://ci.example.org/412") .description("All 1 204 tests green.") .color(0x2ECC71) .field("Duration", "6 min", true) .field("Commit", "`995900c`", true) .footer("CI bot"), ); ``` | Field | Limit | |---|---| | title | ≤ 256 | | description | ≤ 4 096 | | fields | ≤ 25; name ≤ 256, value ≤ 1 024 | | author name / footer text | ≤ 256 / ≤ 2 048 | | per message | ≤ 10 embeds, ≤ 6 000 characters of text in all | ## Rules - **Pictures** (image, thumbnail, author and footer icons) are **attachments of the same message**, never URLs. Upload them first (needs the `attachments` capability): `bot.messages.upload(..)` in TypeScript, `zaun_bot::messages::upload` in Rust; then `setImage(attachmentId)`. - **Links** are `https://` only, with no user name or password, and open only when clicked. - An embed must show something: a title, description, author, footer, picture or field. - Embeds need the `EMBED_LINKS` permission. --- url: https://zaunchat.github.io/docs/guide/bots/events/ --- # Events > Follow what happens in the community: messages, reactions, members, channels, roles, typing, presence and direct messages. Beyond its own commands and components, a bot can follow what happens in the community. It gets only what its manifest asks for, some groups need a capability the owner grants, and it only ever sees events for channels it can view. ## Asking for events In `zaun-bot.toml`, `events` lists groups, exact event types, or `*` for everything the capabilities allow: ```toml title="zaun-bot.toml" events = ["messages", "reactions", "members"] # groups # events = ["message.created", "member.joined"] # or exact types # events = ["*"] # everything the capabilities allow [capabilities] members = true # needed for the members group ``` | Group | Event types | Needs | |---|---|---| | `messages` | `message.created`, `message.updated`, `message.deleted`, `messages.bulk_deleted` | — | | `reactions` | `reaction.added`, `reaction.removed` | — | | `members` | `member.joined`, `member.updated`, `member.left`, `member.removed`, `member.roles_updated`, `member.timed_out` | capability `members` | | `channels` | `channel.created`, `channel.updated`, `channel.deleted`, `channel.reordered` | — | | `roles` | `role.created`, `role.updated`, `role.deleted`, `role.reordered` | — | | `typing` | `signal.typing` | — | | `presence` | `signal.presence` | capability `presence` | | `community` | `community.updated` | — | | `commands` | `command.updated` | — | | `dms` | `dm.created`, `dm.closed` | capability `dms` | **Message content.** Without the `message_content` capability, other members' messages arrive with empty content, no embeds and no attachments, except messages that mention the bot, reply to it, or are in a direct message with it. Every member can see on the bot card whether a bot reads all messages. ## Handlers The `ready` event always comes first, once the bot's connection is up, with its own ids and community. Every handler gets an **event context** to act with. **TypeScript:** ```ts const bot = new Bot(); bot.on('ready', (me) => bot.log.info(`up as ${me.memberId}`)); bot.on('messageCreate', (message, ctx) => { if (ctx.isMe(message.authorId)) return; // never answer yourself if (message.content.includes('hello')) { ctx.react(message, '👋'); ctx.reply(message, 'Hello!'); } if (message.isDM) ctx.send(message.channelId, 'Thanks for writing.'); }); bot.on('memberAdd', (member, ctx) => { ctx.dm(member.memberId, 'Welcome!'); // capability `dms` }); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` `init` runs earlier, when the instance starts; `ready` tells the bot who it is (`bot.me`). **Rust:** ```rust use zaun_bot::prelude::*; #[derive(Default)] struct Greeter; impl Bot for Greeter { fn on_message_create(&mut self, ctx: EventContext, message: Message, is_dm: bool) { if ctx.is_me(&message.author_id) { return; // never answer yourself } if message.content.contains("hello") { let _ = ctx.react(&message, "👋"); let _ = ctx.reply_to(&message, "Hello!"); } if is_dm { let _ = ctx.send(&message.channel_id, "Thanks for writing."); } } fn on_member_join(&mut self, ctx: EventContext, member: Member) { let _ = ctx.dm(&member.member_id, "Welcome!"); // capability `dms` } } export_bot!(Greeter); ``` To see events before the typed handlers, override `on_event(ctx, event)`; call `zaun_bot::dispatch(self, ctx, event)` to keep the typed handlers too. ## Every event | TypeScript `bot.on(..)` | Rust handler | Group | |---|---|---| | `ready` | `on_ready` | always | | `messageCreate`, `messageUpdate`, `messageDelete`, `messageDeleteBulk` (messages carry `isDM`) | `on_message_create`, `on_message_update`, `on_message_delete`, `on_message_delete_bulk` | `messages` | | `messageReactionAdd`, `messageReactionRemove` | `on_reaction_add`, `on_reaction_remove` | `reactions` | | `memberAdd`, `memberUpdate`, `memberRemove` | `on_member_join`, `on_member_update`, `on_member_leave` | `members` | | `removed` (this bot was kicked or banned) | `on_removed` | `members` | | `memberRolesUpdate`, `memberTimeout` | `on_member_roles_update`, `on_member_timeout` | `members` | | `channelCreate`, `channelUpdate`, `channelDelete` | `on_channel_create`, `on_channel_update`, `on_channel_delete` | `channels` | | `roleCreate`, `roleUpdate`, `roleDelete` | `on_role_create`, `on_role_update`, `on_role_delete` | `roles` | | `typingStart` | `on_typing_start` | `typing` | | `presenceUpdate` (`{ memberId, status, activity }`; see [Status and presence](/docs/guide/bots/status-and-presence/#other-members-presence)) | `on_presence_update` | `presence` | | `communityUpdate` | `on_community_update` | `community` | | `commandsUpdate` | `on_commands_update` | `commands` | | `dmCreate`, `dmDelete` | `on_dm_open`, `on_dm_close` | `dms` | | `raw` (anything without a typed event, such as `channel.reordered`) | `on_raw` | — | TypeScript also has `interactionCreate`, `timer`, `voiceEvent` (and `trackStart`, `trackEnd`, …; see [Voice and music](/docs/guide/bots/voice-and-music/)) and `error`. ## The event context | TypeScript | Rust | Does | |---|---|---| | `ctx.send(channelId, reply)` | `ctx.send(channel_id, reply)` | posts a message | | `ctx.reply(message, reply)` | `ctx.reply_to(&message, reply)` | posts a reply in the message's channel | | `ctx.react(message, emoji)` | `ctx.react(&message, emoji)` | adds a reaction | | `ctx.delete(message)` | `ctx.delete_message(&message)` | deletes it (the bot's own, or any with `MANAGE_MESSAGES`) | | `ctx.dm(memberId, reply)` | `ctx.dm(member_id, reply)` | sends a [direct message](/docs/guide/bots/direct-messages/) | | `ctx.isMe(memberId)` | `ctx.is_me(member_id)` | whether that is the bot itself | | `ctx.setPresence(status, activity?)`, `ctx.setStatusText(text)` | `zaun_bot::presence::set(..)`, `presence::set_status_text(..)` | sets the bot's own [status and presence](/docs/guide/bots/status-and-presence/) | Handlers run one at a time, so keep them short: long work blocks the bot's next events and interactions. Every call is an ordinary command on the bot's member, checked by the host's permission engine. ## Typing events and privacy A channel's typing indicator can be `named`, `anonymous` or `off` ([Typing indicators](/docs/guide/concepts/typing-indicators/)). A bot subscribed to `typing` gets the same shape a member's app would: names in a named channel, only a count in an anonymous one, and nothing in a channel where typing is off. --- url: https://zaunchat.github.io/docs/guide/bots/direct-messages/ --- # Direct messages > A bot talks privately with one member: what it needs, how to send, what the member controls, and the limits against spam. A bot can talk to a member privately, in a **direct message** (DM): a channel only the bot and that member can see. Not the owner, not administrators. The host relays it like any channel, so it is as private as the rest of the community: it never leaves the host, and no third party gets it. A DM is always between one bot and one member; members don't DM each other through the host. ## What the bot needs - The **`dms` capability** in its manifest, granted by the owner. The operator can forbid it for the whole host with `[bots] allow_dms = false`. Members see "can send direct messages" on the bot card. - `events = ["dms"]` (or `*`) to hear DMs opening and closing, and `messages` to hear what members write in them. A DM to the bot always arrives whole, even without `message_content`. ```toml title="zaun-bot.toml" events = ["dms", "messages"] [capabilities] dms = true ``` ## Sending **TypeScript:** ```ts // From any event listener: const { channelId, messageId } = ctx.dm(memberId, 'Hi! Your report was received.'); // From a command, to the person who used it: bot.messages.dm(interaction.member.memberId, { content: 'Here are your details', embeds: [details] }); interaction.reply({ content: 'Check your direct messages.', ephemeral: true }); // Lower level: const dm = bot.dms.open(memberId); // the DM channel, opened if needed bot.dms.listOpen(); // the bot's open DMs bot.dms.close(dm.channelId); ``` A refusal (the member turned DMs from bots off) throws `ZaunError` with `code: 'FORBIDDEN'` and `detail: 'dms_closed'`. **Rust:** ```rust // From any event handler: let (channel_id, message_id) = ctx.dm(&member_id, "Hi! Your report was received.")?; // From a command handler, to the person who used it: let me = ctx.member.member_id.clone(); ctx.dm(&me, Reply::from("Here are your details").embed(details))?; ctx.reply_ephemeral("Check your direct messages.")?; ``` The lower-level calls are in `zaun_bot::dms`: `open(member_id)`, `close(channel_id)`, `list_open()`. A refusal is a `HostError` with code `FORBIDDEN` and reason `dms_closed`. `dm` opens the DM when there is none, then sends. Replies, reactions, embeds, components and modals all work in a DM, and so do the bot's own slash commands (only that bot's commands work there). Message events in a DM are marked (`message.isDM` in TypeScript, `is_dm` in Rust). ## The member decides - A member can turn **DMs from bots off**, per community. Then a bot can't open a new DM with them: the call fails with `FORBIDDEN` and reason `dms_closed`. Handle it; it isn't an error in your bot. - A member can **close** a DM. Until they open it again (or write in it), the bot can't write into it (`dms_closed`). - Members can open a DM with a bot themselves, if the bot has `dms`. In apps, members do this with [zaun-client](/docs/guide/client/direct-messages/): `member.dm()`, `channel.closeDm()` and `community.setDmsFromBots(false)`. ## Limits against spam - A bot opens at most **10 new DMs per minute**. - Into a DM the member has never written in, a bot writes at most **5 messages per hour**. Once the member writes (or uses a command or button there), the limit lifts. - Beyond either: `RATE_LIMITED` with category `dms` and a retry time. Answers to interactions are never limited this way: the member asked. ## Resulting code See the [welcome DM example](/docs/examples/welcome-dm/): it greets new members by DM, answers what they write back, and offers `/dm-me`. --- url: https://zaunchat.github.io/docs/guide/bots/status-and-presence/ --- # Status and presence > Set the bot's status, activity and custom status text, at start or from a handler, and follow other members' presence. Every member sees a bot's presence next to its name, as they see anyone's: a **status** (online, idle, do not disturb) and an **activity**, what it is doing: "Playing chess", "Listening to lofi radio", "Watching the queue". A bot can also set a **custom status text**: short text with an emoji, kept by the host until the bot changes it or it expires. Setting its own presence and status text needs no capability: it only describes the bot itself. Receiving other members' presence needs the `presence` capability. ## Setting the status and activity Set it when the instance starts: presence is not kept across restarts, and a bot starts `online` without an activity. **TypeScript:** ```ts const bot = new Bot(); bot.on('init', () => bot.presence.set('online', Activity.listening('lofi radio').setState('ChilledCow')), ); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** ```rust use zaun_bot::prelude::*; use zaun_bot::presence; #[derive(Default)] struct Dj; impl Bot for Dj { fn on_start(&mut self, _: &Config) { presence::set(Status::Online, Activity::listening("lofi radio").state("ChilledCow")); } } export_bot!(Dj); ``` `init` (TypeScript) and `on_start` (Rust) run each time the instance starts, before its commands register. The [ping example](/docs/examples/ping/) shows "Listening to /ping" this way. ### Statuses | TypeScript | Rust | Members see | |---|---|---| | `'online'` | `Status::Online` | online | | `'idle'` | `Status::Idle` | idle (away) | | `'dnd'` | `Status::Dnd` | do not disturb | | `'invisible'` | `Status::Invisible` | offline, with no activity | A bot shows as offline when it stops, crashes or is disabled. ### Activities **TypeScript:** | Activity | Members see | |---|---| | `Activity.playing('chess')` | Playing chess | | `Activity.streaming('speedrun', 'https://video.example.org/live')` | Streaming speedrun, with a link | | `Activity.listening('lofi radio')` | Listening to lofi radio | | `Activity.watching('the queue')` | Watching the queue | | `Activity.competing('the cup')` | Competing in the cup | | `Activity.custom('Taking requests').setEmoji('🎵')` | 🎵 Taking requests | Add a second and third line with `setDetails(..)` and `setState(..)`, and an elapsed time with `setStartedAt(ms)` (ms since the epoch). Each returns a new `Activity`. **Rust:** | Activity | Members see | |---|---| | `Activity::playing("chess")` | Playing chess | | `Activity::streaming("speedrun", "https://video.example.org/live")` | Streaming speedrun, with a link | | `Activity::listening("lofi radio")` | Listening to lofi radio | | `Activity::watching("the queue")` | Watching the queue | | `Activity::competing("the cup")` | Competing in the cup | | `Activity::custom("Taking requests").emoji("🎵")` | 🎵 Taking requests | Add a second and third line with `.details(..)` and `.state(..)`, and an elapsed time with `.started_at(ms)` (ms since the epoch). A streaming link is `https://` only, and a member's app opens it only after the member confirms. Activities carry no pictures and no other links, so showing one never makes an app fetch anything. To clear the activity, set the status alone: `bot.presence.set('online')` in TypeScript, `presence::set(Status::Online, None)` in Rust. ## Changing it from a handler A bot can change its presence at any time: when a command runs, when a track starts, on a timer. **TypeScript:** ```ts const bot = new Bot(); bot.command( new SlashCommandBuilder().setName('focus').setDescription('Do not disturb for a while'), (interaction) => { bot.presence.set('dnd', Activity.custom('Focusing').setEmoji('🎧')); interaction.reply('Do not disturb is on.'); }, ); bot.on('trackStart', (title) => bot.presence.set('online', Activity.listening(title ?? 'music'))); bot.on('trackEnd', () => bot.presence.set('online')); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` `bot.presence` works everywhere. In an event listener, `ctx.setPresence(status, activity?)` and `ctx.setStatusText(text)` do the same. **Rust:** ```rust use zaun_bot::prelude::*; #[derive(Default)] struct Focus; impl Bot for Focus { fn commands(&mut self, _: &Config) -> Vec { vec![SlashCommand::new("focus", "Do not disturb for a while").build()] } fn on_command(&mut self, ctx: Context, command: CommandData) { if command.name == "focus" { ctx.set_presence(Status::Dnd, Activity::custom("Focusing").emoji("🎧")); let _ = ctx.reply("Do not disturb is on."); } } } export_bot!(Focus); ``` `zaun_bot::presence::set` works everywhere, including event handlers. In an interaction handler, `ctx.set_presence(status, activity)` and `ctx.set_status_text(text)` do the same. The [music example](/docs/examples/music/) shows "Listening to" the current track while it plays. **Rate.** The host shows at most one change every 3 seconds. Set it as often as you like: a newer call replaces one that has not gone out yet, so the latest always wins. ## Custom status text **TypeScript:** ```ts bot.presence.setStatusText('Type /play'); // kept until changed bot.presence.setStatus('Back soon', '☕', until); // text, emoji, and when the host clears it bot.presence.clearStatus(); ``` **Rust:** ```rust use zaun_bot::presence; presence::set_status_text("Type /play")?; // kept until changed presence::set_status(Some("Back soon"), Some("☕"), Some(until))?; // text, emoji, and when the host clears it presence::clear_status()?; ``` `until` is a time in ms since the epoch; leave it out to keep the status until it changes. Unlike presence, the host **keeps** a custom status: it survives restarts. These calls go to the host and return its refusal (TypeScript throws a `ZaunError`; Rust returns a `HostError`), for example for text that is too long. ## Other members' presence Ask for the `presence` event group and the `presence` capability: ```toml title="zaun-bot.toml" events = ["presence"] [capabilities] presence = true # receive other members' status and activity ``` **TypeScript:** ```ts bot.on('presenceUpdate', (p, ctx) => { // p: { memberId, status, activity? } if (ctx.isMe(p.memberId)) return; if (p.activity?.kind === 'listening') { bot.log.info(`${p.memberId} is listening to ${p.activity.name}`); } }); ``` **Rust:** ```rust use zaun_bot::prelude::*; use zaun_bot::presence::ActivityType; use zaun_bot::types::Presence; #[derive(Default)] struct Watcher; impl Bot for Watcher { fn on_presence_update(&mut self, ctx: EventContext, p: Presence) { if ctx.is_me(&p.member_id) { return; } if let Some(a) = p.activity.filter(|a| a.kind == ActivityType::Listening) { log_info!("{} is listening to {}", p.member_id, a.name); } } } export_bot!(Watcher); ``` `status` is `online`, `idle`, `dnd` or `offline`: invisible members arrive as `offline`, with no activity. The activity has the same fields a bot sets: `kind` (`playing`, `streaming`, `listening`, `watching`, `competing` or `custom`), `name`, and optionally `details`, `state`, `url` (streaming), `startedAt` / `started_at` and `emoji` (custom). Other members' custom status text is not part of what a bot receives. ## Limits | Item | Limit | |---|---| | Activity name | 1–128 characters | | Activity details, state | 0–128 characters each | | Streaming link | `https://` only, streaming activities only | | Activity emoji | one Unicode emoji (≤ 64 bytes), custom activities only | | Custom status text | 1–128 characters of plain text, plus an optional emoji | | Presence changes shown | one every 3 s; the latest wins | An activity outside these limits is not shown. --- url: https://zaunchat.github.io/docs/guide/bots/voice-and-music/ --- # Voice and music > A bot joins a voice channel and plays Opus audio from a URL, from bytes it holds, or from packets it makes; queue, controls and events. A bot with the `voice` capability can join a voice channel and play audio: a music bot, a soundboard, text-to-speech, an alarm. The **host** joins as the bot and sends the audio in real time; the bot only says what to play, so it never runs a codec, a network stack or a clock. **TypeScript:** ```ts bot.voice.join(channelId); // returns once audio can flow bot.voice.play({ url: 'https://music.example.org/intro.opus', title: 'Intro' }); bot.voice.enqueue({ url: 'https://music.example.org/song.opus', title: 'Song' }); bot.voice.pause(); bot.voice.resume(); bot.voice.skip(); bot.voice.stop(); // and clear the queue bot.voice.leave(); ``` **Rust:** ```rust use zaun_bot::Voice; Voice::join(channel_id)?; // returns once audio can flow Voice::play_url("https://music.example.org/intro.opus", Some("Intro"))?; Voice::enqueue_url("https://music.example.org/song.opus", Some("Song"))?; Voice::pause(); Voice::resume(); Voice::skip(); Voice::stop(); // and clear the queue Voice::leave(); ``` The complete bot is the [music example](/docs/examples/music/): `/join`, `/play`, `/queue`, `/skip`, `/pause`, `/resume`, `/stop`, `/leave`, and buttons on the now-playing message. ## What the bot needs ```toml title="zaun-bot.toml" permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "CONNECT", "SPEAK"] [capabilities] voice = true # join voice channels and play audio network = ["music.example.org"] # where URLs may be fetched from ``` - `voice` is a capability the owner grants, within the operator's ceiling (`[bots] allow_voice`, on by default). Every member can see it on the bot card. - `CONNECT` and `SPEAK` apply exactly as for members, per channel. A bot without `SPEAK` (or server-muted) stays in the channel and its player pauses itself. - Playing a URL fetches through the bot's `network` grant, with the same checks as [HTTP](/docs/guide/bots/storage-timers-http/): `https://` only, no private addresses, no redirects. The server learns the host's network address. ## Audio sources Nothing is transcoded: audio is **Opus**, the codec every Zaun client plays. | Source | TypeScript | Rust | Notes | |---|---|---|---| | An `https://` Ogg Opus file or stream (`.opus`, or `.ogg` holding Opus) | `play({ url })`, `enqueue({ url })`, or a plain URL string | `Voice::play_url`, `Voice::enqueue_url` | fetched by the host as it plays; ≤ 128 MiB | | Ogg Opus bytes the bot holds | `play({ ogg: bytes })` | `Voice::play_ogg` | ≤ 16 MiB per call | | Opus packets the bot makes | `play({ pushed: true })`, `push(packets)`, `endStream()` | `Voice::start_stream`, `Voice::push_opus`, `Voice::end_stream` | 2.5–120 ms per packet, ≤ 1 000 bytes; `BUSY` past 3 s buffered | To play MP3, FLAC or anything else, convert it to Opus once, before publishing it: ```sh ffmpeg -i song.flac -c:a libopus -b:a 128k -vbr on -frame_duration 20 song.opus ``` A bot that synthesises audio (text to speech, tones) encodes Opus itself and pushes packets. A push returns how many milliseconds are buffered; past 3 s it fails with `BUSY`, so push again on the next [timer](/docs/guide/bots/storage-timers-http/). ## Queue and state Playing replaces the current track; enqueueing adds to the queue (≤ 100 tracks). The state (`bot.voice.state()` in TypeScript, `Voice::state()` in Rust) answers the channel, the player's status (idle, playing, paused, or auto-paused while nobody can hear), the current title and the queued titles. ## Events **TypeScript:** ```ts bot.on('trackStart', (title) => bot.log.info(`now playing ${title ?? 'a track'}`)); bot.on('trackEnd', (title) => bot.log.info(`finished ${title ?? 'a track'}`)); bot.on('trackError', (text) => bot.log.warn(text)); bot.on('voiceEnd', (reason) => bot.log.info('left voice', reason)); ``` `voiceEvent` sees every one; also `voiceMemberJoin` and `voiceMemberLeave`. Every TypeScript bot's entry exports `onVoiceEvent` for this. **Rust:** Implement `Bot::on_voice_event`; the event is one of `TrackStart(title)`, `TrackEnd(title)`, `TrackError(text)`, `MemberJoined(id)`, `MemberLeft(id)` or `Ended(reason)`. | Event | When | |---|---| | track start / track end | a track starts; it played out, was skipped, stopped, or failed | | track error | a track could not be fetched or read (the text names no URL) | | member joined / member left | someone joined or left the bot's channel | | ended | the bot's stay ended: it left, was moved or disconnected by a moderator, or the host or relay went away | ## How it works The host runs a voice participant for the bot, the same code a member's app runs: it publishes the bot's post-quantum key package (signed with the bot member's key), shares a fresh media key with each listener on every join and leave, and sends each Opus packet end-to-end encrypted through WebRTC and the host's relay. Listeners' apps need nothing new: to them the bot is a member speaking. Incoming audio is never decrypted: a bot joins deafened. ## Not yet - **Volume** and formats other than Opus: both need an Opus encoder in the host. - **Listening** (speech recognition, recording): a bot joins deafened. --- url: https://zaunchat.github.io/docs/guide/bots/storage-timers-http/ --- # Storage, timers and HTTP > A bot's private key-value storage, timers, and HTTPS requests to granted hosts. These are host services. Each needs a capability in the [manifest](/docs/guide/bots/manifest-and-grants/) that the owner granted; without it the call fails with `NOT_GRANTED`. ## Storage (`storage_bytes`) A private key-value store per bot, kept on the host in its own database (never the community's) and limited to the granted bytes. **TypeScript:** ```ts bot.storage.setJSON('counter', 42); const n = bot.storage.getJSON('counter'); // number | null const keys = bot.storage.keys('user:', { limit: 100 }); bot.storage.delete('counter'); ``` **Rust:** ```rust use zaun_bot::storage; storage::set("counter", &42u32.to_be_bytes())?; let bytes = storage::get("counter")?; // Option> let keys = storage::list_keys("user:", None, 100)?; storage::delete("counter")?; ``` `QUOTA_EXCEEDED` means the grant is used up. Data survives restarts and updates, moves with the community's export, and is deleted when the bot is removed. ## Timers (`timers`) **TypeScript:** ```ts const id = bot.timers.after(60_000, 'reminder:42'); // once, in 60 s const tick = bot.timers.every(3_600_000, 'hourly'); // repeating, at least every second bot.timers.cancel(id); bot.on('timer', ({ id, tag }) => bot.log.info('timer', id, tag)); ``` `setTimeout` and `setInterval` never fire in a bot: nothing runs between calls. Use these timers. **Rust:** ```rust use zaun_bot::timers; let id = timers::after(60_000, "reminder:42")?; // once, in 60 s let tick = timers::every(3_600_000, "hourly")?; // repeating, at least every second timers::cancel(id); ``` `Bot::on_timer(id, tag)` runs when one fires. Timers don't survive a restart: store what matters and arm timers again when the bot starts (in `init`/`ready` in TypeScript, in `commands()` in Rust). ## HTTP (`network`) **TypeScript:** ```ts const res = bot.http.fetch('https://api.open-meteo.com/v1/forecast?latitude=30&longitude=31', { timeoutMs: 5_000 }); const forecast = res.json<{ current?: unknown }>(); // HttpError (kind 'not-granted', …) when refused ``` There is no global `fetch` in a bot; this is the only way out. **Rust:** ```rust use zaun_bot::http::{fetch, Request}; let res = fetch(&Request { method: "GET".into(), url: "https://api.open-meteo.com/v1/forecast?latitude=30&longitude=31".into(), headers: vec![], body: None, timeout_ms: Some(5_000), })?; ``` - Only `https://` URLs, to hosts in both the bot's grant and the operator's ceiling. - The host resolves the name and **refuses loopback, private, link-local and reserved addresses**, so a bot can't reach the host's own network. - Requests leave from the host: **the remote server learns the host's IP address**, never a member's. Owners see the list of hosts on the bot card before granting it. - Responses are limited in size (4 MiB) and time. - Bots have no sockets: this is the only way out. > **Note: State can vanish** > > A bot instance may restart at any time (an update, a crash, a host restart). Keep anything that must > survive in storage, not in variables or struct fields. --- url: https://zaunchat.github.io/docs/guide/bots/manifest-and-grants/ --- # Manifest, grants and the bot card > What a bot asks for in zaun-bot.toml, how grants are decided, and what every member can see. ## The manifest `zbot pack` turns `zaun-bot.toml` into the manifest inside the package. Unknown keys are refused, so a typo can't silently drop a request. The manifest is the same whether the bot is written in TypeScript or Rust. ```toml title="zaun-bot.toml" app_id = "org.example.weather" # lowercase reverse-DNS; one install per community version = "1.2.0" # updates must increase it name = "Weather" # the bot member's display name, 1-32 description = "Forecasts on demand." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"] events = ["messages"] # event groups or types to receive (default: only interactions) update_url = "https://example.org/weather/" # optional [capabilities] message_content = false # read every message (privileged; shown to all members) members = false # list members presence = false # receive other members' status and activity dms = false # direct messages with members voice = false # join voice channels and play audio timers = true attachments = false # upload files storage_bytes = 1048576 # private storage (≤ 1 GiB) network = ["api.open-meteo.com"] # HTTPS hosts; "*.example.org" allowed as a leading label [limits] # requests; the host may lower them memory_bytes = 33554432 cpu_ms = 200 ``` Answering an interaction doesn't need `SEND_MESSAGES`; posting on its own does. Ask for the least you need: owners see the request in plain words, and a request for `ADMINISTRATOR` or `message_content` is a good reason to refuse a bot. ## How grants are decided What a bot may do is the **intersection** of what its manifest asks for, what the installer chose to grant, and the operator's ceiling (`[bots]` in the host's configuration). Permission bits are granted through a **managed role** that only the bot holds; its bits change only by a new grant. | Capability | Meaning | |---|---| | `message_content` | receive the text of messages that don't mention it (privileged) | | `members` | list and fetch members beyond those it sees in events | | `presence` | receive other members' status and activity (`presenceUpdate`); setting the bot's [own presence](/docs/guide/bots/status-and-presence/) needs nothing | | `dms` | open [direct messages](/docs/guide/bots/direct-messages/) with members (the operator may forbid it host-wide: `[bots] allow_dms`) | | `voice` | join voice channels and [play audio](/docs/guide/bots/voice-and-music/) (`[bots] allow_voice`); `CONNECT` and `SPEAK` still apply per channel | | `timers` | schedule timers | | `attachments` | upload files for its messages | | `storage_bytes` | the size of its private key-value store | | `network` | the internet hosts it may contact over HTTPS | Without `message_content`, the host blanks the content, embeds and attachments of messages delivered to the bot, except messages that mention it, reply to it, that it wrote, or that are in a direct message with it. Interactions always arrive whole. `events` takes the groups `messages`, `reactions`, `members` (needs `members`), `channels`, `roles`, `typing`, `presence` (needs `presence`), `community`, `commands` and `dms` (needs `dms`), exact event types, or `*`. Unknown names are refused at install. See [Events](/docs/guide/bots/events/). ## The bot card Every member can open any bot's **card**: name, publisher, version, signed or not, state, its permissions, whether it can read message content, the hosts it may contact, its storage and its events. Every install, update, grant change, disable and removal is announced to every member and written to the audit log. ## Lifecycle | State | Meaning | |---|---| | `enabled` | running | | `disabled` | stopped by the owner; its commands are hidden | | `pending_approval` | an update asks for more than the current grants; the old version keeps running | | `crashed` | crashed 5 times in 10 minutes; off until the owner enables it again | --- url: https://zaunchat.github.io/docs/guide/bots/packaging-and-updates/ --- # Packaging, signing and updates > The .zbot package format, publisher signatures, and how hosts accept updates. ## The `.zbot` package `zbot pack` writes one file: ``` "ZBOT" ‖ 0x01 ‖ header ‖ signature ‖ manifest JSON ‖ component ``` Each variable part is length-prefixed (`u32`, big-endian). The **header** names the package and binds everything else to it: | # | Field | Content | |---|---|---| | 1 | format | `0x01` | | 2 | package_format | `zaun-bot/v1` | | 3 | app_id | from the manifest | | 4 | version | from the manifest | | 5 | publisher_key | the publisher's composite ML-DSA-65 + Ed25519 public key (1 985 bytes) | | 6 | world | `zaun:bot/bot@0.1.0` | | 7 | manifest_sha3 | SHA3-256 of the manifest | | 8 | component_sha3 | SHA3-256 of the WebAssembly component | | 9 | created_at | milliseconds since the epoch | The signature (3 374 bytes) is the publisher key's composite signature over the header. A host verifies it and both hashes before reading the manifest or compiling anything. Limits: header ≤ 4 KiB, manifest ≤ 64 KiB, component ≤ 64 MiB (a TypeScript bot is about 24 MB, a Rust one a few hundred KB). ## Signing Publisher keys use the same post-quantum composite scheme as every other Zaun key, so a package signature stays trustworthy against a future quantum attacker. > **Caution: Planned** > > `zbot keygen` and `zbot sign` are not built yet. Today, `zbot pack --unsigned` writes a development > package with a zero signature and a zero publisher key. Hosts load it only with > `allow_unsigned = true`, and its bot card says "unsigned". ## Updates - The host **pins the publisher key** at install. An update must be signed by the same key and carry a higher version; anything else is refused. - An update that asks for nothing beyond the current grants replaces the running version. - One that asks for more waits as **pending** until the owner grants the new request; the old version keeps running. The previous version is kept for rollback. Keep your publisher key offline and backed up: losing it means communities must reinstall a bot signed with a new key. --- url: https://zaunchat.github.io/docs/guide/bots/installing/ --- # Installing bots on a host > Install, review, grant, update, disable and remove bots with zaun-host bot, or from a client as the owner. Only whoever controls the host installs, updates, grants, enables, disables or removes a bot: - the **operator**, with `zaun-host bot …` on the host's machine; - the **community owner**, from their app (when the host allows `allow_remote_install`). No permission bit delegates this, not even `ADMINISTRATOR`. ## From the command line These commands talk to the running host through its local control socket (`/control.sock`, readable only by the host's user). ```sh zaun-host bot install --community weather-1.2.0.zbot ``` `install` prints what the bot asks for in plain words (each permission, "can read every message", each internet host, storage) and asks you to confirm, unless you pass `--yes`. To grant less than it asks for: ```sh zaun-host bot install --community --grant VIEW_CHANNEL,SEND_MESSAGES,timers,storage:1 weather.zbot ``` Capabilities by name: `message_content`, `members`, `presence`, `timers`, `attachments`, `storage:`, `network:`. Then: ```sh zaun-host bot list --community zaun-host bot info --community zaun-host bot update --community weather-1.3.0.zbot zaun-host bot grant --community --capabilities timers,storage:4 zaun-host bot disable --community zaun-host bot enable --community zaun-host bot remove --community ``` ## The operator's ceiling The host's `[bots]` configuration caps every grant on that host. For example, with `allow_network = false` no owner can give any bot internet access. See [Configuring a host](/docs/guide/host/configuration/#bots). ## What members see Installing announces the bot to every member, gives it a BOT badge, and makes its card readable by anyone. Updates that ask for more stay pending until the owner approves them. --- url: https://zaunchat.github.io/docs/guide/bots/external-bots/ --- # External bots with zaun-client > A bot that runs outside the host and joins like a member, using zaun-client in Rust or JavaScript. Not every bot has to run inside the host. A program using [`zaun-client`](/docs/guide/client/installation/) joins a community with an invite like any member and acts through the same API as an app: read messages, reply, react, moderate, play audio in voice. Compared with a hosted bot: | | Hosted bot (zaun-bot) | External bot (zaun-client) | |---|---|---| | Runs | inside the host, as WebAssembly | anywhere: your machine, a server | | Latency | in-process | every exchange crosses SimpleX | | Sandbox | enforced by the host | none: it's your program | | Installs | by the owner or operator | joins with an invite | | Reads messages | only with `message_content` | whatever its roles let it see | | Slash commands, components, modals | yes | yes: `setCommands`, the `interactionCreate` event and its `Interaction` | | Direct messages | with `dms` | yes: `member.send(..)` | | Voice | yes (`voice`, played by the host) | yes (`AudioPlayer`) | ## A text-command bot **JavaScript:** ```js const client = await Client.start({ name: "Ping bot", key: process.env.ZAUN_KEY }); client.on("messageCreate", async (message) => { if (!message.mine && message.content === "!ping") await message.reply("pong"); }); ``` **Rust:** ```rust use zaun_client::{Client, Event}; let client = Client::builder("./bot").name("Ping bot").key(std::env::var("ZAUN_BOT_KEY")?).start()?; for event in client.events() { if let Event::MessageCreate(message) = event { if !message.is_mine() && message.content() == "!ping" { message.reply("pong")?; } } } ``` The owner marks such a member as a bot (`registerBot`, or Settings → Bots in the app), so it gets a BOT badge and a card like a hosted one. Once marked, it can register slash commands and answer interactions. ## Slash commands, buttons and modals **JavaScript:** ```js client.on("appsReady", async (community) => { await community.setCommands([ new CommandBuilder().setName("ping").setDescription("Check the bot is alive"), ]); }); client.on("interactionCreate", async (interaction) => { if (interaction.commandName === "ping") { await interaction.reply({ content: "pong", components: [new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId("again").setLabel("Ping again").setStyle(ButtonStyle.Primary))], }); } else if (interaction.customId === "again") { await interaction.update({ content: "pong, again" }); } }); ``` **Rust:** ```rust use zaun_client::protocol::command::object::InteractionType; use zaun_client::ui::{ActionRow, Button, CommandBuilder}; use zaun_client::{Event, Response}; for event in client.events() { match event { Event::AppsReady(community) => { community.set_commands(vec![CommandBuilder::slash("ping", "Check the bot is alive").build()])?; } Event::InteractionCreate(i) => match (i.kind(), i.command_name(), i.custom_id()) { (InteractionType::ApplicationCommand, Some("ping"), _) => { i.reply("pong")?; } (InteractionType::MessageComponent, _, Some("again")) => { /* i.respond(Response::update(..)) */ } _ => {} }, _ => {} } } ``` The complete Rust program is `zaun/examples/slash_bot.rs` in zaun-client; a JavaScript bot that greets members by DM is `zaun/examples/dm_bot.mjs`. ## Resulting code The complete program is in [Examples → Ping bot with zaun-client](/docs/examples/client-ping-bot/). --- url: https://zaunchat.github.io/docs/guide/bots/porting-a-bot/ --- # Porting an existing bot > Moving a bot from another chat platform's interactions API to Zaun; what maps directly and what differs. Zaun's interaction model uses the same shapes most chat platforms' bot APIs have converged on: application commands with typed options, components, modals, deferred responses and follow-ups. If you have written an interactions-based bot before, the concepts carry over. What changes is where the bot runs. ## What maps directly | Concept | In Zaun | |---|---| | Registering commands | TypeScript: `bot.command(builder, handler)`, or `setCommands`; Rust: return them from `Bot::commands`, or call `commands::set` | | Command, user and message commands | TypeScript: `SlashCommandBuilder`, `ContextMenuCommandBuilder`; Rust: `SlashCommand::new`, `::user`, `::message` | | Option types 1–11, choices, bounds, autocomplete | the same numbers and rules | | Interaction types 2–5, callback types 4–9 | the same numbers | | Components (types 1–14, 17–19, 21–23), button styles 1–5 | the same numbers | | Message flags: suppress embeds 4, ephemeral 64, silent 4096, components V2 32768 | the same values | | Limits: 25 options, 5 buttons per row, 40 V2 components, 3 s, 15 min | the same | ## Coming from a JavaScript bot library `@zaun/bot` deliberately uses the names most JavaScript bot libraries share, so most code moves over by changing imports and the entry point: | You may know | In `@zaun/bot` | |---|---| | a client object you log in with a token | `const bot = new Bot()`; no token, no login: the host runs the bot | | registering commands through a REST call | `bot.command(new SlashCommandBuilder()…, execute)`; registered at every start | | an `interactionCreate` listener with `if (interaction.isChatInputCommand())` | the same listener and type guards, or per-command handlers in `bot.command` | | `interaction.reply`, `deferReply`, `editReply`, `followUp`, `showModal`, `update`, `deferUpdate` | the same methods | | `interaction.options.getString(..)`, `getSubcommand()`, `getFocused()` | the same | | `interaction.fields.getTextInputValue(..)` | the same | | `SlashCommandBuilder`, `EmbedBuilder`, `ButtonBuilder`, `ActionRowBuilder`, `StringSelectMenuBuilder`, `ModalBuilder`, `TextInputBuilder`, `ContainerBuilder`, … | the same names | | `messageCreate`, `messageReactionAdd` and member-join events | `bot.on('messageCreate' \| 'messageReactionAdd' \| 'memberAdd', (payload, ctx) => …)`; ask for them in the manifest's `events` | | `user.send(..)` for a direct message | `ctx.dm(memberId, ..)` or `bot.messages.dm(memberId, ..)` (capability `dms`) | | setting the bot's presence or activity ("Listening to …") | `bot.presence.set('online', Activity.listening(..))`; custom status text with `bot.presence.setStatusText(..)` ([Status and presence](/docs/guide/bots/status-and-presence/)) | | a voice library and an audio player | `bot.voice.join`, `play`, `enqueue`, … (capability `voice`; the host plays Opus) | | your own database, `fetch`, `setTimeout` | `bot.storage`, `bot.http.fetch` (granted hosts only), `bot.timers` | | `client.login(..)` at the end of the file | `export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports();` | ## What differs - **There's no hosting to run.** The bot is a `.zbot` package the community's owner installs, and it runs inside their host. - **No tokens.** The bot's own connection is the credential; only that bot can answer its interactions, so there's nothing to leak. - **Events are opt-in.** List the event groups or types you want in the manifest; reading message content is a capability every member can see. - **Ids** are Zaun ids (base64url, 16 bytes), not integers. - **Mentions are explicit.** Messages name their mentions; nothing is parsed from text. - **Pictures are attachments, never URLs**, in embeds and components alike. Link buttons take `https://` only and open after the reader confirms. - **Your own database and HTTP client** become storage (granted bytes) and HTTP fetch (granted hosts only); `setTimeout`/cron become timers. In TypeScript, `setTimeout` never fires. - **One handler at a time** per bot instance, and state in fields may vanish on restart. - **Not available:** premium buttons, entitlements, pictures on activities, polls, stickers, custom emoji in components (Unicode only), webhooks. --- url: https://zaunchat.github.io/docs/examples/ --- # Examples > Complete, working bots and programs with explanations, in TypeScript and Rust. ## Hosted bots (zaun-bot: TypeScript and Rust) Every hosted-bot example is shown in TypeScript (`@zaun/bot`) and Rust (`zaun-bot`), doing exactly the same thing. - [Ping](/docs/examples/ping/): One slash command, one reply. - [Poll with buttons](/docs/examples/poll-buttons/): Buttons that update a message in place. - [Feedback form](/docs/examples/feedback-modal/): A modal, an ephemeral thanks, and a follow-up. - [Welcome DM](/docs/examples/welcome-dm/): Member events and direct messages. - [Music in voice](/docs/examples/music/): Voice channels, a queue and control buttons. ## With zaun-client (JavaScript and Rust) - [Ping bot](/docs/examples/client-ping-bot/): An external bot answering text commands. --- url: https://zaunchat.github.io/docs/examples/ping/ --- # Ping (hosted bot) > The smallest hosted bot: /ping answers pong. The smallest bot there is: one slash command, one reply. It asks only for `VIEW_CHANNEL` and `SEND_MESSAGES`, with no message content, no network and no storage. Source in zaun-bot: [`examples/ts/ping`](https://github.com/zaunchat/zaun-bot/tree/main/examples/ts/ping) (TypeScript) and [`examples/rust/ping`](https://github.com/zaunchat/zaun-bot/tree/main/examples/rust/ping) (Rust). ## The code **TypeScript:** ```ts title="src/index.ts" // `/ping` → "pong", in TypeScript. Shows "Listening to /ping" as its activity. const bot = new Bot(); bot.on('init', () => bot.presence.set('online', Activity.listening('/ping'))); bot.command( new SlashCommandBuilder().setName('ping').setDescription('Check that the bot is alive'), (interaction) => { interaction.reply('pong 🏓'); }, ); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** ```rust title="src/lib.rs" //! `/ping` → "pong", with the round trip the bot saw. Shows "Listening to /ping" as its //! activity. use zaun_bot::prelude::*; use zaun_bot::presence; #[derive(Default)] struct Ping; impl Bot for Ping { fn on_start(&mut self, _: &Config) { presence::set(Status::Online, Activity::listening("/ping")); } fn commands(&mut self, _: &Config) -> Vec { vec![SlashCommand::new("ping", "Check that the bot is alive").build()] } fn on_command(&mut self, ctx: Context, command: CommandData) { if command.name == "ping" && let Err(e) = ctx.reply("pong 🏓") { log_info!("reply refused: {}", e.code); } } } export_bot!(Ping); ``` ## The manifest **TypeScript:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.ts-ping" version = "0.1.0" name = "Ping" description = "Answers /ping with pong." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES"] [capabilities] # Nothing beyond interactions: no message content, no network, no storage. ``` **Rust:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.ping" version = "0.1.0" name = "Ping" description = "Answers /ping with pong." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES"] [capabilities] # Nothing beyond interactions: no message content, no network, no storage. ``` ## How it works - The command is registered every time the bot starts (`bot.command(..)` in TypeScript, `Bot::commands` in Rust). - When the instance starts, it sets its activity: members see "Listening to /ping" next to it ([Status and presence](/docs/guide/bots/status-and-presence/)). Setting its own status needs no capability. - The handler answers with a reply. A refused reply (for example, the bot lost `SEND_MESSAGES` in that channel) is logged (TypeScript: the `error` event and the host log; Rust: `log_info!`). ## Run it **TypeScript:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/ts/ping npm install zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` **Rust:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/rust/ping zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` --- url: https://zaunchat.github.io/docs/examples/poll-buttons/ --- # Poll with buttons > A yes/no poll whose buttons update the vote counts in place. `/poll ` posts a yes/no poll as an embed with two buttons. Clicking a button updates the counts on the same message. Source in zaun-bot: [`examples/ts/poll-buttons`](https://github.com/zaunchat/zaun-bot/tree/main/examples/ts/poll-buttons) (TypeScript) and [`examples/rust/poll-buttons`](https://github.com/zaunchat/zaun-bot/tree/main/examples/rust/poll-buttons) (Rust). ## The code **TypeScript:** ```ts title="src/index.ts" // `/poll question` posts a yes/no poll; buttons update the counts in place. // Votes live in the instance (lost on restart); a real bot would use `bot.storage`. const bot = new Bot(); /** Voters per question. */ const votes = new Map; no: Set }>(); function render(question: string) { const v = votes.get(question) ?? { yes: new Set(), no: new Set() }; return { embeds: [new EmbedBuilder().setTitle(question).addFields( { name: 'Yes', value: String(v.yes.size), inline: true }, { name: 'No', value: String(v.no.size), inline: true }, )], components: [new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId(`yes:${question}`).setLabel('Yes').setEmoji('👍').setStyle(ButtonStyle.Success), new ButtonBuilder().setCustomId(`no:${question}`).setLabel('No').setEmoji('👎').setStyle(ButtonStyle.Danger), )], }; } bot.command( new SlashCommandBuilder().setName('poll').setDescription('Start a yes/no poll') .addStringOption((o) => o.setName('question').setDescription('What to ask').setRequired(true).setMinLength(1).setMaxLength(80)), (interaction) => { if (!interaction.isChatInputCommand()) return; const question = interaction.options.getString('question', true); votes.set(question, { yes: new Set(), no: new Set() }); interaction.reply(render(question)); }, ); bot.component((id) => id.startsWith('yes:') || id.startsWith('no:'), (interaction) => { const [choice, ...rest] = interaction.customId.split(':'); const question = rest.join(':'); const v = votes.get(question) ?? { yes: new Set(), no: new Set() }; v.yes.delete(interaction.userId); v.no.delete(interaction.userId); (choice === 'yes' ? v.yes : v.no).add(interaction.userId); votes.set(question, v); interaction.update(render(question)); }); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** ```rust title="src/lib.rs" //! `/poll question` posts a yes/no poll; buttons update the counts in place. //! //! Votes live in the instance (lost on restart); a real bot would use `zaun_bot::storage`. use std::collections::HashMap; use zaun_bot::prelude::*; use zaun_bot::types::OptionKind; #[derive(Default)] struct Poll { /// Keyed by the poll's question: `(yes, no)` voters. votes: HashMap, Vec)>, } fn render(question: &str, yes: usize, no: usize) -> Reply { Reply::new() .embed( EmbedBuilder::new() .title(question) .field("Yes", yes.to_string(), true) .field("No", no.to_string(), true), ) .row(ActionRow::buttons([ Button::success(format!("yes:{question}"), "Yes").emoji("👍"), Button::danger(format!("no:{question}"), "No").emoji("👎"), ])) } impl Bot for Poll { fn commands(&mut self, _: &Config) -> Vec { let question = CommandOptionBuilder::new(OptionKind::String, "question", "What to ask") .required() .length(1, 80); vec![ SlashCommand::new("poll", "Start a yes/no poll") .option(question) .build(), ] } fn on_command(&mut self, ctx: Context, command: CommandData) { let Some(question) = command.str("question") else { return; }; self.votes.entry(question.to_owned()).or_default(); let _ = ctx.reply(render(question, 0, 0)); } fn on_component(&mut self, ctx: Context, component: ComponentData) { let Some((choice, question)) = component.custom_id.split_once(':') else { return; }; let (yes, no) = self.votes.entry(question.to_owned()).or_default(); let voter = ctx.member.member_id.clone(); yes.retain(|m| *m != voter); no.retain(|m| *m != voter); if choice == "yes" { yes.push(voter) } else { no.push(voter) } let (y, n) = (yes.len(), no.len()); let _ = ctx.update_message(render(question, y, n)); } } export_bot!(Poll); ``` ## The manifest **TypeScript:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.ts-poll" version = "0.1.0" name = "Poll" description = "Yes/no polls with buttons." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"] [capabilities] ``` **Rust:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.poll" version = "0.1.0" name = "Poll" description = "Yes/no polls with buttons." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"] [capabilities] ``` ## How it works - The poll is an embed plus one action row of a success and a danger button. - Each button's custom id carries the vote and the question (`yes:`), so the bot knows which poll a click belongs to. - The component handler records the voter (moving their vote if they change their mind) and answers with an update of the clicked message (`interaction.update(..)`, `ctx.update_message(..)`). - Votes live in the instance and are lost on restart. A real bot would keep them in [storage](/docs/guide/bots/storage-timers-http/). ## Run it **TypeScript:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/ts/poll-buttons npm install zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` **Rust:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/rust/poll-buttons zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` --- url: https://zaunchat.github.io/docs/examples/feedback-modal/ --- # Feedback form (modal) > A /feedback command that opens a form, thanks the member privately, and posts the result. `/feedback` opens a form. When the member submits it, the bot thanks them privately and posts the feedback to the channel. Source in zaun-bot: [`examples/ts/feedback-modal`](https://github.com/zaunchat/zaun-bot/tree/main/examples/ts/feedback-modal) (TypeScript) and [`examples/rust/feedback-modal`](https://github.com/zaunchat/zaun-bot/tree/main/examples/rust/feedback-modal) (Rust). ## The code **TypeScript:** ```ts title="src/index.ts" // `/feedback` opens a form; the answer is thanked privately and posted to the channel. const bot = new Bot(); bot.command(new SlashCommandBuilder().setName('feedback').setDescription('Send feedback to the moderators'), (interaction) => { interaction.showModal(new ModalBuilder().setCustomId('feedback').setTitle('Feedback') .addTextInput('Subject', new TextInputBuilder().setCustomId('subject').setStyle(TextInputStyle.Short).setMinLength(1).setMaxLength(80)) .addTextInput('What should we know?', new TextInputBuilder().setCustomId('body').setStyle(TextInputStyle.Paragraph) .setMinLength(10).setMaxLength(2000).setPlaceholder('Be specific'))); }); bot.modal('feedback', (interaction) => { const subject = interaction.fields.getTextInputValue('subject') || '(none)'; const body = interaction.fields.getTextInputValue('body'); interaction.reply({ content: 'Thanks — your feedback was posted.', ephemeral: true }); interaction.followUp(new EmbedBuilder().setTitle(`Feedback: ${subject}`).setDescription(body) .setFooter({ text: `from ${interaction.member.displayName}` })); }); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** ```rust title="src/lib.rs" //! `/feedback` opens a form; the answer is thanked privately and posted to the channel. use zaun_bot::prelude::*; #[derive(Default)] struct Feedback; impl Bot for Feedback { fn commands(&mut self, _: &Config) -> Vec { vec![SlashCommand::new("feedback", "Send feedback to the moderators").build()] } fn on_command(&mut self, ctx: Context, _: CommandData) { let modal = Modal::new("feedback", "Feedback") .input("Subject", TextInput::short("subject").length(1, 80)) .input( "What should we know?", TextInput::paragraph("body") .length(10, 2000) .placeholder("Be specific"), ); let _ = ctx.show_modal(modal); } fn on_modal(&mut self, ctx: Context, modal: ModalData) { let subject = modal.text("subject").unwrap_or("(none)"); let body = modal.text("body").unwrap_or_default(); let _ = ctx.reply_ephemeral("Thanks — your feedback was posted."); let card = EmbedBuilder::new() .title(format!("Feedback: {subject}")) .description(body) .footer(format!("from {}", ctx.member.display_name)); let _ = ctx.followup(card); } } export_bot!(Feedback); ``` ## The manifest **TypeScript:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.ts-feedback" version = "0.1.0" name = "Feedback" description = "A /feedback form using a modal." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"] [capabilities] ``` **Rust:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.feedback" version = "0.1.0" name = "Feedback" description = "A /feedback form using a modal." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"] [capabilities] ``` ## How it works - The command answers by showing a modal, which counts as the first response. - The host checks the submission against the modal (lengths, required inputs) before the modal handler runs. - The modal handler answers with an ephemeral reply only the member sees, then a public follow-up embed. ## Run it **TypeScript:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/ts/feedback-modal npm install zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` **Rust:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/rust/feedback-modal zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` --- url: https://zaunchat.github.io/docs/examples/welcome-dm/ --- # Welcome DM > Greets new members by direct message, answers what they write back, and offers /dm-me. When someone joins, the bot sends them a welcome in a [direct message](/docs/guide/bots/direct-messages/) and answers what they write there. It needs the `members` capability (to hear joins) and `dms`. Source in zaun-bot: [`examples/ts/welcome-dm`](https://github.com/zaunchat/zaun-bot/tree/main/examples/ts/welcome-dm) (TypeScript) and [`examples/rust/welcome-dm`](https://github.com/zaunchat/zaun-bot/tree/main/examples/rust/welcome-dm) (Rust). ## The code **TypeScript:** ```ts title="src/index.ts" // Welcomes every new member with a direct message, answers what they write back, and offers // `/dm-me` to open the conversation on demand. const bot = new Bot(); let greeted = 0; bot.on('ready', (me) => bot.log.info(`welcome bot ${me.memberId} is up`)); bot.on('memberAdd', (member, ctx) => { if (member.botId) return; try { ctx.dm(member.memberId, `Welcome, ${member.displayName}! Reply here if you have a question, or type \`rules\` to see them.`); greeted += 1; } catch (e) { // The member turned DMs from bots off: respect it. bot.log.info(`no welcome DM for ${member.memberId}: ${e instanceof ZaunError ? e.code : e}`); } }); bot.on('messageCreate', (message, ctx) => { if (!message.isDM || ctx.isMe(message.authorId)) return; const answer = message.content.trim().toLowerCase() === 'rules' ? '1. Be kind. 2. No spam. 3. Have fun.' : 'Thanks! A moderator will read this soon.'; ctx.reply(message, answer); }); bot.command(new SlashCommandBuilder().setName('dm-me').setDescription('Get a direct message from the welcome bot'), (i) => { try { bot.messages.dm(i.member.memberId, 'Hi! What can I help you with?'); i.reply({ content: 'Check your direct messages.', ephemeral: true }); } catch { i.reply({ content: "I can't message you: you have direct messages from bots turned off.", ephemeral: true }); } }); bot.command(new SlashCommandBuilder().setName('greeted').setDescription('How many members I welcomed'), (i) => { i.reply({ content: `I welcomed ${greeted} member(s) since I started.`, ephemeral: true }); }); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** ```rust title="src/lib.rs" //! Welcomes every new member with a direct message, answers what they write back, and offers //! `/dm-me` to open the conversation on demand. use zaun_bot::prelude::*; #[derive(Default)] struct Welcome { /// How many members this instance greeted. greeted: u32, } impl Bot for Welcome { fn commands(&mut self, _: &Config) -> Vec { vec![SlashCommand::new("dm-me", "Get a direct message from the welcome bot").build()] } fn on_ready(&mut self, _: EventContext, me: Ready) { log_info!("welcome bot {} is up", me.member_id); } fn on_member_join(&mut self, ctx: EventContext, member: Member) { if member.bot_id.is_some() { return; } let text = format!( "Welcome, {}! Reply here if you have a question, or type `rules` to see them.", member.display_name ); match ctx.dm(&member.member_id, text) { Ok(_) => self.greeted += 1, // The member turned DMs from bots off: respect it. Err(e) => log_info!("no welcome DM for {}: {}", member.member_id, e.code), } } fn on_message_create(&mut self, ctx: EventContext, message: Message, is_dm: bool) { if !is_dm || ctx.is_me(&message.author_id) { return; } let answer = if message.content.trim().eq_ignore_ascii_case("rules") { "1. Be kind. 2. No spam. 3. Have fun." } else { "Thanks! A moderator will read this soon." }; let _ = ctx.reply_to(&message, answer); } fn on_command(&mut self, ctx: Context, command: CommandData) { if command.name != "dm-me" { return; } let member_id = ctx.member.member_id.clone(); let answer = match ctx.dm(&member_id, "Hi! What can I help you with?") { Ok(_) => "Check your direct messages.", Err(_) => "I can't message you: you have direct messages from bots turned off.", }; let _ = ctx.reply_ephemeral(answer); } } export_bot!(Welcome); ``` ## The manifest **TypeScript:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.ts-welcome-dm" version = "0.1.0" name = "Welcome" description = "Greets new members by direct message and answers their replies." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES"] # `members` for member joins (needs the `members` capability), `dms` for the DM's own # events, `messages` for the replies (DMs to a bot always arrive whole). events = ["members", "dms", "messages"] [capabilities] members = true dms = true ``` **Rust:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.welcome-dm" version = "0.1.0" name = "Welcome" description = "Greets new members by direct message and answers their replies." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES"] # `members` for member.joined (needs the `members` capability), `dms` for the DM's own # events, `messages` for the replies (DMs to a bot always arrive whole). events = ["members", "dms", "messages"] [capabilities] members = true dms = true ``` ## How it works - `events` asks for `members`, `dms` and `messages`; DMs to a bot always arrive whole, so it needs no `message_content`. - The member-join handler opens the DM and sends the welcome in one call (`ctx.dm(..)`). A member who turned DMs from bots off makes the call fail with `dms_closed`; the bot just logs it. - Message events in a DM are marked (`isDM` / `is_dm`), so the bot only answers there, never in public channels, and never itself. ## Run it **TypeScript:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/ts/welcome-dm npm install zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` **Rust:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/rust/welcome-dm zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` --- url: https://zaunchat.github.io/docs/examples/music/ --- # Music in voice > A music bot: /join, /play, /queue, /skip, /pause, /resume, /stop, /leave, and control buttons. A complete [voice](/docs/guide/bots/voice-and-music/) bot. The host joins the voice channel as the bot and plays Ogg Opus files or streams from the hosts in its `network` grant. Source in zaun-bot: [`examples/ts/music`](https://github.com/zaunchat/zaun-bot/tree/main/examples/ts/music) (TypeScript) and [`examples/rust/music`](https://github.com/zaunchat/zaun-bot/tree/main/examples/rust/music) (Rust). ## The code **TypeScript:** ```ts title="src/index.ts" // A music bot: `/join` a voice channel, `/play` an https:// Ogg Opus file or stream, `/queue`, // `/skip`, `/pause`, `/resume`, `/stop`, `/leave`, and buttons on the now-playing message. // // The host fetches and plays the audio in real time; the bot only says what to play. URLs must // be in the bot's `network` grant, and the audio must already be Opus: nothing is transcoded. const bot = new Bot(); const controls = () => new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId('music:pause').setLabel('Pause').setEmoji('⏸️').setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId('music:resume').setLabel('Resume').setEmoji('▶️').setStyle(ButtonStyle.Secondary), new ButtonBuilder().setCustomId('music:skip').setLabel('Skip').setEmoji('⏭️').setStyle(ButtonStyle.Primary), new ButtonBuilder().setCustomId('music:stop').setLabel('Stop').setEmoji('⏹️').setStyle(ButtonStyle.Danger), ); const STATUS = { idle: 'idle', playing: 'playing', paused: 'paused', 'auto-paused': 'waiting for listeners' } as const; function queueText(): string { const s = bot.voice.state(); const lines = [`Now ${STATUS[s.status]}: **${s.current ?? 'nothing'}**`]; s.queued.forEach((t, n) => lines.push(`${n + 1}. ${t ?? 'untitled'}`)); return lines.join('\n'); } /** Runs `f`, answering the invoker privately with its result or the host's refusal. */ function act(i: Interaction, f: () => string): void { if (!i.isRepliable() || !('reply' in i)) return; try { i.reply({ content: f(), ephemeral: true }); } catch (e) { i.reply({ content: `Could not do that: ${e instanceof ZaunError ? e.code : String(e)}`, ephemeral: true }); } } const simple = (name: string, description: string, run: () => string) => bot.command(new SlashCommandBuilder().setName(name).setDescription(description), (i) => act(i, run)); bot.command( new SlashCommandBuilder().setName('join').setDescription('Join a voice channel') .addChannelOption((o) => o.setName('channel').setDescription('A voice channel').setRequired(true)), (i) => { if (!i.isChatInputCommand()) return; const channel = i.options.getChannel('channel', true); try { bot.voice.join(channel?.channelId ?? ''); i.reply({ content: 'Joined. 🎶', components: [controls()] }); } catch (e) { i.reply({ content: `Could not join: ${e instanceof ZaunError ? e.code : String(e)}`, ephemeral: true }); } }, ); bot.command( new SlashCommandBuilder().setName('play').setDescription('Play now, or queue if something is playing') .addStringOption((o) => o.setName('url').setDescription('An https:// Ogg Opus file or stream').setRequired(true).setMinLength(9).setMaxLength(500)) .addStringOption((o) => o.setName('title').setDescription('What to call it').setMinLength(1).setMaxLength(80)), (i) => act(i, () => { if (!i.isChatInputCommand()) return ''; const url = i.options.getString('url', true) ?? ''; const title = i.options.getString('title') ?? url; if (bot.voice.state().status === 'idle') { bot.voice.play({ url, title }); return `Playing **${title}**`; } return `Queued **${title}** (#${bot.voice.enqueue({ url, title })})`; }), ); simple('queue', 'What is playing and what comes next', queueText); simple('skip', 'Skip the current track', () => (bot.voice.skip(), 'Skipped.')); simple('pause', 'Pause', () => (bot.voice.pause(), 'Paused.')); simple('resume', 'Resume', () => (bot.voice.resume(), 'Resumed.')); simple('stop', 'Stop and clear the queue', () => (bot.voice.stop(), 'Stopped.')); simple('leave', 'Leave the voice channel', () => (bot.voice.leave(), 'Bye! 👋')); bot.component('music:', (i) => act(i, () => { switch (i.customId) { case 'music:pause': bot.voice.pause(); return 'Paused.'; case 'music:resume': bot.voice.resume(); return 'Resumed.'; case 'music:skip': bot.voice.skip(); return 'Skipped.'; default: bot.voice.stop(); return 'Stopped.'; } })); // Members see "Listening to " next to the bot while it plays. bot.on('trackStart', (title) => bot.presence.set('online', Activity.listening(title ?? 'music'))); bot.on('trackEnd', () => bot.presence.set('online')); bot.on('trackError', (error) => bot.log.warn(`track failed: ${error}`)); bot.on('voiceEnd', (reason) => { bot.presence.set('online'); bot.log.info(`voice stay ended: ${reason ?? 'left'}`); }); export const { init, onEvent, onInteraction, onAutocomplete, onTimer, onVoiceEvent } = bot.exports(); ``` **Rust:** ```rust title="src/lib.rs" //! A music bot: `/join` a voice channel, `/play` an `https://` Ogg Opus file or stream, //! `/queue`, `/skip`, `/pause`, `/resume`, `/stop`, `/leave`, and buttons on the //! now-playing message. //! //! The host fetches and plays the audio in real time; the bot only says what to play. URLs //! must be in the bot's `network` grant, and the audio must already be Opus (`.opus`, or //! `.ogg` holding Opus): nothing is transcoded. use zaun_bot::prelude::*; use zaun_bot::types::OptionKind; use zaun_bot::voice::{PlayerStatus, VoiceEvent}; #[derive(Default)] struct Music; fn controls() -> ActionRow { ActionRow::buttons([ Button::secondary("music:pause", "Pause").emoji("⏸️"), Button::secondary("music:resume", "Resume").emoji("▶️"), Button::primary("music:skip", "Skip").emoji("⏭️"), Button::danger("music:stop", "Stop").emoji("⏹️"), ]) } /// A short reply only the invoker sees. fn note(ctx: &Context, text: impl Into) { let _ = ctx.reply(Reply::new().content(text).ephemeral()); } fn queue_text() -> String { let state = Voice::state(); let now = state.current.unwrap_or_else(|| "nothing".to_owned()); let status = match state.status { PlayerStatus::Playing => "playing", PlayerStatus::Paused => "paused", PlayerStatus::AutoPaused => "waiting for listeners", PlayerStatus::Idle => "idle", }; let mut text = format!("Now {status}: **{now}**"); for (i, title) in state.queued.iter().enumerate() { let title = title.as_deref().unwrap_or("untitled"); text.push_str(&format!("\n{}. {title}", i + 1)); } text } impl Bot for Music { fn commands(&mut self, _: &Config) -> Vec { let channel = CommandOptionBuilder::new(OptionKind::Channel, "channel", "A voice channel").required(); let url = CommandOptionBuilder::string("url", "An https:// Ogg Opus file or stream") .required() .length(9, 500); let title = CommandOptionBuilder::string("title", "What to call it").length(1, 80); vec![ SlashCommand::new("join", "Join a voice channel") .option(channel) .build(), SlashCommand::new("play", "Play now, or queue if something is playing") .option(url) .option(title) .build(), SlashCommand::new("queue", "What is playing and what comes next").build(), SlashCommand::new("skip", "Skip the current track").build(), SlashCommand::new("pause", "Pause").build(), SlashCommand::new("resume", "Resume").build(), SlashCommand::new("stop", "Stop and clear the queue").build(), SlashCommand::new("leave", "Leave the voice channel").build(), ] } fn on_command(&mut self, ctx: Context, command: CommandData) { match command.name.as_str() { "join" => match command.str("channel").map(Voice::join) { Some(Ok(())) => { let _ = ctx.reply(Reply::new().content("Joined. 🎶").row(controls())); } Some(Err(e)) => note(&ctx, format!("Could not join: {}", e.code)), None => note(&ctx, "Pick a voice channel."), }, "play" => { let (Some(url), title) = (command.str("url"), command.str("title")) else { return; }; let title = title.unwrap_or(url); let idle = Voice::state().status == PlayerStatus::Idle; let done = if idle { Voice::play_url(url, Some(title)).map(|()| format!("Playing **{title}**")) } else { Voice::enqueue_url(url, Some(title)) .map(|n| format!("Queued **{title}** (#{n})")) }; match done { Ok(text) => { let _ = ctx.reply(Reply::new().content(text).row(controls())); } Err(e) if e.code == "CONFLICT" => note(&ctx, "Use /join first."), Err(e) => note(&ctx, format!("Could not play: {}", e.code)), } } "queue" => note(&ctx, queue_text()), "skip" => { Voice::skip(); note(&ctx, "Skipped."); } "pause" => { Voice::pause(); note(&ctx, "Paused."); } "resume" => { Voice::resume(); note(&ctx, "Resumed."); } "stop" => { Voice::stop(); note(&ctx, "Stopped, queue cleared."); } "leave" => { Voice::leave(); note(&ctx, "Bye. 👋"); } _ => {} } } fn on_component(&mut self, ctx: Context, component: ComponentData) { match component.custom_id.as_str() { "music:pause" => Voice::pause(), "music:resume" => Voice::resume(), "music:skip" => Voice::skip(), "music:stop" => Voice::stop(), _ => return, } let _ = ctx.update_message(Reply::new().content(queue_text()).row(controls())); } fn on_voice_event(&mut self, event: VoiceEvent) { match event { // Members see "Listening to " next to the bot while it plays. VoiceEvent::TrackStart(title) => zaun_bot::presence::set( zaun_bot::presence::Status::Online, zaun_bot::presence::Activity::listening(title.unwrap_or_else(|| "music".into())), ), VoiceEvent::TrackEnd(_) => { zaun_bot::presence::set(zaun_bot::presence::Status::Online, None); } VoiceEvent::TrackError(e) => log_info!("track failed: {e}"), VoiceEvent::Ended(why) => { zaun_bot::presence::set(zaun_bot::presence::Status::Online, None); log_info!("left voice: {}", why.unwrap_or_default()); } _ => {} } } } export_bot!(Music); ``` ## The manifest **TypeScript:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.ts-music" version = "0.1.0" name = "Music" description = "Plays Ogg Opus files and streams in voice channels, with a queue and buttons." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "CONNECT", "SPEAK"] [capabilities] # Join voice channels and play audio. voice = true # The hosts the music comes from. The host fetches them, so they learn the host's address. network = ["music.example.org"] ``` **Rust:** ```toml title="zaun-bot.toml" app_id = "org.zaun.examples.music" version = "0.1.0" name = "Music" description = "Plays Ogg Opus files and streams in voice channels, with a queue and buttons." permissions = ["VIEW_CHANNEL", "SEND_MESSAGES", "CONNECT", "SPEAK"] [capabilities] # Join voice channels and play audio. voice = true # The hosts the music comes from. The host fetches them, so they learn the host's address. network = ["music.example.org"] ``` ## How it works - `voice` is a capability the owner grants; `CONNECT` and `SPEAK` apply per channel as for members. - `/join` joins the channel and posts control buttons (pause, resume, skip, stop). - `/play` plays at once when nothing is playing, and queues otherwise; the host fetches each URL through the bot's network grant as it plays. `/queue` shows what is playing and what comes next. - Every command and button answers the invoker privately, with the result or the host's refusal (for example `FORBIDDEN` without `CONNECT`). - While a track plays, members see "Listening to" the track next to the bot; it clears when the track ends or the bot leaves ([Status and presence](/docs/guide/bots/status-and-presence/)). - Track errors and the end of the voice stay are logged. Audio must already be Opus: convert other formats once with `ffmpeg -c:a libopus`. ## Run it **TypeScript:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/ts/music npm install zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` **Rust:** ```sh git clone https://github.com/zaunchat/zaun-bot && cd zaun-bot/examples/rust/music zbot build && zbot pack --unsigned zaun-host bot install --community *.zbot # on a host with allow_unsigned = true ``` --- url: https://zaunchat.github.io/docs/examples/client-ping-bot/ --- # Ping bot with zaun-client > An external bot in Rust and JavaScript that joins with an invite and answers text commands. A bot that joins a community like any member and answers text commands. It runs anywhere, not in the host; see [External bots](/docs/guide/bots/external-bots/) for when to choose this over a hosted bot. Source: [`zaun/examples`](https://github.com/zaunchat/zaun-client/tree/main/zaun/examples) in zaun-client. **JavaScript:** ```js title="ping_bot.mjs" // A ping bot over the JS build: joins with an invitation once, answers `!ping`, and keeps // its state in one sealed file between runs. Build the package first // (scripts/build-zaun-js.sh). // // ZAUN_KEY='store passphrase' ZAUN_INVITE='zaun://join/…' node examples/ping_bot.mjs const file = "ping-bot.snapshot"; const key = process.env.ZAUN_KEY; if (!key) throw new Error("set ZAUN_KEY to the store passphrase"); const snapshot = fs.existsSync(file) ? fs.readFileSync(file) : undefined; // `relays: ["smp://…"]` picks the SimpleX servers; without it the official ones are used. const client = await Client.start({ name: "Ping bot", key, snapshot }); client.on("change", () => fs.writeFileSync(file, client.save())); // keep the store client.on("ready", (community) => console.log(`ready in ${community.name}`)); client.on("messageCreate", async (message) => { if (message.mine) return; if (message.content === "!ping") await message.reply("pong"); if (message.content === "!who") { await message.channel.send(`${message.author.displayName}, you are in ${message.community.name}`); } }); if (client.saved.size === 0 && process.env.ZAUN_INVITE) { await client.join(process.env.ZAUN_INVITE, "Ping bot"); // the link is a secret: never log it } ``` ```sh ZAUN_KEY='store passphrase' ZAUN_INVITE='zaun://join/…' node examples/ping_bot.mjs ``` **Rust:** ```rust title="ping_bot.rs" //! A bot that joins a Zaun community and answers `!ping`, `!members`, `!can` and `!kick`. //! //! ```sh //! ZAUN_BOT_KEY='store passphrase' cargo run -p zaun-client --example ping_bot -- ./bot 'zaun://join/…' //! ``` //! //! The invitation is needed only the first time; later runs reconnect from `./bot`. use zaun_client::protocol::bits::Permissions; use zaun_client::{Client, Event, Message}; fn main() -> Result<(), Box> { let mut args = std::env::args().skip(1); let dir = args.next().ok_or("usage: ping_bot DIR [INVITE_LINK]")?; let key = std::env::var("ZAUN_BOT_KEY").map_err(|_| "set ZAUN_BOT_KEY")?; let client = Client::builder(&dir).name("Ping bot").key(key).start()?; if let Some(link) = args.next() { let community = client.join(&link, "Ping bot")?; println!("joined {community}"); } for event in client.events() { match event { Event::Ready(community) => { println!( "ready in {community} ({} channels)", community.channels().len() ); } Event::MessageCreate(message) if !message.is_mine() => { if let Err(e) = answer(&message) { eprintln!("could not answer: {e}"); } } Event::MemberAdd(member) => { println!("{member} joined {}", member.community()); } Event::CommunityDelete { community, reason } => { println!("removed from {}: {reason:?}", community.id().to_b64()); } _ => {} } } Ok(()) } fn answer(message: &Message) -> zaun_client::Result<()> { let author = message.author(); match message.content().trim() { "!ping" => { message.reply("pong")?; } "!members" => { let members = message.community().fetch_members()?; message .channel() .send(format!("{} members", members.len()))?; } "!can" => { let ok = author.can(Permissions::SEND_MESSAGES, Some(message.channel())); message.reply(format!( "you {} post here", if ok { "can" } else { "cannot" } ))?; } text if text.starts_with("!kick ") => { let name = text.trim_start_matches("!kick ").trim(); if !author.can(Permissions::KICK_MEMBERS, None) { message.reply("you cannot kick")?; } else if let Some(target) = (message.community().members().into_iter()).find(|m| m.display_name() == name) { target.kick(Some("asked to"))?; message.react("👋")?; } } _ => {} } Ok(()) } ``` ```sh ZAUN_BOT_KEY='store passphrase' cargo run -p zaun-client --example ping_bot -- ./bot 'zaun://join/…' ``` ## How it works - The invite is needed only the first time; later runs reconnect from the saved store (`./bot` in Rust, the snapshot file in JavaScript). - `!ping` replies, `!members` fetches the member list, `!can` checks a permission locally, and `!kick` (Rust) kicks by display name if the author may. - It ignores its own messages (`is_mine()` / `message.mine`). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/readme/ --- # @zaun/bot `@zaun/bot`: write Zaun bots in TypeScript. A bot is a WebAssembly component that runs inside the community's own zaun-host, in a sandbox, with only the permissions it was granted. ## Classes - [ActionRowBuilder](/docs/reference/js/zaun-bot/classes/actionrowbuilder/) - [Activity](/docs/reference/js/zaun-bot/classes/activity/) - [AutocompleteInteraction](/docs/reference/js/zaun-bot/classes/autocompleteinteraction/) - [BaseInteraction](/docs/reference/js/zaun-bot/classes/baseinteraction/) - [Bot](/docs/reference/js/zaun-bot/classes/bot/) - [ButtonBuilder](/docs/reference/js/zaun-bot/classes/buttonbuilder/) - [ChannelSelectMenuBuilder](/docs/reference/js/zaun-bot/classes/channelselectmenubuilder/) - [ChatInputCommandInteraction](/docs/reference/js/zaun-bot/classes/chatinputcommandinteraction/) - [CheckboxBuilder](/docs/reference/js/zaun-bot/classes/checkboxbuilder/) - [CheckboxGroupBuilder](/docs/reference/js/zaun-bot/classes/checkboxgroupbuilder/) - [CommandInteractionOptionResolver](/docs/reference/js/zaun-bot/classes/commandinteractionoptionresolver/) - [ContainerBuilder](/docs/reference/js/zaun-bot/classes/containerbuilder/) - [ContextMenuCommandBuilder](/docs/reference/js/zaun-bot/classes/contextmenucommandbuilder/) - [EmbedBuilder](/docs/reference/js/zaun-bot/classes/embedbuilder/) - [EventContext](/docs/reference/js/zaun-bot/classes/eventcontext/) - [FileBuilder](/docs/reference/js/zaun-bot/classes/filebuilder/) - [FileUploadBuilder](/docs/reference/js/zaun-bot/classes/fileuploadbuilder/) - [HttpError](/docs/reference/js/zaun-bot/classes/httperror/) - [LabelBuilder](/docs/reference/js/zaun-bot/classes/labelbuilder/) - [MediaGalleryBuilder](/docs/reference/js/zaun-bot/classes/mediagallerybuilder/) - [Member](/docs/reference/js/zaun-bot/classes/member/) - [MemberRoles](/docs/reference/js/zaun-bot/classes/memberroles/) - [MentionableSelectMenuBuilder](/docs/reference/js/zaun-bot/classes/mentionableselectmenubuilder/) - [Message](/docs/reference/js/zaun-bot/classes/message/) - [MessageComponentInteraction](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) - [MessageContextMenuCommandInteraction](/docs/reference/js/zaun-bot/classes/messagecontextmenucommandinteraction/) - [MessageMentions](/docs/reference/js/zaun-bot/classes/messagementions/) - [ModalBuilder](/docs/reference/js/zaun-bot/classes/modalbuilder/) - [ModalCapableInteraction](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/) - [ModalSubmitFields](/docs/reference/js/zaun-bot/classes/modalsubmitfields/) - [ModalSubmitInteraction](/docs/reference/js/zaun-bot/classes/modalsubmitinteraction/) - [OptionBuilder](/docs/reference/js/zaun-bot/classes/optionbuilder/) - [RadioGroupBuilder](/docs/reference/js/zaun-bot/classes/radiogroupbuilder/) - [RepliableInteraction](/docs/reference/js/zaun-bot/classes/repliableinteraction/) - [RoleSelectMenuBuilder](/docs/reference/js/zaun-bot/classes/roleselectmenubuilder/) - [SectionBuilder](/docs/reference/js/zaun-bot/classes/sectionbuilder/) - [SeparatorBuilder](/docs/reference/js/zaun-bot/classes/separatorbuilder/) - [SlashCommandBuilder](/docs/reference/js/zaun-bot/classes/slashcommandbuilder/) - [SlashCommandSubcommandBuilder](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/) - [SlashCommandSubcommandGroupBuilder](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandgroupbuilder/) - [StringSelectMenuBuilder](/docs/reference/js/zaun-bot/classes/stringselectmenubuilder/) - [StringSelectMenuOptionBuilder](/docs/reference/js/zaun-bot/classes/stringselectmenuoptionbuilder/) - [TextDisplayBuilder](/docs/reference/js/zaun-bot/classes/textdisplaybuilder/) - [TextInputBuilder](/docs/reference/js/zaun-bot/classes/textinputbuilder/) - [ThumbnailBuilder](/docs/reference/js/zaun-bot/classes/thumbnailbuilder/) - [UserContextMenuCommandInteraction](/docs/reference/js/zaun-bot/classes/usercontextmenucommandinteraction/) - [UserSelectMenuBuilder](/docs/reference/js/zaun-bot/classes/userselectmenubuilder/) - [ZaunError](/docs/reference/js/zaun-bot/classes/zaunerror/) - [ZaunValidationError](/docs/reference/js/zaun-bot/classes/zaunvalidationerror/) ## Interfaces - [AudioStreamOptions](/docs/reference/js/zaun-bot/interfaces/audiostreamoptions/) - [AutocompleteChoice](/docs/reference/js/zaun-bot/interfaces/autocompletechoice/) - [BotEvents](/docs/reference/js/zaun-bot/interfaces/botevents/) - [Command](/docs/reference/js/zaun-bot/interfaces/command/) - [CommandLike](/docs/reference/js/zaun-bot/interfaces/commandlike/) - [EmbedData](/docs/reference/js/zaun-bot/interfaces/embeddata/) - [HttpResponse](/docs/reference/js/zaun-bot/interfaces/httpresponse/) - [Me](/docs/reference/js/zaun-bot/interfaces/me/) - [MediaGalleryItem](/docs/reference/js/zaun-bot/interfaces/mediagalleryitem/) - [MessageOptions](/docs/reference/js/zaun-bot/interfaces/messageoptions/) ## Type Aliases - [ApplicationCommandOptionType](/docs/reference/js/zaun-bot/type-aliases/applicationcommandoptiontype/) - [ApplicationCommandType](/docs/reference/js/zaun-bot/type-aliases/applicationcommandtype/) - [AudioFormat](/docs/reference/js/zaun-bot/type-aliases/audioformat/) - [ButtonInteraction](/docs/reference/js/zaun-bot/type-aliases/buttoninteraction/) - [ButtonStyle](/docs/reference/js/zaun-bot/type-aliases/buttonstyle/) - [ChannelSelectMenuInteraction](/docs/reference/js/zaun-bot/type-aliases/channelselectmenuinteraction/) - [ContainerComponent](/docs/reference/js/zaun-bot/type-aliases/containercomponent/) - [EventMessage](/docs/reference/js/zaun-bot/type-aliases/eventmessage/) - [Interaction](/docs/reference/js/zaun-bot/type-aliases/interaction/) - [LabelComponent](/docs/reference/js/zaun-bot/type-aliases/labelcomponent/) - [LoopMode](/docs/reference/js/zaun-bot/type-aliases/loopmode/) - [MentionableSelectMenuInteraction](/docs/reference/js/zaun-bot/type-aliases/mentionableselectmenuinteraction/) - [MessagePayload](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) - [PresenceStatus](/docs/reference/js/zaun-bot/type-aliases/presencestatus/) - [RoleSelectMenuInteraction](/docs/reference/js/zaun-bot/type-aliases/roleselectmenuinteraction/) - [RowComponent](/docs/reference/js/zaun-bot/type-aliases/rowcomponent/) - [SeparatorSpacingSize](/docs/reference/js/zaun-bot/type-aliases/separatorspacingsize/) - [StringSelectMenuInteraction](/docs/reference/js/zaun-bot/type-aliases/stringselectmenuinteraction/) - [TextInputStyle](/docs/reference/js/zaun-bot/type-aliases/textinputstyle/) - [TopLevelComponent](/docs/reference/js/zaun-bot/type-aliases/toplevelcomponent/) - [TrackOptions](/docs/reference/js/zaun-bot/type-aliases/trackoptions/) - [UserSelectMenuInteraction](/docs/reference/js/zaun-bot/type-aliases/userselectmenuinteraction/) - [VoiceState](/docs/reference/js/zaun-bot/type-aliases/voicestate/) ## Variables - [ApplicationCommandOptionType](/docs/reference/js/zaun-bot/variables/applicationcommandoptiontype/) - [ApplicationCommandType](/docs/reference/js/zaun-bot/variables/applicationcommandtype/) - [audio](/docs/reference/js/zaun-bot/variables/audio/) - [ButtonStyle](/docs/reference/js/zaun-bot/variables/buttonstyle/) - [community](/docs/reference/js/zaun-bot/variables/community/) - [ComponentType](/docs/reference/js/zaun-bot/variables/componenttype/) - [dms](/docs/reference/js/zaun-bot/variables/dms/) - [everyoneMention](/docs/reference/js/zaun-bot/variables/everyonemention/) - [http](/docs/reference/js/zaun-bot/variables/http/) - [Limits](/docs/reference/js/zaun-bot/variables/limits/) - [log](/docs/reference/js/zaun-bot/variables/log/) - [memberMention](/docs/reference/js/zaun-bot/variables/membermention/) - [MentionLimits](/docs/reference/js/zaun-bot/variables/mentionlimits/) - [messages](/docs/reference/js/zaun-bot/variables/messages/) - [PermissionFlagsBits](/docs/reference/js/zaun-bot/variables/permissionflagsbits/) - [presence](/docs/reference/js/zaun-bot/variables/presence/) - [SeparatorSpacingSize](/docs/reference/js/zaun-bot/variables/separatorspacingsize/) - [storage](/docs/reference/js/zaun-bot/variables/storage/) - [TextInputStyle](/docs/reference/js/zaun-bot/variables/textinputstyle/) - [timers](/docs/reference/js/zaun-bot/variables/timers/) - [voice](/docs/reference/js/zaun-bot/variables/voice/) ## Functions - [hasPermission](/docs/reference/js/zaun-bot/functions/haspermission/) - [interactionFromWit](/docs/reference/js/zaun-bot/functions/interactionfromwit/) - [isId](/docs/reference/js/zaun-bot/functions/isid/) - [parseMentions](/docs/reference/js/zaun-bot/functions/parsementions/) - [roleMention](/docs/reference/js/zaun-bot/functions/rolemention/) - [setCommands](/docs/reference/js/zaun-bot/functions/setcommands/) - [toBody](/docs/reference/js/zaun-bot/functions/tobody/) - [userMention](/docs/reference/js/zaun-bot/functions/usermention/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/actionrowbuilder/ --- # ActionRowBuilder Defined in: [sdk/js/src/builders/row.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L24) Type 1: up to five buttons, or one select. ## Type Parameters ### T `T` *extends* [`RowComponent`](/docs/reference/js/zaun-bot/type-aliases/rowcomponent/) = [`RowComponent`](/docs/reference/js/zaun-bot/type-aliases/rowcomponent/) ## Constructors ### Constructor > **new ActionRowBuilder**\<`T`\>(`components?`): `ActionRowBuilder`\<`T`\> Defined in: [sdk/js/src/builders/row.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L27) #### Parameters ##### components? `T`[] = `[]` #### Returns `ActionRowBuilder`\<`T`\> ## Properties ### components > `readonly` **components**: `T`[] = `[]` Defined in: [sdk/js/src/builders/row.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L25) ## Methods ### addComponents() > **addComponents**(...`components`): `this` Defined in: [sdk/js/src/builders/row.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L31) #### Parameters ##### components ...`T`[] #### Returns `this` *** ### setComponents() > **setComponents**(...`components`): `this` Defined in: [sdk/js/src/builders/row.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L35) #### Parameters ##### components ...`T`[] #### Returns `this` *** ### toWit() > **toWit**(): `ActionRow` Defined in: [sdk/js/src/builders/row.ts:40](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L40) #### Returns `ActionRow` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/activity/ --- # Activity Defined in: [sdk/js/src/presence.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L24) What the bot is doing. Build one with `Activity.playing(…)`, `Activity.listening(…)`, … ## Properties ### data > `readonly` **data**: `Activity` Defined in: [sdk/js/src/presence.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L25) ## Methods ### setDetails() > **setDetails**(`details`): `Activity` Defined in: [sdk/js/src/presence.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L62) A second line, e.g. the track (≤ 128 characters). #### Parameters ##### details `string` #### Returns `Activity` *** ### setEmoji() > **setEmoji**(`emoji`): `Activity` Defined in: [sdk/js/src/presence.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L77) A Unicode emoji, for `Activity.custom` only. #### Parameters ##### emoji `string` #### Returns `Activity` *** ### setStartedAt() > **setStartedAt**(`ms`): `Activity` Defined in: [sdk/js/src/presence.ts:72](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L72) When it started, ms since the epoch (clients show the elapsed time). #### Parameters ##### ms `number` \| `bigint` #### Returns `Activity` *** ### setState() > **setState**(`state`): `Activity` Defined in: [sdk/js/src/presence.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L67) A third line, e.g. the artist (≤ 128 characters). #### Parameters ##### state `string` #### Returns `Activity` *** ### competing() > `static` **competing**(`name`): `Activity` Defined in: [sdk/js/src/presence.ts:52](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L52) "Competing in {name}". #### Parameters ##### name `string` #### Returns `Activity` *** ### custom() > `static` **custom**(`text`): `Activity` Defined in: [sdk/js/src/presence.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L57) Free text, with an optional emoji (`setEmoji`). #### Parameters ##### text `string` #### Returns `Activity` *** ### listening() > `static` **listening**(`name`): `Activity` Defined in: [sdk/js/src/presence.ts:42](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L42) "Listening to {name}". #### Parameters ##### name `string` #### Returns `Activity` *** ### playing() > `static` **playing**(`name`): `Activity` Defined in: [sdk/js/src/presence.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L32) "Playing {name}". #### Parameters ##### name `string` #### Returns `Activity` *** ### streaming() > `static` **streaming**(`name`, `url`): `Activity` Defined in: [sdk/js/src/presence.ts:37](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L37) "Streaming {name}", with an `https://` link members may open (after confirming). #### Parameters ##### name `string` ##### url `string` #### Returns `Activity` *** ### watching() > `static` **watching**(`name`): `Activity` Defined in: [sdk/js/src/presence.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L47) "Watching {name}". #### Parameters ##### name `string` #### Returns `Activity` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/autocompleteinteraction/ --- # AutocompleteInteraction Defined in: [sdk/js/src/interactions/command.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L76) Typing in an autocomplete option. Call [respond](/docs/reference/js/zaun-bot/classes/autocompleteinteraction/#respond) before the handler returns. ## Extends - [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/) ## Constructors ### Constructor > **new AutocompleteInteraction**(`raw`, `data`): `AutocompleteInteraction` Defined in: [sdk/js/src/interactions/command.ts:84](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L84) #### Parameters ##### raw `Interaction` ##### data `CommandData` #### Returns `AutocompleteInteraction` #### Overrides [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`constructor`](/docs/reference/js/zaun-bot/classes/baseinteraction/#constructor) ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`appPermissions`](/docs/reference/js/zaun-bot/classes/baseinteraction/#apppermissions) *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`botId`](/docs/reference/js/zaun-bot/classes/baseinteraction/#botid) *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`channelId`](/docs/reference/js/zaun-bot/classes/baseinteraction/#channelid) *** ### choices > **choices**: `Choice`[] = `[]` Defined in: [sdk/js/src/interactions/command.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L81) The choices given to [respond](/docs/reference/js/zaun-bot/classes/autocompleteinteraction/#respond); the SDK returns them to the host. *** ### commandId > `readonly` **commandId**: `string` Defined in: [sdk/js/src/interactions/command.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L77) *** ### commandName > `readonly` **commandName**: `string` Defined in: [sdk/js/src/interactions/command.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L78) *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`createdTimestamp`](/docs/reference/js/zaun-bot/classes/baseinteraction/#createdtimestamp) *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`deferred`](/docs/reference/js/zaun-bot/classes/baseinteraction/#deferred) *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`id`](/docs/reference/js/zaun-bot/classes/baseinteraction/#id) *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`locale`](/docs/reference/js/zaun-bot/classes/baseinteraction/#locale) *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`member`](/docs/reference/js/zaun-bot/classes/baseinteraction/#member) *** ### options > `readonly` **options**: [`CommandInteractionOptionResolver`](/docs/reference/js/zaun-bot/classes/commandinteractionoptionresolver/) Defined in: [sdk/js/src/interactions/command.ts:79](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L79) *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`raw`](/docs/reference/js/zaun-bot/classes/baseinteraction/#raw) *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`replied`](/docs/reference/js/zaun-bot/classes/baseinteraction/#replied) ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`userId`](/docs/reference/js/zaun-bot/classes/baseinteraction/#userid) ## Methods ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isAnySelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isanyselectmenu) *** ### isAutocomplete() > **isAutocomplete**(): `this is AutocompleteInteraction` Defined in: [sdk/js/src/interactions/command.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L92) #### Returns `this is AutocompleteInteraction` #### Overrides [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isAutocomplete`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isautocomplete) *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isButton`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isbutton) *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isChannelSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ischannelselectmenu) *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isChatInputCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ischatinputcommand) *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#iscommand) *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isContextMenuCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#iscontextmenucommand) *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isMentionableSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismentionableselectmenu) *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isMessageComponent`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismessagecomponent) *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isMessageContextMenuCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismessagecontextmenucommand) *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isModalSubmit`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismodalsubmit) *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isRepliable`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isrepliable) *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isRoleSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isroleselectmenu) *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isStringSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isstringselectmenu) *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isUserContextMenuCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isusercontextmenucommand) *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isUserSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isuserselectmenu) *** ### respond() > **respond**(`choices`): `void` Defined in: [sdk/js/src/interactions/command.ts:95](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L95) Up to 25 suggestions. #### Parameters ##### choices [`AutocompleteChoice`](/docs/reference/js/zaun-bot/interfaces/autocompletechoice/)[] #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/baseinteraction/ --- # BaseInteraction Defined in: [sdk/js/src/interactions/base.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L11) Everything an interaction has, whatever its type. ## Extended by - [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/) - [`AutocompleteInteraction`](/docs/reference/js/zaun-bot/classes/autocompleteinteraction/) ## Constructors ### Constructor > **new BaseInteraction**(`raw`): `BaseInteraction` Defined in: [sdk/js/src/interactions/base.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L32) #### Parameters ##### raw `Interaction` #### Returns `BaseInteraction` ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` ## Methods ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/bot/ --- # Bot Defined in: [sdk/js/src/bot.ts:45](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L45) One Zaun bot. ## Constructors ### Constructor > **new Bot**(): `Bot` #### Returns `Bot` ## Properties ### audio > `readonly` **audio**: `object` Defined in: [sdk/js/src/bot.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L58) Low-level audio output in the bot's voice channel: write Opus or PCM yourself. #### bufferedMs() > **bufferedMs**(): `number` The audio written and not yet played, in ms (0 without a stream). ##### Returns `number` #### clear() > **clear**(): `void` Drops everything buffered at once; the stream stays open. ##### Returns `void` #### close() > **close**(`drain?`): `void` Closes the stream, after the buffer has played (`drain`, the default) or at once. ##### Parameters ###### drain? `boolean` = `true` ##### Returns `void` #### open() > **open**(`options`): `void` Opens the stream, pausing the player. `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take (PCM without an encoder). ##### Parameters ###### options [`AudioStreamOptions`](/docs/reference/js/zaun-bot/interfaces/audiostreamoptions/) ##### Returns `void` #### writeOpus() > **writeOpus**(`packets`): `number` Opus packets (2.5–120 ms each, ≤ 1000 bytes); returns the ms buffered (`BUSY` past 3 s). ##### Parameters ###### packets `Uint8Array`\<`ArrayBufferLike`\>[] ##### Returns `number` #### writePcm() > **writePcm**(`samples`): `number` Interleaved samples, any count; returns the ms buffered (`BUSY` past 3 s). ##### Parameters ###### samples `Int16Array` ##### Returns `number` *** ### commands > `readonly` **commands**: `Map`\<`string`, [`Command`](/docs/reference/js/zaun-bot/interfaces/command/)\> Defined in: [sdk/js/src/bot.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L64) Commands by name. *** ### community > `readonly` **community**: `object` = `api.community` Defined in: [sdk/js/src/bot.ts:52](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L52) #### addRole > **addRole**: (`memberId`, `roleId`) => `void` ##### Parameters ###### memberId `string` ###### roleId `string` ##### Returns `void` #### getChannel > **getChannel**: (`id`) => `Channel` ##### Parameters ###### id `string` ##### Returns `Channel` #### getMember > **getMember**: (`id`) => [`Member`](/docs/reference/js/zaun-bot/classes/member/) ##### Parameters ###### id `string` ##### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/) #### getRole > **getRole**: (`id`) => `Role` ##### Parameters ###### id `string` ##### Returns `Role` #### kick > **kick**: (`memberId`, `reason?`) => `void` ##### Parameters ###### memberId `string` ###### reason? `string` ##### Returns `void` #### listChannels > **listChannels**: () => `Channel`[] ##### Returns `Channel`[] #### listMembers > **listMembers**: (`options`) => [`Member`](/docs/reference/js/zaun-bot/classes/member/)[] ##### Parameters ###### options? ###### after? `string` ###### limit? `number` ##### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/)[] #### listRoles > **listRoles**: () => `Role`[] ##### Returns `Role`[] #### removeRole > **removeRole**: (`memberId`, `roleId`) => `void` ##### Parameters ###### memberId `string` ###### roleId `string` ##### Returns `void` #### timeout > **timeout**: (`memberId`, `until`, `reason?`) => `void` Times a member out until `until` (ms); `null` clears it. ##### Parameters ###### memberId `string` ###### until `number` ###### reason? `string` ##### Returns `void` *** ### config > **config**: `ReadonlyMap`\<`string`, `string`\> Defined in: [sdk/js/src/bot.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L69) The bot's configuration: the keys its manifest declares in `[config]`, with the owner's values or the defaults. Set at `init`, replaced on every change (`config` event). *** ### dms > `readonly` **dms**: `object` Defined in: [sdk/js/src/bot.ts:54](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L54) Direct messages (capability `dms`). #### close() > **close**(`channelId`): `void` Hides a DM from the bot's list. ##### Parameters ###### channelId `string` ##### Returns `void` #### listOpen() > **listOpen**(): `Channel`[] The DMs the bot has open. ##### Returns `Channel`[] #### open() > **open**(`memberId`): `Channel` The DM with `memberId`, opened when there is none. ##### Parameters ###### memberId `string` ##### Returns `Channel` *** ### http > `readonly` **http**: `object` = `api.http` Defined in: [sdk/js/src/bot.ts:50](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L50) #### fetch() > **fetch**(`url`, `init?`): [`HttpResponse`](/docs/reference/js/zaun-bot/interfaces/httpresponse/) ##### Parameters ###### url `string` ###### init? ###### body? `string` \| `Uint8Array`\<`ArrayBufferLike`\> ###### headers? `Record`\<`string`, `string`\> ###### method? `string` ###### timeoutMs? `number` ##### Returns [`HttpResponse`](/docs/reference/js/zaun-bot/interfaces/httpresponse/) *** ### log > `readonly` **log**: `Record`\<`"trace"` \| `"debug"` \| `"info"` \| `"warn"` \| `"error"`, (...`args`) => `void`\> = `api.log` Defined in: [sdk/js/src/bot.ts:51](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L51) *** ### me > **me**: [`Me`](/docs/reference/js/zaun-bot/interfaces/me/) Defined in: [sdk/js/src/bot.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L62) Who the bot is, once the host's `ready` event arrived. *** ### messages > `readonly` **messages**: `object` = `api.messages` Defined in: [sdk/js/src/bot.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L47) Host APIs (also importable on their own). #### delete() > **delete**(`channelId`, `messageId`): `void` ##### Parameters ###### channelId `string` ###### messageId `string` ##### Returns `void` #### dm() > **dm**(`memberId`, `payload`): `object` A direct message to `memberId` (capability `dms`): opens the DM when needed. Returns the DM's channel id and the message id. ##### Parameters ###### memberId `string` ###### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) ##### Returns `object` ###### channelId > **channelId**: `string` ###### messageId > **messageId**: `string` #### edit() > **edit**(`channelId`, `messageId`, `payload`): `void` Edits one of the bot's messages. ##### Parameters ###### channelId `string` ###### messageId `string` ###### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) ##### Returns `void` #### history() > **history**(`channelId`, `options?`): [`Message`](/docs/reference/js/zaun-bot/classes/message/)[] Up to `limit` (1–100) messages before the sequence `before`. ##### Parameters ###### channelId `string` ###### options? ###### before? `number` ###### limit? `number` ##### Returns [`Message`](/docs/reference/js/zaun-bot/classes/message/)[] #### react() > **react**(`channelId`, `messageId`, `emoji`): `void` ##### Parameters ###### channelId `string` ###### messageId `string` ###### emoji `string` ##### Returns `void` #### send() > **send**(`channelId`, `payload`, `options?`): `string` Posts a message; returns its id. ##### Parameters ###### channelId `string` ###### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) ###### options? ###### replyTo? `string` ##### Returns `string` #### unreact() > **unreact**(`channelId`, `messageId`, `emoji`): `void` ##### Parameters ###### channelId `string` ###### messageId `string` ###### emoji `string` ##### Returns `void` #### upload() > **upload**(`channelId`, `name`, `mime`, `bytes`): `string` Uploads a file for the bot's next message (capability `attachments`); returns its id. ##### Parameters ###### channelId `string` ###### name `string` ###### mime `string` ###### bytes `Uint8Array` ##### Returns `string` *** ### presence > `readonly` **presence**: `object` Defined in: [sdk/js/src/bot.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L60) The bot's status, activity and custom status text. #### clearStatus() > **clearStatus**(): `void` Clears the custom status text and emoji. ##### Returns `void` #### set() > **set**(`status`, `activity?`): `void` Sets the status and activity (none: no activity). ##### Parameters ###### status [`PresenceStatus`](/docs/reference/js/zaun-bot/type-aliases/presencestatus/) ###### activity? [`Activity`](/docs/reference/js/zaun-bot/classes/activity/) ##### Returns `void` #### setStatus() > **setStatus**(`text?`, `emoji?`, `expiresAt?`): `void` Sets the custom status text and emoji, cleared by the host at `expiresAt` (ms) if given. ##### Parameters ###### text? `string` ###### emoji? `string` ###### expiresAt? `number` \| `bigint` ##### Returns `void` #### setStatusText() > **setStatusText**(`text`): `void` Sets the custom status text, kept until changed. ##### Parameters ###### text `string` ##### Returns `void` *** ### storage > `readonly` **storage**: `object` = `api.storage` Defined in: [sdk/js/src/bot.ts:48](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L48) #### delete() > **delete**(`key`): `void` ##### Parameters ###### key `string` ##### Returns `void` #### get() > **get**(`key`): `Uint8Array`\<`ArrayBufferLike`\> ##### Parameters ###### key `string` ##### Returns `Uint8Array`\<`ArrayBufferLike`\> #### getJSON() > **getJSON**\<`T`\>(`key`): `T` A JSON value (bigints are not supported by JSON). ##### Type Parameters ###### T `T` = `unknown` ##### Parameters ###### key `string` ##### Returns `T` #### getString() > **getString**(`key`): `string` ##### Parameters ###### key `string` ##### Returns `string` #### keys() > **keys**(`prefix?`, `options?`): `string`[] Keys starting with `prefix`, in order. ##### Parameters ###### prefix? `string` = `''` ###### options? ###### after? `string` ###### limit? `number` ##### Returns `string`[] #### set() > **set**(`key`, `value`): `void` ##### Parameters ###### key `string` ###### value `Uint8Array` ##### Returns `void` #### setJSON() > **setJSON**(`key`, `value`): `void` ##### Parameters ###### key `string` ###### value `unknown` ##### Returns `void` #### setString() > **setString**(`key`, `value`): `void` ##### Parameters ###### key `string` ###### value `string` ##### Returns `void` *** ### timers > `readonly` **timers**: `object` = `api.timers` Defined in: [sdk/js/src/bot.ts:49](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L49) #### after() > **after**(`ms`, `tag`): `number` Once after `ms`; returns the timer id. ##### Parameters ###### ms `number` ###### tag `string` ##### Returns `number` #### cancel() > **cancel**(`id`): `void` ##### Parameters ###### id `number` ##### Returns `void` #### every() > **every**(`ms`, `tag`): `number` Every `ms` (≥ 1000). ##### Parameters ###### ms `number` ###### tag `string` ##### Returns `number` *** ### voice > `readonly` **voice**: `object` Defined in: [sdk/js/src/bot.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L56) Voice channels and music (capability `voice`). #### clearQueue() > **clearQueue**(): `void` Empties the queue; unlike `stop`, the current track keeps playing. ##### Returns `void` #### endStream() > **endStream**(): `void` The `pushed` track ends once its buffer has played. ##### Returns `void` #### enqueue() > **enqueue**(`t`): `number` Adds to the queue (≤ 100); returns its length. ##### Parameters ###### t `string` \| [`TrackOptions`](/docs/reference/js/zaun-bot/type-aliases/trackoptions/) ##### Returns `number` #### join() > **join**(`channelId`): `void` Joins a voice channel (leaving another first); returns once audio can flow. ##### Parameters ###### channelId `string` ##### Returns `void` #### leave() > **leave**(): `void` Leaves; playback stops and the queue clears. ##### Returns `void` #### moveTrack() > **moveTrack**(`from`, `to`): `void` Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. ##### Parameters ###### from `number` ###### to `number` ##### Returns `void` #### pause() > **pause**(): `void` ##### Returns `void` #### play() > **play**(`t`): `void` Plays now, replacing the current track (a string is a URL). ##### Parameters ###### t `string` \| [`TrackOptions`](/docs/reference/js/zaun-bot/type-aliases/trackoptions/) ##### Returns `void` #### push() > **push**(`packets`): `number` Opus packets for the current `pushed` track; returns ms buffered (`BUSY` past 3 s). ##### Parameters ###### packets `Uint8Array`\<`ArrayBufferLike`\>[] ##### Returns `number` #### remove() > **remove**(`index`): `string` Removes the queued track at `index` (0 plays next); returns its title. Throws `NOT_FOUND` past the end. Like every queue call, `UNSUPPORTED` on hosts without queue control. ##### Parameters ###### index `number` ##### Returns `string` #### resume() > **resume**(): `void` ##### Returns `void` #### seek() > **seek**(`ms`): `void` Jumps to `ms` into the current track; past the end, the track ends. Throws `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. ##### Parameters ###### ms `number` ##### Returns `void` #### setLoop() > **setLoop**(`mode`): `void` Sets what happens when a track ends. ##### Parameters ###### mode `LoopMode` ##### Returns `void` #### setVolume() > **setVolume**(`percent`): `void` Sets the playback volume, 0–200 % (100 when the bot joins). Throws `ZaunError` `BAD_REQUEST` (detail `percent`) outside 0–200, checked before the call, and `UNSUPPORTED` on hosts without an Opus encoder, which is most of them for now: tell the member and go on. ##### Parameters ###### percent `number` ##### Returns `void` #### shuffle() > **shuffle**(): `void` Puts the queue in a random order; the current track keeps playing. ##### Returns `void` #### skip() > **skip**(): `void` ##### Returns `void` #### state() > **state**(): [`VoiceState`](/docs/reference/js/zaun-bot/type-aliases/voicestate/) ##### Returns [`VoiceState`](/docs/reference/js/zaun-bot/type-aliases/voicestate/) #### stop() > **stop**(): `void` Ends the current track and clears the queue. ##### Returns `void` ## Methods ### command() #### Call Signature > **command**(`data`, `execute?`, `autocomplete?`): `this` Defined in: [sdk/js/src/bot.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L76) Registers a command; `execute` answers it (or handle it in `interactionCreate`). ##### Parameters ###### data [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/) ###### execute? (`i`) => `unknown` ###### autocomplete? (`i`) => `unknown` ##### Returns `this` #### Call Signature > **command**(`command`): `this` Defined in: [sdk/js/src/bot.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L77) Registers a command; `execute` answers it (or handle it in `interactionCreate`). ##### Parameters ###### command [`Command`](/docs/reference/js/zaun-bot/interfaces/command/) ##### Returns `this` *** ### component() > **component**(`match`, `handler`): `this` Defined in: [sdk/js/src/bot.ts:85](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L85) Handles clicks and choices whose custom id matches. #### Parameters ##### match `Match` ##### handler (`i`) => `unknown` #### Returns `this` *** ### emit() > **emit**\<`K`\>(`event`, ...`args`): `void` Defined in: [sdk/js/src/bot.ts:110](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L110) Calls every listener of `event`; errors go to `error` listeners and the log. #### Type Parameters ##### K `K` *extends* keyof [`BotEvents`](/docs/reference/js/zaun-bot/interfaces/botevents/) #### Parameters ##### event `K` ##### args ...`Parameters`\<[`BotEvents`](/docs/reference/js/zaun-bot/interfaces/botevents/)\[`K`\]\> #### Returns `void` *** ### exports() > **exports**(): `object` Defined in: [sdk/js/src/bot.ts:160](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L160) The `zaun:bot/bot` world's exports; export them from your entry module. #### Returns `object` ##### init > **init**: (`config`) => `Registration` ###### Parameters ###### config \[`string`, `string`\][] ###### Returns `Registration` ##### onAutocomplete > **onAutocomplete**: (`interaction`) => `Choice`[] ###### Parameters ###### interaction `Interaction` ###### Returns `Choice`[] ##### onConfigChange > **onConfigChange**: (`config`) => `void` ###### Parameters ###### config \[`string`, `string`\][] ###### Returns `void` ##### onEvent > **onEvent**: (`event`) => `void` ###### Parameters ###### event `Event` ###### Returns `void` ##### onInteraction > **onInteraction**: (`interaction`) => `void` ###### Parameters ###### interaction `Interaction` ###### Returns `void` ##### onTimer > **onTimer**: (`id`, `tag`) => `void` ###### Parameters ###### id `bigint` ###### tag `string` ###### Returns `void` ##### onVoiceEvent > **onVoiceEvent**: (`event`) => `void` ###### Parameters ###### event `VoiceEvent` ###### Returns `void` *** ### modal() > **modal**(`match`, `handler`): `this` Defined in: [sdk/js/src/bot.ts:91](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L91) Handles submitted modals whose custom id matches. #### Parameters ##### match `Match` ##### handler (`i`) => `unknown` #### Returns `this` *** ### off() > **off**\<`K`\>(`event`, `listener`): `this` Defined in: [sdk/js/src/bot.ts:103](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L103) #### Type Parameters ##### K `K` *extends* keyof [`BotEvents`](/docs/reference/js/zaun-bot/interfaces/botevents/) #### Parameters ##### event `K` ##### listener [`BotEvents`](/docs/reference/js/zaun-bot/interfaces/botevents/)\[`K`\] #### Returns `this` *** ### on() > **on**\<`K`\>(`event`, `listener`): `this` Defined in: [sdk/js/src/bot.ts:96](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L96) #### Type Parameters ##### K `K` *extends* keyof [`BotEvents`](/docs/reference/js/zaun-bot/interfaces/botevents/) #### Parameters ##### event `K` ##### listener [`BotEvents`](/docs/reference/js/zaun-bot/interfaces/botevents/)\[`K`\] #### Returns `this` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/buttonbuilder/ --- # ButtonBuilder Defined in: [sdk/js/src/builders/button.ts:17](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L17) Type 2. ## Constructors ### Constructor > **new ButtonBuilder**(): `ButtonBuilder` #### Returns `ButtonBuilder` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/button.ts:52](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L52) The custom id, if any. ##### Returns `string` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/button.ts:37](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L37) #### Parameters ##### id `string` #### Returns `this` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [sdk/js/src/builders/button.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L47) #### Parameters ##### disabled? `boolean` = `true` #### Returns `this` *** ### setEmoji() > **setEmoji**(`value`): `this` Defined in: [sdk/js/src/builders/button.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L33) #### Parameters ##### value `string` #### Returns `this` *** ### setLabel() > **setLabel**(`label`): `this` Defined in: [sdk/js/src/builders/button.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L29) #### Parameters ##### label `string` #### Returns `this` *** ### setStyle() > **setStyle**(`style`): `this` Defined in: [sdk/js/src/builders/button.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L25) #### Parameters ##### style [`ButtonStyle`](/docs/reference/js/zaun-bot/type-aliases/buttonstyle/) #### Returns `this` *** ### setURL() > **setURL**(`url`): `this` Defined in: [sdk/js/src/builders/button.ts:42](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L42) A link button (`https://` only; opened after the reader confirms). Sets the style. #### Parameters ##### url `string` #### Returns `this` *** ### toWit() > **toWit**(): `Button` Defined in: [sdk/js/src/builders/button.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L56) #### Returns `Button` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/channelselectmenubuilder/ --- # ChannelSelectMenuBuilder Defined in: [sdk/js/src/builders/select.ts:166](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L166) Type 8: channels. ## Extends - `EntitySelectBuilder` ## Constructors ### Constructor > **new ChannelSelectMenuBuilder**(): `ChannelSelectMenuBuilder` #### Returns `ChannelSelectMenuBuilder` #### Inherited from `EntitySelectBuilder.constructor` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/select.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L78) ##### Returns `string` #### Inherited from `EntitySelectBuilder.customId` ## Methods ### setChannelTypes() > **setChannelTypes**(...`kinds`): `this` Defined in: [sdk/js/src/builders/select.ts:169](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L169) Channel kinds offered (`text`, `voice`, `announcement`, …). #### Parameters ##### kinds ...`string`[] #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/select.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L53) #### Parameters ##### id `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setCustomId` *** ### setDefaultChannels() > **setDefaultChannels**(...`ids`): `this` Defined in: [sdk/js/src/builders/select.ts:173](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L173) #### Parameters ##### ids ...`string`[] #### Returns `this` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [sdk/js/src/builders/select.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L74) #### Parameters ##### disabled? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setDisabled` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L65) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMaxValues` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L61) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMinValues` *** ### setPlaceholder() > **setPlaceholder**(`placeholder`): `this` Defined in: [sdk/js/src/builders/select.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L57) #### Parameters ##### placeholder `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setPlaceholder` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/select.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L70) In a modal: whether an answer is needed (default true). #### Parameters ##### required? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setRequired` *** ### toWit() > **toWit**(): `EntitySelect` Defined in: [sdk/js/src/builders/select.ts:124](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L124) #### Returns `EntitySelect` #### Inherited from `EntitySelectBuilder.toWit` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/chatinputcommandinteraction/ --- # ChatInputCommandInteraction Defined in: [sdk/js/src/interactions/command.ts:36](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L36) `/command`. ## Extends - `CommandInteraction` ## Constructors ### Constructor > **new ChatInputCommandInteraction**(`raw`, `data`): `ChatInputCommandInteraction` Defined in: [sdk/js/src/interactions/command.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L26) #### Parameters ##### raw `Interaction` ##### data `CommandData` #### Returns `ChatInputCommandInteraction` #### Inherited from `CommandInteraction.constructor` ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from `CommandInteraction.appPermissions` *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from `CommandInteraction.botId` *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from `CommandInteraction.channelId` *** ### command > `readonly` **command**: `CommandData` Defined in: [sdk/js/src/interactions/command.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L24) The WIT command data. #### Inherited from `CommandInteraction.command` *** ### commandId > `readonly` **commandId**: `string` Defined in: [sdk/js/src/interactions/command.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L20) #### Inherited from `CommandInteraction.commandId` *** ### commandName > `readonly` **commandName**: `string` Defined in: [sdk/js/src/interactions/command.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L21) #### Inherited from `CommandInteraction.commandName` *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from `CommandInteraction.createdTimestamp` *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from `CommandInteraction.deferred` *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from `CommandInteraction.id` *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from `CommandInteraction.locale` *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from `CommandInteraction.member` *** ### options > `readonly` **options**: [`CommandInteractionOptionResolver`](/docs/reference/js/zaun-bot/classes/commandinteractionoptionresolver/) Defined in: [sdk/js/src/interactions/command.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L22) #### Inherited from `CommandInteraction.options` *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from `CommandInteraction.raw` *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from `CommandInteraction.replied` ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from `CommandInteraction.userId` ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` #### Inherited from `CommandInteraction.deferReply` *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` #### Inherited from `CommandInteraction.deleteReply` *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` #### Inherited from `CommandInteraction.editReply` *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from `CommandInteraction.followUp` *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from `CommandInteraction.isAnySelectMenu` *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from `CommandInteraction.isAutocomplete` *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from `CommandInteraction.isButton` *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from `CommandInteraction.isChannelSelectMenu` *** ### isChatInputCommand() > **isChatInputCommand**(): `this is ChatInputCommandInteraction` Defined in: [sdk/js/src/interactions/command.ts:37](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L37) #### Returns `this is ChatInputCommandInteraction` #### Overrides `CommandInteraction.isChatInputCommand` *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from `CommandInteraction.isCommand` *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` #### Inherited from `CommandInteraction.isContextMenuCommand` *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from `CommandInteraction.isMentionableSelectMenu` *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from `CommandInteraction.isMessageComponent` *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from `CommandInteraction.isMessageContextMenuCommand` *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from `CommandInteraction.isModalSubmit` *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from `CommandInteraction.isRepliable` *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from `CommandInteraction.isRoleSelectMenu` *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from `CommandInteraction.isStringSelectMenu` *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from `CommandInteraction.isUserContextMenuCommand` *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from `CommandInteraction.isUserSelectMenu` *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from `CommandInteraction.reply` *** ### showModal() > **showModal**(`modal`): `void` Defined in: [sdk/js/src/interactions/base.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L105) Opens a modal for the invoker. #### Parameters ##### modal [`ModalBuilder`](/docs/reference/js/zaun-bot/classes/modalbuilder/) #### Returns `void` #### Inherited from `CommandInteraction.showModal` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/checkboxbuilder/ --- # CheckboxBuilder Defined in: [sdk/js/src/builders/choices.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L77) Type 23: one yes/no box (never required). ## Constructors ### Constructor > **new CheckboxBuilder**(): `CheckboxBuilder` #### Returns `CheckboxBuilder` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/choices.ts:80](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L80) #### Parameters ##### id `string` #### Returns `this` *** ### setDefault() > **setDefault**(`checked?`): `this` Defined in: [sdk/js/src/builders/choices.ts:84](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L84) #### Parameters ##### checked? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `Checkbox` Defined in: [sdk/js/src/builders/choices.ts:88](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L88) #### Returns `Checkbox` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/checkboxgroupbuilder/ --- # CheckboxGroupBuilder Defined in: [sdk/js/src/builders/choices.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L41) Type 22: several choices of 1–10. ## Constructors ### Constructor > **new CheckboxGroupBuilder**(): `CheckboxGroupBuilder` #### Returns `CheckboxGroupBuilder` ## Methods ### addOptions() > **addOptions**(...`options`): `this` Defined in: [sdk/js/src/builders/choices.ts:51](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L51) #### Parameters ##### options ...`ChoiceInput`[] #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/choices.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L47) #### Parameters ##### id `string` #### Returns `this` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/choices.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L59) #### Parameters ##### n `number` #### Returns `this` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/choices.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L55) #### Parameters ##### n `number` #### Returns `this` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/choices.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L63) #### Parameters ##### required? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `CheckboxGroup` Defined in: [sdk/js/src/builders/choices.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L67) #### Returns `CheckboxGroup` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/commandinteractionoptionresolver/ --- # CommandInteractionOptionResolver Defined in: [sdk/js/src/interactions/options.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L12) The options the invoker filled in, the sub-command path, and resolved objects. ## Constructors ### Constructor > **new CommandInteractionOptionResolver**(`data`): `CommandInteractionOptionResolver` Defined in: [sdk/js/src/interactions/options.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L13) #### Parameters ##### data `CommandData` #### Returns `CommandInteractionOptionResolver` ## Accessors ### all #### Get Signature > **get** **all**(): readonly `ReceivedOption`[] Defined in: [sdk/js/src/interactions/options.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L16) Every option as received (sub-command options are flattened). ##### Returns readonly `ReceivedOption`[] ## Methods ### getAttachment() > **getAttachment**(`name`, `required?`): `Attachment` Defined in: [sdk/js/src/interactions/options.ts:85](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L85) #### Parameters ##### name `string` ##### required? `boolean` = `false` #### Returns `Attachment` *** ### getBoolean() #### Call Signature > **getBoolean**(`name`, `required`): `boolean` Defined in: [sdk/js/src/interactions/options.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L53) ##### Parameters ###### name `string` ###### required `true` ##### Returns `boolean` #### Call Signature > **getBoolean**(`name`, `required?`): `boolean` Defined in: [sdk/js/src/interactions/options.ts:54](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L54) ##### Parameters ###### name `string` ###### required? `boolean` ##### Returns `boolean` *** ### getChannel() > **getChannel**(`name`, `required?`): `Channel` Defined in: [sdk/js/src/interactions/options.ts:71](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L71) #### Parameters ##### name `string` ##### required? `boolean` = `false` #### Returns `Channel` *** ### getFocused() #### Call Signature > **getFocused**(): `string` Defined in: [sdk/js/src/interactions/options.ts:91](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L91) The option being typed (autocomplete): its value, or `{ name, value }` with `full`. ##### Returns `string` #### Call Signature > **getFocused**(`full`): `object` Defined in: [sdk/js/src/interactions/options.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L92) The option being typed (autocomplete): its value, or `{ name, value }` with `full`. ##### Parameters ###### full `true` ##### Returns `object` ###### name > **name**: `string` ###### value > **value**: `string` *** ### getInteger() #### Call Signature > **getInteger**(`name`, `required`): `number` Defined in: [sdk/js/src/interactions/options.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L43) ##### Parameters ###### name `string` ###### required `true` ##### Returns `number` #### Call Signature > **getInteger**(`name`, `required?`): `number` Defined in: [sdk/js/src/interactions/options.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L44) ##### Parameters ###### name `string` ###### required? `boolean` ##### Returns `number` *** ### getMember() > **getMember**(`name`, `required?`): [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/options.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L68) #### Parameters ##### name `string` ##### required? `boolean` = `false` #### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/) *** ### getMentionable() > **getMentionable**(`name`, `required?`): [`Member`](/docs/reference/js/zaun-bot/classes/member/) \| `Role` Defined in: [sdk/js/src/interactions/options.ts:79](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L79) #### Parameters ##### name `string` ##### required? `boolean` = `false` #### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/) \| `Role` *** ### getNumber() #### Call Signature > **getNumber**(`name`, `required`): `number` Defined in: [sdk/js/src/interactions/options.ts:48](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L48) ##### Parameters ###### name `string` ###### required `true` ##### Returns `number` #### Call Signature > **getNumber**(`name`, `required?`): `number` Defined in: [sdk/js/src/interactions/options.ts:49](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L49) ##### Parameters ###### name `string` ###### required? `boolean` ##### Returns `number` *** ### getRole() > **getRole**(`name`, `required?`): `Role` Defined in: [sdk/js/src/interactions/options.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L75) #### Parameters ##### name `string` ##### required? `boolean` = `false` #### Returns `Role` *** ### getString() #### Call Signature > **getString**(`name`, `required`): `string` Defined in: [sdk/js/src/interactions/options.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L38) ##### Parameters ###### name `string` ###### required `true` ##### Returns `string` #### Call Signature > **getString**(`name`, `required?`): `string` Defined in: [sdk/js/src/interactions/options.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L39) ##### Parameters ###### name `string` ###### required? `boolean` ##### Returns `string` *** ### getSubcommand() > **getSubcommand**(`required?`): `string` Defined in: [sdk/js/src/interactions/options.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L31) #### Parameters ##### required? `boolean` = `true` #### Returns `string` *** ### getSubcommandGroup() > **getSubcommandGroup**(`required?`): `string` Defined in: [sdk/js/src/interactions/options.ts:34](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L34) #### Parameters ##### required? `boolean` = `false` #### Returns `string` *** ### getUser() > **getUser**(`name`, `required?`): [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/options.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/options.ts#L64) A user option's member. #### Parameters ##### name `string` ##### required? `boolean` = `false` #### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/containerbuilder/ --- # ContainerBuilder Defined in: [sdk/js/src/builders/layout.ts:150](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L150) Type 17: a box around other components, with an optional accent colour. ## Constructors ### Constructor > **new ContainerBuilder**(): `ContainerBuilder` #### Returns `ContainerBuilder` ## Methods ### addActionRowComponents() > **addActionRowComponents**(...`rows`): `this` Defined in: [sdk/js/src/builders/layout.ts:165](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L165) #### Parameters ##### rows ...[`ActionRowBuilder`](/docs/reference/js/zaun-bot/classes/actionrowbuilder/)\<[`RowComponent`](/docs/reference/js/zaun-bot/type-aliases/rowcomponent/)\>[] #### Returns `this` *** ### addComponents() > **addComponents**(...`children`): `this` Defined in: [sdk/js/src/builders/layout.ts:155](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L155) #### Parameters ##### children ...[`ContainerComponent`](/docs/reference/js/zaun-bot/type-aliases/containercomponent/)[] #### Returns `this` *** ### addFileComponents() > **addFileComponents**(...`files`): `this` Defined in: [sdk/js/src/builders/layout.ts:174](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L174) #### Parameters ##### files ...[`FileBuilder`](/docs/reference/js/zaun-bot/classes/filebuilder/)[] #### Returns `this` *** ### addMediaGalleryComponents() > **addMediaGalleryComponents**(...`galleries`): `this` Defined in: [sdk/js/src/builders/layout.ts:171](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L171) #### Parameters ##### galleries ...[`MediaGalleryBuilder`](/docs/reference/js/zaun-bot/classes/mediagallerybuilder/)[] #### Returns `this` *** ### addSectionComponents() > **addSectionComponents**(...`sections`): `this` Defined in: [sdk/js/src/builders/layout.ts:162](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L162) #### Parameters ##### sections ...[`SectionBuilder`](/docs/reference/js/zaun-bot/classes/sectionbuilder/)[] #### Returns `this` *** ### addSeparatorComponents() > **addSeparatorComponents**(...`separators`): `this` Defined in: [sdk/js/src/builders/layout.ts:168](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L168) #### Parameters ##### separators ...[`SeparatorBuilder`](/docs/reference/js/zaun-bot/classes/separatorbuilder/)[] #### Returns `this` *** ### addTextDisplayComponents() > **addTextDisplayComponents**(...`texts`): `this` Defined in: [sdk/js/src/builders/layout.ts:159](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L159) #### Parameters ##### texts ...[`TextDisplayBuilder`](/docs/reference/js/zaun-bot/classes/textdisplaybuilder/)[] #### Returns `this` *** ### setAccentColor() > **setAccentColor**(`value`): `this` Defined in: [sdk/js/src/builders/layout.ts:177](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L177) #### Parameters ##### value `number` \| `` `#${string}` `` #### Returns `this` *** ### setSpoiler() > **setSpoiler**(`spoiler?`): `this` Defined in: [sdk/js/src/builders/layout.ts:181](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L181) #### Parameters ##### spoiler? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `Container` Defined in: [sdk/js/src/builders/layout.ts:185](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L185) #### Returns `Container` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/contextmenucommandbuilder/ --- # ContextMenuCommandBuilder Defined in: [sdk/js/src/builders/command.ts:155](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L155) A user or message context-menu command. ## Implements - [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/) ## Constructors ### Constructor > **new ContextMenuCommandBuilder**(): `ContextMenuCommandBuilder` #### Returns `ContextMenuCommandBuilder` ## Properties ### name > **name**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:156](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L156) #### Implementation of [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/).[`name`](/docs/reference/js/zaun-bot/interfaces/commandlike/#name) ## Methods ### setDefaultMemberPermissions() > **setDefaultMemberPermissions**(`bits`): `this` Defined in: [sdk/js/src/builders/command.ts:174](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L174) #### Parameters ##### bits `number` \| `bigint` #### Returns `this` *** ### setName() > **setName**(`name`): `this` Defined in: [sdk/js/src/builders/command.ts:162](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L162) 1–32 characters; spaces and capitals allowed. #### Parameters ##### name `string` #### Returns `this` *** ### setNameLocalizations() > **setNameLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:170](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L170) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` *** ### setType() > **setType**(`type`): `this` Defined in: [sdk/js/src/builders/command.ts:166](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L166) #### Parameters ##### type `2` \| `3` #### Returns `this` *** ### toWit() > **toWit**(): `ApplicationCommand` Defined in: [sdk/js/src/builders/command.ts:178](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L178) #### Returns `ApplicationCommand` #### Implementation of [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/).[`toWit`](/docs/reference/js/zaun-bot/interfaces/commandlike/#towit) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/embedbuilder/ --- # EmbedBuilder Defined in: [sdk/js/src/builders/embed.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L23) A rich embed. ## Constructors ### Constructor > **new EmbedBuilder**(`data?`): `EmbedBuilder` Defined in: [sdk/js/src/builders/embed.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L26) #### Parameters ##### data? [`EmbedData`](/docs/reference/js/zaun-bot/interfaces/embeddata/) = `{}` #### Returns `EmbedBuilder` ## Properties ### data > `readonly` **data**: [`EmbedData`](/docs/reference/js/zaun-bot/interfaces/embeddata/) Defined in: [sdk/js/src/builders/embed.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L24) ## Methods ### addFields() > **addFields**(...`fields`): `this` Defined in: [sdk/js/src/builders/embed.ts:72](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L72) #### Parameters ##### fields ...`object`[] #### Returns `this` *** ### length() > **length**(): `number` Defined in: [sdk/js/src/builders/embed.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L105) Characters this embed counts towards the 6 000 per message. #### Returns `number` *** ### setAuthor() > **setAuthor**(`author`): `this` Defined in: [sdk/js/src/builders/embed.ts:52](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L52) `iconAttachment` is an attachment id of the same message. #### Parameters ##### author ###### iconAttachment? `string` ###### name `string` ###### url? `string` #### Returns `this` *** ### setColor() > **setColor**(`value`): `this` Defined in: [sdk/js/src/builders/embed.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L43) #### Parameters ##### value `number` \| `` `#${string}` `` #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/embed.ts:34](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L34) #### Parameters ##### description `string` #### Returns `this` *** ### setFooter() > **setFooter**(`footer`): `this` Defined in: [sdk/js/src/builders/embed.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L58) #### Parameters ##### footer ###### iconAttachment? `string` ###### text `string` #### Returns `this` *** ### setImage() > **setImage**(`attachmentId`): `this` Defined in: [sdk/js/src/builders/embed.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L64) An image attachment of the same message (Zaun never loads remote pictures). #### Parameters ##### attachmentId `string` #### Returns `this` *** ### setThumbnail() > **setThumbnail**(`attachmentId`): `this` Defined in: [sdk/js/src/builders/embed.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L68) #### Parameters ##### attachmentId `string` #### Returns `this` *** ### setTimestamp() > **setTimestamp**(`at?`): `this` Defined in: [sdk/js/src/builders/embed.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L47) #### Parameters ##### at? `number` \| `Date` = `...` #### Returns `this` *** ### setTitle() > **setTitle**(`title`): `this` Defined in: [sdk/js/src/builders/embed.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L30) #### Parameters ##### title `string` #### Returns `this` *** ### setURL() > **setURL**(`url`): `this` Defined in: [sdk/js/src/builders/embed.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L39) The title's link (`https://` only). #### Parameters ##### url `string` #### Returns `this` *** ### toWit() > **toWit**(): `Embed` Defined in: [sdk/js/src/builders/embed.ts:84](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L84) The WIT `embed`. #### Returns `Embed` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/eventcontext/ --- # EventContext Defined in: [sdk/js/src/context.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L24) Passed to every event listener. ## Constructors ### Constructor > **new EventContext**(`me`): `EventContext` Defined in: [sdk/js/src/context.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L25) #### Parameters ##### me [`Me`](/docs/reference/js/zaun-bot/interfaces/me/) #### Returns `EventContext` ## Methods ### delete() > **delete**(`message`): `void` Defined in: [sdk/js/src/context.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L43) Deletes `message` (the bot's own, or any with `MANAGE_MESSAGES`). #### Parameters ##### message `Message` #### Returns `void` *** ### dm() > **dm**(`memberId`, `payload`): `object` Defined in: [sdk/js/src/context.ts:48](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L48) Sends a direct message to `memberId` (capability `dms`), opening the DM when needed. #### Parameters ##### memberId `string` ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `object` ##### channelId > **channelId**: `string` ##### messageId > **messageId**: `string` *** ### isMe() > **isMe**(`memberId`): `boolean` Defined in: [sdk/js/src/context.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L64) Whether `memberId` is the bot itself (known once `ready` arrived). #### Parameters ##### memberId `string` #### Returns `boolean` *** ### mentionsMe() > **mentionsMe**(`message`): `boolean` Defined in: [sdk/js/src/context.ts:73](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L73) Whether `message` mentions the bot: by its member id, by `@everyone`, or by one of its roles. Only when the message names roles does it ask the host for the bot's own roles (`community.getMember`); a refusal there counts as not mentioned. #### Parameters ##### message `Message` #### Returns `boolean` *** ### react() > **react**(`message`, `emoji`): `void` Defined in: [sdk/js/src/context.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L38) Adds a reaction to `message`. #### Parameters ##### message `Message` ##### emoji `string` #### Returns `void` *** ### reply() > **reply**(`message`, `payload`): `string` Defined in: [sdk/js/src/context.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L33) Replies to `message` in its channel. #### Parameters ##### message `Message` ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` *** ### send() > **send**(`channelId`, `payload`): `string` Defined in: [sdk/js/src/context.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L28) Posts in `channelId`; returns the new message's id. #### Parameters ##### channelId `string` ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` *** ### setPresence() > **setPresence**(`status`, `activity?`): `void` Defined in: [sdk/js/src/context.ts:54](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L54) Sets the bot's status and activity (none: no activity). #### Parameters ##### status [`PresenceStatus`](/docs/reference/js/zaun-bot/type-aliases/presencestatus/) ##### activity? [`Activity`](/docs/reference/js/zaun-bot/classes/activity/) #### Returns `void` *** ### setStatusText() > **setStatusText**(`text`): `void` Defined in: [sdk/js/src/context.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L59) Sets the bot's custom status text, kept until changed. #### Parameters ##### text `string` #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/filebuilder/ --- # FileBuilder Defined in: [sdk/js/src/builders/layout.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L97) Type 13: one attached file. ## Constructors ### Constructor > **new FileBuilder**(): `FileBuilder` #### Returns `FileBuilder` ## Methods ### setFile() > **setFile**(`attachmentId`): `this` Defined in: [sdk/js/src/builders/layout.ts:100](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L100) #### Parameters ##### attachmentId `string` #### Returns `this` *** ### setSpoiler() > **setSpoiler**(`spoiler?`): `this` Defined in: [sdk/js/src/builders/layout.ts:104](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L104) #### Parameters ##### spoiler? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `File` Defined in: [sdk/js/src/builders/layout.ts:108](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L108) #### Returns `File` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/fileuploadbuilder/ --- # FileUploadBuilder Defined in: [sdk/js/src/builders/choices.ts:94](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L94) Type 19: files the invoker uploads. ## Constructors ### Constructor > **new FileUploadBuilder**(): `FileUploadBuilder` #### Returns `FileUploadBuilder` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/choices.ts:99](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L99) #### Parameters ##### id `string` #### Returns `this` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/choices.ts:107](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L107) #### Parameters ##### n `number` #### Returns `this` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/choices.ts:103](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L103) #### Parameters ##### n `number` #### Returns `this` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/choices.ts:111](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L111) #### Parameters ##### required? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `FileUpload` Defined in: [sdk/js/src/builders/choices.ts:115](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L115) #### Returns `FileUpload` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/httperror/ --- # HttpError Defined in: [sdk/js/src/api.ts:109](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L109) Why `http.fetch` failed (`not-granted`, `refused-address`, `invalid-url`, `timeout`, …). ## Extends - [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/) ## Constructors ### Constructor > **new HttpError**(`kind`, `detail?`): `HttpError` Defined in: [sdk/js/src/api.ts:110](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L110) #### Parameters ##### kind `string` ##### detail? `string` #### Returns `HttpError` #### Overrides [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/).[`constructor`](/docs/reference/js/zaun-bot/classes/zaunerror/#constructor) ## Properties ### code > `readonly` **code**: `string` Defined in: [sdk/js/src/errors.ts:8](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L8) The protocol error code, or a runtime code such as `NOT_GRANTED`. #### Inherited from [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/).[`code`](/docs/reference/js/zaun-bot/classes/zaunerror/#code) *** ### detail > `readonly` **detail**: `string` Defined in: [sdk/js/src/errors.ts:10](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L10) The `reason` or `field` the host gave. #### Inherited from [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/).[`detail`](/docs/reference/js/zaun-bot/classes/zaunerror/#detail) *** ### kind > `readonly` **kind**: `string` Defined in: [sdk/js/src/api.ts:110](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L110) *** ### retryAfterMs > `readonly` **retryAfterMs**: `number` Defined in: [sdk/js/src/errors.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L12) For `RATE_LIMITED` and `BUSY`: when to try again, in ms. #### Inherited from [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/).[`retryAfterMs`](/docs/reference/js/zaun-bot/classes/zaunerror/#retryafterms) ## Methods ### isUnsupported() > **isUnsupported**(): `boolean` Defined in: [sdk/js/src/errors.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L27) Whether the host does not implement this call (or this case of it) yet: an older host, or a feature it lacks, such as volume without an Opus encoder. Fall back to what the bot did before; trying again will not help. #### Returns `boolean` #### Inherited from [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/).[`isUnsupported`](/docs/reference/js/zaun-bot/classes/zaunerror/#isunsupported) *** ### from() > `static` **from**(`e`): [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/) Defined in: [sdk/js/src/errors.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L32) From the WIT `host-error`. #### Parameters ##### e `HostError` #### Returns [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/) #### Inherited from [`ZaunError`](/docs/reference/js/zaun-bot/classes/zaunerror/).[`from`](/docs/reference/js/zaun-bot/classes/zaunerror/#from) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/labelbuilder/ --- # LabelBuilder Defined in: [sdk/js/src/builders/modal.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L21) Type 18: a modal field's label around one input. ## Constructors ### Constructor > **new LabelBuilder**(): `LabelBuilder` #### Returns `LabelBuilder` ## Methods ### setComponent() > **setComponent**(`component`): `this` Defined in: [sdk/js/src/builders/modal.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L33) #### Parameters ##### component [`LabelComponent`](/docs/reference/js/zaun-bot/type-aliases/labelcomponent/) #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/modal.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L29) #### Parameters ##### description `string` #### Returns `this` *** ### setLabel() > **setLabel**(`label`): `this` Defined in: [sdk/js/src/builders/modal.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L25) #### Parameters ##### label `string` #### Returns `this` *** ### setStringSelectMenuComponent() > **setStringSelectMenuComponent**(`c`): `this` Defined in: [sdk/js/src/builders/modal.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L41) #### Parameters ##### c [`StringSelectMenuBuilder`](/docs/reference/js/zaun-bot/classes/stringselectmenubuilder/) #### Returns `this` *** ### setTextInputComponent() > **setTextInputComponent**(`c`): `this` Defined in: [sdk/js/src/builders/modal.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L38) Aliases. #### Parameters ##### c [`TextInputBuilder`](/docs/reference/js/zaun-bot/classes/textinputbuilder/) #### Returns `this` *** ### toWit() > **toWit**(): `Label` Defined in: [sdk/js/src/builders/modal.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L44) #### Returns `Label` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/mediagallerybuilder/ --- # MediaGalleryBuilder Defined in: [sdk/js/src/builders/layout.ts:80](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L80) Type 12: up to ten pictures. ## Constructors ### Constructor > **new MediaGalleryBuilder**(): `MediaGalleryBuilder` #### Returns `MediaGalleryBuilder` ## Methods ### addItems() > **addItems**(...`items`): `this` Defined in: [sdk/js/src/builders/layout.ts:82](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L82) #### Parameters ##### items ...[`MediaGalleryItem`](/docs/reference/js/zaun-bot/interfaces/mediagalleryitem/)[] #### Returns `this` *** ### toWit() > **toWit**(): `MediaGallery` Defined in: [sdk/js/src/builders/layout.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L87) #### Returns `MediaGallery` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/member/ --- # Member Defined in: [sdk/js/src/member.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L38) A community member. ## Implements - `Member` ## Constructors ### Constructor > **new Member**(`raw`): `Member` Defined in: [sdk/js/src/member.ts:50](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L50) #### Parameters ##### raw `Member` #### Returns `Member` ## Properties ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/member.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L44) Set only for bots. #### Implementation of `wit.Member.botId` *** ### displayName > `readonly` **displayName**: `string` Defined in: [sdk/js/src/member.ts:40](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L40) #### Implementation of `wit.Member.displayName` *** ### joinedAt > `readonly` **joinedAt**: `bigint` Defined in: [sdk/js/src/member.ts:42](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L42) #### Implementation of `wit.Member.joinedAt` *** ### memberId > `readonly` **memberId**: `string` Defined in: [sdk/js/src/member.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L39) #### Implementation of `wit.Member.memberId` *** ### roleIds > `readonly` **roleIds**: `string`[] Defined in: [sdk/js/src/member.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L41) #### Implementation of `wit.Member.roleIds` *** ### roles > `readonly` **roles**: [`MemberRoles`](/docs/reference/js/zaun-bot/classes/memberroles/) Defined in: [sdk/js/src/member.ts:48](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L48) Role ids and `add` / `remove` / `has`. *** ### voiceChannel > `readonly` **voiceChannel**: `string` Defined in: [sdk/js/src/member.ts:46](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L46) The voice channel the member is in, if any (and if the bot can see it). #### Implementation of `wit.Member.voiceChannel` ## Accessors ### bot #### Get Signature > **get** **bot**(): `boolean` Defined in: [sdk/js/src/member.ts:85](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L85) Whether the member is a bot. ##### Returns `boolean` *** ### id #### Get Signature > **get** **id**(): `string` Defined in: [sdk/js/src/member.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L61) The member id. ##### Returns `string` *** ### joinedTimestamp #### Get Signature > **get** **joinedTimestamp**(): `number` Defined in: [sdk/js/src/member.ts:90](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L90) When the member joined, ms since the epoch. ##### Returns `number` *** ### voiceChannelId #### Get Signature > **get** **voiceChannelId**(): `string` Defined in: [sdk/js/src/member.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L69) The voice channel the member is in, if any and if the bot can see it. Always filled for an interaction's invoker, so `/play` can join them. ##### Returns `string` ## Methods ### kick() > **kick**(`reason?`): `void` Defined in: [sdk/js/src/member.ts:104](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L104) Removes the member from the community (`KICK_MEMBERS`). #### Parameters ##### reason? `string` #### Returns `void` *** ### mention() > **mention**(): `string` Defined in: [sdk/js/src/member.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L75) The text that shows a mention of the member, `<@id>` (it notifies only if the message's `mentions` names the member too). #### Returns `string` *** ### send() > **send**(`payload`): `object` Defined in: [sdk/js/src/member.ts:98](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L98) Sends the member a direct message (capability `dms`), opening the DM when needed. Throws `ZaunError` `FORBIDDEN` with detail `dms_closed` when they do not take DMs from bots. #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `object` ##### channelId > **channelId**: `string` ##### messageId > **messageId**: `string` *** ### timeout() > **timeout**(`until`, `reason?`): `void` Defined in: [sdk/js/src/member.ts:109](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L109) Times the member out until `until` (ms since the epoch); `null` clears it (`TIMEOUT_MEMBERS`). #### Parameters ##### until `number` ##### reason? `string` #### Returns `void` *** ### toString() > **toString**(): `string` Defined in: [sdk/js/src/member.ts:80](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L80) `<@id>`. #### Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/memberroles/ --- # MemberRoles Defined in: [sdk/js/src/member.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L14) A member's roles and the calls that change them (the bot needs `MANAGE_ROLES`). ## Constructors ### Constructor > **new MemberRoles**(`member`): `MemberRoles` Defined in: [sdk/js/src/member.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L15) #### Parameters ##### member [`Member`](/docs/reference/js/zaun-bot/classes/member/) #### Returns `MemberRoles` ## Accessors ### ids #### Get Signature > **get** **ids**(): readonly `string`[] Defined in: [sdk/js/src/member.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L18) The member's role ids, as the bot last saw them. ##### Returns readonly `string`[] ## Methods ### add() > **add**(`roleId`): `void` Defined in: [sdk/js/src/member.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L27) Gives the member a role below the bot's own. #### Parameters ##### roleId `string` #### Returns `void` *** ### has() > **has**(`roleId`): `boolean` Defined in: [sdk/js/src/member.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L22) #### Parameters ##### roleId `string` #### Returns `boolean` *** ### remove() > **remove**(`roleId`): `void` Defined in: [sdk/js/src/member.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/member.ts#L32) Takes a role away. #### Parameters ##### roleId `string` #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/mentionableselectmenubuilder/ --- # MentionableSelectMenuBuilder Defined in: [sdk/js/src/builders/select.ts:153](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L153) Type 7: members and roles. ## Extends - `EntitySelectBuilder` ## Constructors ### Constructor > **new MentionableSelectMenuBuilder**(): `MentionableSelectMenuBuilder` #### Returns `MentionableSelectMenuBuilder` #### Inherited from `EntitySelectBuilder.constructor` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/select.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L78) ##### Returns `string` #### Inherited from `EntitySelectBuilder.customId` ## Methods ### addDefaultRoles() > **addDefaultRoles**(...`ids`): `this` Defined in: [sdk/js/src/builders/select.ts:159](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L159) #### Parameters ##### ids ...`string`[] #### Returns `this` *** ### addDefaultUsers() > **addDefaultUsers**(...`ids`): `this` Defined in: [sdk/js/src/builders/select.ts:155](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L155) #### Parameters ##### ids ...`string`[] #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/select.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L53) #### Parameters ##### id `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setCustomId` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [sdk/js/src/builders/select.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L74) #### Parameters ##### disabled? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setDisabled` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L65) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMaxValues` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L61) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMinValues` *** ### setPlaceholder() > **setPlaceholder**(`placeholder`): `this` Defined in: [sdk/js/src/builders/select.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L57) #### Parameters ##### placeholder `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setPlaceholder` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/select.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L70) In a modal: whether an answer is needed (default true). #### Parameters ##### required? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setRequired` *** ### toWit() > **toWit**(): `EntitySelect` Defined in: [sdk/js/src/builders/select.ts:124](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L124) #### Returns `EntitySelect` #### Inherited from `EntitySelectBuilder.toWit` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/message/ --- # Message Defined in: [sdk/js/src/message-object.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L13) A channel message. ## Implements - `Message` ## Constructors ### Constructor > **new Message**(`raw`): `Message` Defined in: [sdk/js/src/message-object.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L32) #### Parameters ##### raw `Message` #### Returns `Message` ## Properties ### attachments > `readonly` **attachments**: `Attachment`[] Defined in: [sdk/js/src/message-object.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L29) #### Implementation of `wit.Message.attachments` *** ### authorId > `readonly` **authorId**: `string` Defined in: [sdk/js/src/message-object.ts:17](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L17) #### Implementation of `wit.Message.authorId` *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/message-object.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L15) #### Implementation of `wit.Message.channelId` *** ### components > `readonly` **components**: `Component`[] Defined in: [sdk/js/src/message-object.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L23) #### Implementation of `wit.Message.components` *** ### content > `readonly` **content**: `string` Defined in: [sdk/js/src/message-object.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L21) Empty when the bot lacks `message_content` (unless it is mentioned). #### Implementation of `wit.Message.content` *** ### createdAt > `readonly` **createdAt**: `bigint` Defined in: [sdk/js/src/message-object.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L18) #### Implementation of `wit.Message.createdAt` *** ### editedAt > `readonly` **editedAt**: `bigint` Defined in: [sdk/js/src/message-object.ts:19](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L19) #### Implementation of `wit.Message.editedAt` *** ### embeds > `readonly` **embeds**: `Embed`[] Defined in: [sdk/js/src/message-object.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L22) #### Implementation of `wit.Message.embeds` *** ### flags > `readonly` **flags**: `number` Defined in: [sdk/js/src/message-object.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L24) Raw flag bits. #### Implementation of `wit.Message.flags` *** ### interaction > `readonly` **interaction**: `InteractionMetadata` Defined in: [sdk/js/src/message-object.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L30) #### Implementation of `wit.Message.interaction` *** ### mentions > `readonly` **mentions**: [`MessageMentions`](/docs/reference/js/zaun-bot/classes/messagementions/) Defined in: [sdk/js/src/message-object.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L28) Who it mentions, as the host honoured them (on an edit event: the new mentions, or none when the edit left them unchanged). #### Implementation of `wit.Message.mentions` *** ### messageId > `readonly` **messageId**: `string` Defined in: [sdk/js/src/message-object.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L14) #### Implementation of `wit.Message.messageId` *** ### replyTo > `readonly` **replyTo**: `string` Defined in: [sdk/js/src/message-object.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L25) #### Implementation of `wit.Message.replyTo` *** ### sequence > `readonly` **sequence**: `bigint` Defined in: [sdk/js/src/message-object.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L16) #### Implementation of `wit.Message.sequence` ## Accessors ### createdTimestamp #### Get Signature > **get** **createdTimestamp**(): `number` Defined in: [sdk/js/src/message-object.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L55) When it was posted, ms since the epoch. ##### Returns `number` *** ### id #### Get Signature > **get** **id**(): `string` Defined in: [sdk/js/src/message-object.ts:50](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L50) The message id. ##### Returns `string` ## Methods ### delete() > **delete**(): `void` Defined in: [sdk/js/src/message-object.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L70) Deletes it (the bot's own, or any with `MANAGE_MESSAGES`). #### Returns `void` *** ### edit() > **edit**(`payload`): `void` Defined in: [sdk/js/src/message-object.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L65) Edits it (the bot's own messages only). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` *** ### react() > **react**(`emoji`): `void` Defined in: [sdk/js/src/message-object.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L75) Adds a reaction. #### Parameters ##### emoji `string` #### Returns `void` *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/message-object.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L60) Replies in the same channel; returns the reply's id. #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` *** ### unreact() > **unreact**(`emoji`): `void` Defined in: [sdk/js/src/message-object.ts:80](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message-object.ts#L80) Removes the bot's own reaction. #### Parameters ##### emoji `string` #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/ --- # MessageComponentInteraction Defined in: [sdk/js/src/interactions/component.ts:17](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L17) A click on a button or a choice in a select. ## Extends - [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/) ## Constructors ### Constructor > **new MessageComponentInteraction**(`raw`, `data`): `MessageComponentInteraction` Defined in: [sdk/js/src/interactions/component.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L25) #### Parameters ##### raw `Interaction` ##### data `ComponentData` #### Returns `MessageComponentInteraction` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`constructor`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#constructor) ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`appPermissions`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#apppermissions) *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`botId`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#botid) *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`channelId`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#channelid) *** ### component > `readonly` **component**: `ComponentData` Defined in: [sdk/js/src/interactions/component.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L23) The WIT component data. *** ### componentType > `readonly` **componentType**: `number` Defined in: [sdk/js/src/interactions/component.ts:19](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L19) *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`createdTimestamp`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#createdtimestamp) *** ### customId > `readonly` **customId**: `string` Defined in: [sdk/js/src/interactions/component.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L18) *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`deferred`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#deferred) *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`id`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#id) *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`locale`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#locale) *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`member`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#member) *** ### message > `readonly` **message**: [`Message`](/docs/reference/js/zaun-bot/classes/message/) Defined in: [sdk/js/src/interactions/component.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L21) The message holding the component. *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`raw`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#raw) *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`replied`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#replied) ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`userId`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#userid) *** ### values #### Get Signature > **get** **values**(): `string`[] Defined in: [sdk/js/src/interactions/component.ts:46](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L46) Chosen values of a select (option values or ids). ##### Returns `string`[] ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`deferReply`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#deferreply) *** ### deferUpdate() > **deferUpdate**(): `void` Defined in: [sdk/js/src/interactions/component.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L56) Acknowledges the click without changing anything yet; finish with `editReply`. #### Returns `void` *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`deleteReply`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#deletereply) *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`editReply`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#editreply) *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`followUp`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#followup) *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:40](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L40) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isAnySelectMenu`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isanyselectmenu) *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isAutocomplete`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isautocomplete) *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:34](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L34) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isButton`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isbutton) *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L39) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isChannelSelectMenu`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#ischannelselectmenu) *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isChatInputCommand`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#ischatinputcommand) *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isCommand`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#iscommand) *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isContextMenuCommand`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#iscontextmenucommand) *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L38) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isMentionableSelectMenu`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#ismentionableselectmenu) *** ### isMessageComponent() > **isMessageComponent**(): `this is MessageComponentInteraction` Defined in: [sdk/js/src/interactions/component.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L33) #### Returns `this is MessageComponentInteraction` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isMessageComponent`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#ismessagecomponent) *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isMessageContextMenuCommand`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#ismessagecontextmenucommand) *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isModalSubmit`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#ismodalsubmit) *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isRepliable`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isrepliable) *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:37](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L37) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isRoleSelectMenu`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isroleselectmenu) *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L35) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isStringSelectMenu`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isstringselectmenu) *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isUserContextMenuCommand`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isusercontextmenucommand) *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/component.ts:36](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L36) #### Returns `boolean` #### Overrides [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`isUserSelectMenu`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#isuserselectmenu) *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`reply`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#reply) *** ### showModal() > **showModal**(`modal`): `void` Defined in: [sdk/js/src/interactions/base.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L105) Opens a modal for the invoker. #### Parameters ##### modal [`ModalBuilder`](/docs/reference/js/zaun-bot/classes/modalbuilder/) #### Returns `void` #### Inherited from [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/).[`showModal`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/#showmodal) *** ### update() > **update**(`payload`): `void` Defined in: [sdk/js/src/interactions/component.ts:51](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L51) Replaces the message holding the component (it must be the bot's). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/messagecontextmenucommandinteraction/ --- # MessageContextMenuCommandInteraction Defined in: [sdk/js/src/interactions/command.ts:54](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L54) A message context-menu command. ## Extends - `CommandInteraction` ## Constructors ### Constructor > **new MessageContextMenuCommandInteraction**(`raw`, `data`): `MessageContextMenuCommandInteraction` Defined in: [sdk/js/src/interactions/command.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L26) #### Parameters ##### raw `Interaction` ##### data `CommandData` #### Returns `MessageContextMenuCommandInteraction` #### Inherited from `CommandInteraction.constructor` ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from `CommandInteraction.appPermissions` *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from `CommandInteraction.botId` *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from `CommandInteraction.channelId` *** ### command > `readonly` **command**: `CommandData` Defined in: [sdk/js/src/interactions/command.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L24) The WIT command data. #### Inherited from `CommandInteraction.command` *** ### commandId > `readonly` **commandId**: `string` Defined in: [sdk/js/src/interactions/command.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L20) #### Inherited from `CommandInteraction.commandId` *** ### commandName > `readonly` **commandName**: `string` Defined in: [sdk/js/src/interactions/command.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L21) #### Inherited from `CommandInteraction.commandName` *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from `CommandInteraction.createdTimestamp` *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from `CommandInteraction.deferred` *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from `CommandInteraction.id` *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from `CommandInteraction.locale` *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from `CommandInteraction.member` *** ### options > `readonly` **options**: [`CommandInteractionOptionResolver`](/docs/reference/js/zaun-bot/classes/commandinteractionoptionresolver/) Defined in: [sdk/js/src/interactions/command.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L22) #### Inherited from `CommandInteraction.options` *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from `CommandInteraction.raw` *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from `CommandInteraction.replied` ## Accessors ### targetId #### Get Signature > **get** **targetId**(): `string` Defined in: [sdk/js/src/interactions/command.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L58) The message acted on. ##### Returns `string` *** ### targetMessage #### Get Signature > **get** **targetMessage**(): [`Message`](/docs/reference/js/zaun-bot/classes/message/) Defined in: [sdk/js/src/interactions/command.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L61) ##### Returns [`Message`](/docs/reference/js/zaun-bot/classes/message/) *** ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from `CommandInteraction.userId` ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` #### Inherited from `CommandInteraction.deferReply` *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` #### Inherited from `CommandInteraction.deleteReply` *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` #### Inherited from `CommandInteraction.editReply` *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from `CommandInteraction.followUp` *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from `CommandInteraction.isAnySelectMenu` *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from `CommandInteraction.isAutocomplete` *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from `CommandInteraction.isButton` *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from `CommandInteraction.isChannelSelectMenu` *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from `CommandInteraction.isChatInputCommand` *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from `CommandInteraction.isCommand` *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/command.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L55) #### Returns `boolean` #### Overrides `CommandInteraction.isContextMenuCommand` *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from `CommandInteraction.isMentionableSelectMenu` *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from `CommandInteraction.isMessageComponent` *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `this is MessageContextMenuCommandInteraction` Defined in: [sdk/js/src/interactions/command.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L56) #### Returns `this is MessageContextMenuCommandInteraction` #### Overrides `CommandInteraction.isMessageContextMenuCommand` *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from `CommandInteraction.isModalSubmit` *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from `CommandInteraction.isRepliable` *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from `CommandInteraction.isRoleSelectMenu` *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from `CommandInteraction.isStringSelectMenu` *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from `CommandInteraction.isUserContextMenuCommand` *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from `CommandInteraction.isUserSelectMenu` *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from `CommandInteraction.reply` *** ### showModal() > **showModal**(`modal`): `void` Defined in: [sdk/js/src/interactions/base.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L105) Opens a modal for the invoker. #### Parameters ##### modal [`ModalBuilder`](/docs/reference/js/zaun-bot/classes/modalbuilder/) #### Returns `void` #### Inherited from `CommandInteraction.showModal` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/messagementions/ --- # MessageMentions Defined in: [sdk/js/src/mention.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L64) Who a message mentions, as the host honoured them. ## Implements - `Mentions` ## Constructors ### Constructor > **new MessageMentions**(`raw`): `MessageMentions` Defined in: [sdk/js/src/mention.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L69) #### Parameters ##### raw `Mentions` #### Returns `MessageMentions` ## Properties ### everyone > `readonly` **everyone**: `boolean` Defined in: [sdk/js/src/mention.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L65) #### Implementation of `wit.Mentions.everyone` *** ### members > `readonly` **members**: `string`[] Defined in: [sdk/js/src/mention.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L66) #### Implementation of `wit.Mentions.members` *** ### roles > `readonly` **roles**: `string`[] Defined in: [sdk/js/src/mention.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L67) #### Implementation of `wit.Mentions.roles` ## Methods ### hasMember() > **hasMember**(`id`): `boolean` Defined in: [sdk/js/src/mention.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L76) Whether member `id` is named. #### Parameters ##### id `string` #### Returns `boolean` *** ### hasRole() > **hasRole**(`id`): `boolean` Defined in: [sdk/js/src/mention.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L81) Whether role `id` is named. #### Parameters ##### id `string` #### Returns `boolean` *** ### includes() > **includes**(`memberId`, `roleIds?`): `boolean` Defined in: [sdk/js/src/mention.ts:89](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L89) Whether a member with `memberId` and `roleIds` is mentioned: by id, by one of its roles, or by `@everyone``). #### Parameters ##### memberId `string` ##### roleIds? readonly `string`[] = `[]` #### Returns `boolean` *** ### isEmpty() > **isEmpty**(): `boolean` Defined in: [sdk/js/src/mention.ts:94](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L94) Whether nobody is mentioned. #### Returns `boolean` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/modalbuilder/ --- # ModalBuilder Defined in: [sdk/js/src/builders/modal.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L61) A modal (callback type 9): 1–5 labels or text displays. ## Constructors ### Constructor > **new ModalBuilder**(): `ModalBuilder` #### Returns `ModalBuilder` ## Methods ### addComponents() > **addComponents**(...`rows`): `this` Defined in: [sdk/js/src/builders/modal.ts:90](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L90) Rows each holding one text input become labelled inputs (the label is the input's custom id unless `setLabel` was called on a [LabelBuilder](/docs/reference/js/zaun-bot/classes/labelbuilder/)). #### Parameters ##### rows ([`TextDisplayBuilder`](/docs/reference/js/zaun-bot/classes/textdisplaybuilder/) \| [`LabelBuilder`](/docs/reference/js/zaun-bot/classes/labelbuilder/))[] \| [`ActionRowBuilder`](/docs/reference/js/zaun-bot/classes/actionrowbuilder/)\<`never`\>[] #### Returns `this` *** ### addLabelComponents() > **addLabelComponents**(...`labels`): `this` Defined in: [sdk/js/src/builders/modal.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L74) #### Parameters ##### labels ...[`LabelBuilder`](/docs/reference/js/zaun-bot/classes/labelbuilder/)[] #### Returns `this` *** ### addTextDisplayComponents() > **addTextDisplayComponents**(...`texts`): `this` Defined in: [sdk/js/src/builders/modal.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L78) #### Parameters ##### texts ...[`TextDisplayBuilder`](/docs/reference/js/zaun-bot/classes/textdisplaybuilder/)[] #### Returns `this` *** ### addTextInput() > **addTextInput**(`label`, `input`): `this` Defined in: [sdk/js/src/builders/modal.ts:83](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L83) Shortcut: a labelled text input. #### Parameters ##### label `string` ##### input [`TextInputBuilder`](/docs/reference/js/zaun-bot/classes/textinputbuilder/) #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/modal.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L66) #### Parameters ##### id `string` #### Returns `this` *** ### setTitle() > **setTitle**(`title`): `this` Defined in: [sdk/js/src/builders/modal.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L70) #### Parameters ##### title `string` #### Returns `this` *** ### toWit() > **toWit**(): `Modal` Defined in: [sdk/js/src/builders/modal.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L97) #### Returns `Modal` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/modalcapableinteraction/ --- # ModalCapableInteraction Defined in: [sdk/js/src/interactions/base.ts:103](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L103) Interactions that may open a modal (commands and components, not modal submits). ## Extends - [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/) ## Extended by - [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) ## Constructors ### Constructor > **new ModalCapableInteraction**(`raw`): `ModalCapableInteraction` Defined in: [sdk/js/src/interactions/base.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L32) #### Parameters ##### raw `Interaction` #### Returns `ModalCapableInteraction` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`constructor`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#constructor) ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`appPermissions`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#apppermissions) *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`botId`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#botid) *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`channelId`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#channelid) *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`createdTimestamp`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#createdtimestamp) *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`deferred`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#deferred) *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`id`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#id) *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`locale`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#locale) *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`member`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#member) *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`raw`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#raw) *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`replied`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#replied) ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`userId`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#userid) ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`deferReply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#deferreply) *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`deleteReply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#deletereply) *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`editReply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply) *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`followUp`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#followup) *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isAnySelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isanyselectmenu) *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isAutocomplete`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isautocomplete) *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isButton`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isbutton) *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isChannelSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ischannelselectmenu) *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isChatInputCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ischatinputcommand) *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#iscommand) *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isContextMenuCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#iscontextmenucommand) *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isMentionableSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismentionableselectmenu) *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isMessageComponent`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismessagecomponent) *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isMessageContextMenuCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismessagecontextmenucommand) *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isModalSubmit`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismodalsubmit) *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isRepliable`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isrepliable) *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isRoleSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isroleselectmenu) *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isStringSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isstringselectmenu) *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isUserContextMenuCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isusercontextmenucommand) *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isUserSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isuserselectmenu) *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`reply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#reply) *** ### showModal() > **showModal**(`modal`): `void` Defined in: [sdk/js/src/interactions/base.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L105) Opens a modal for the invoker. #### Parameters ##### modal [`ModalBuilder`](/docs/reference/js/zaun-bot/classes/modalbuilder/) #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/modalsubmitfields/ --- # ModalSubmitFields Defined in: [sdk/js/src/interactions/modal.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L11) The submitted values by `custom_id`. ## Constructors ### Constructor > **new ModalSubmitFields**(`data`): `ModalSubmitFields` Defined in: [sdk/js/src/interactions/modal.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L12) #### Parameters ##### data `ModalData` #### Returns `ModalSubmitFields` ## Accessors ### all #### Get Signature > **get** **all**(): readonly `ModalValue`[] Defined in: [sdk/js/src/interactions/modal.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L15) Every submitted value. ##### Returns readonly `ModalValue`[] ## Methods ### getCheckbox() > **getCheckbox**(`customId`): `boolean` Defined in: [sdk/js/src/interactions/modal.ts:37](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L37) A checkbox. #### Parameters ##### customId `string` #### Returns `boolean` *** ### getField() > **getField**(`customId`, `required?`): `ModalValue` Defined in: [sdk/js/src/interactions/modal.ts:19](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L19) #### Parameters ##### customId `string` ##### required? `boolean` = `true` #### Returns `ModalValue` *** ### getRadioValue() > **getRadioValue**(`customId`): `string` Defined in: [sdk/js/src/interactions/modal.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L33) A radio group's choice. #### Parameters ##### customId `string` #### Returns `string` *** ### getSelectedMembers() > **getSelectedMembers**(`customId`): [`Member`](/docs/reference/js/zaun-bot/classes/member/)[] Defined in: [sdk/js/src/interactions/modal.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L41) Members chosen in a user select. #### Parameters ##### customId `string` #### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/)[] *** ### getStringSelectValues() > **getStringSelectValues**(`customId`): `string`[] Defined in: [sdk/js/src/interactions/modal.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L29) Values of a select, radio group or checkbox group. #### Parameters ##### customId `string` #### Returns `string`[] *** ### getTextInputValue() > **getTextInputValue**(`customId`): `string` Defined in: [sdk/js/src/interactions/modal.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L25) A text input's value (`''` when left empty and optional). #### Parameters ##### customId `string` #### Returns `string` *** ### getUploadedFiles() > **getUploadedFiles**(`customId`): `Attachment`[] Defined in: [sdk/js/src/interactions/modal.ts:46](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L46) Files uploaded in a file upload. #### Parameters ##### customId `string` #### Returns `Attachment`[] --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/modalsubmitinteraction/ --- # ModalSubmitInteraction Defined in: [sdk/js/src/interactions/modal.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L53) A submitted modal. ## Extends - [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/) ## Constructors ### Constructor > **new ModalSubmitInteraction**(`raw`, `data`): `ModalSubmitInteraction` Defined in: [sdk/js/src/interactions/modal.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L59) #### Parameters ##### raw `Interaction` ##### data `ModalData` #### Returns `ModalSubmitInteraction` #### Overrides [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`constructor`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#constructor) ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`appPermissions`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#apppermissions) *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`botId`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#botid) *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`channelId`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#channelid) *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`createdTimestamp`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#createdtimestamp) *** ### customId > `readonly` **customId**: `string` Defined in: [sdk/js/src/interactions/modal.ts:54](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L54) *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`deferred`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#deferred) *** ### fields > `readonly` **fields**: [`ModalSubmitFields`](/docs/reference/js/zaun-bot/classes/modalsubmitfields/) Defined in: [sdk/js/src/interactions/modal.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L55) *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`id`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#id) *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`locale`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#locale) *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`member`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#member) *** ### message > `readonly` **message**: [`Message`](/docs/reference/js/zaun-bot/classes/message/) Defined in: [sdk/js/src/interactions/modal.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L57) For a modal opened from a component: the message holding it. *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`raw`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#raw) *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`replied`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#replied) ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`userId`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#userid) ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`deferReply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#deferreply) *** ### deferUpdate() > **deferUpdate**(): `void` Defined in: [sdk/js/src/interactions/modal.ts:72](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L72) #### Returns `void` *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`deleteReply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#deletereply) *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`editReply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply) *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`followUp`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#followup) *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isAnySelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isanyselectmenu) *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isAutocomplete`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isautocomplete) *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isButton`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isbutton) *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isChannelSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ischannelselectmenu) *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isChatInputCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ischatinputcommand) *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#iscommand) *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isContextMenuCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#iscontextmenucommand) *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isMentionableSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismentionableselectmenu) *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isMessageComponent`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismessagecomponent) *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isMessageContextMenuCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismessagecontextmenucommand) *** ### isModalSubmit() > **isModalSubmit**(): `this is ModalSubmitInteraction` Defined in: [sdk/js/src/interactions/modal.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L66) #### Returns `this is ModalSubmitInteraction` #### Overrides [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isModalSubmit`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#ismodalsubmit) *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isRepliable`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isrepliable) *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isRoleSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isroleselectmenu) *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isStringSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isstringselectmenu) *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isUserContextMenuCommand`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isusercontextmenucommand) *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`isUserSelectMenu`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#isuserselectmenu) *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from [`RepliableInteraction`](/docs/reference/js/zaun-bot/classes/repliableinteraction/).[`reply`](/docs/reference/js/zaun-bot/classes/repliableinteraction/#reply) *** ### update() > **update**(`payload`): `void` Defined in: [sdk/js/src/interactions/modal.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/modal.ts#L69) For a modal opened from a component: replaces that message. #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/optionbuilder/ --- # OptionBuilder Defined in: [sdk/js/src/builders/options.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L27) One value option (used through `addStringOption(o => …)` and friends). ## Constructors ### Constructor > **new OptionBuilder**(`type`): `OptionBuilder` Defined in: [sdk/js/src/builders/options.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L41) #### Parameters ##### type [`ApplicationCommandOptionType`](/docs/reference/js/zaun-bot/type-aliases/applicationcommandoptiontype/) #### Returns `OptionBuilder` ## Properties ### description > **description**: `string` = `''` Defined in: [sdk/js/src/builders/options.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L29) *** ### name > **name**: `string` = `''` Defined in: [sdk/js/src/builders/options.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L28) *** ### required > **required**: `boolean` = `false` Defined in: [sdk/js/src/builders/options.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L30) *** ### type > `readonly` **type**: [`ApplicationCommandOptionType`](/docs/reference/js/zaun-bot/type-aliases/applicationcommandoptiontype/) Defined in: [sdk/js/src/builders/options.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L41) ## Methods ### addChannelTypes() > **addChannelTypes**(...`kinds`): `this` Defined in: [sdk/js/src/builders/options.ts:71](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L71) Channel kinds offered (channel options). #### Parameters ##### kinds ...`string`[] #### Returns `this` *** ### addChoices() > **addChoices**(...`choices`): `this` Defined in: [sdk/js/src/builders/options.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L64) Fixed choices (string, integer and number options). #### Parameters ##### choices ...`object`[] #### Returns `this` *** ### setAutocomplete() > **setAutocomplete**(`autocomplete?`): `this` Defined in: [sdk/js/src/builders/options.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L92) Suggest values as the invoker types (`bot.on('autocomplete')`); not with choices. #### Parameters ##### autocomplete? `boolean` = `true` #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/options.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L47) #### Parameters ##### description `string` #### Returns `this` *** ### setDescriptionLocalizations() > **setDescriptionLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/options.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L59) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` *** ### setMaxLength() > **setMaxLength**(`n`): `this` Defined in: [sdk/js/src/builders/options.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L87) #### Parameters ##### n `number` #### Returns `this` *** ### setMaxValue() > **setMaxValue**(`n`): `this` Defined in: [sdk/js/src/builders/options.ts:79](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L79) #### Parameters ##### n `number` #### Returns `this` *** ### setMinLength() > **setMinLength**(`n`): `this` Defined in: [sdk/js/src/builders/options.ts:83](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L83) #### Parameters ##### n `number` #### Returns `this` *** ### setMinValue() > **setMinValue**(`n`): `this` Defined in: [sdk/js/src/builders/options.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L75) #### Parameters ##### n `number` #### Returns `this` *** ### setName() > **setName**(`name`): `this` Defined in: [sdk/js/src/builders/options.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L43) #### Parameters ##### name `string` #### Returns `this` *** ### setNameLocalizations() > **setNameLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/options.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L55) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/options.ts:51](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L51) #### Parameters ##### required? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `CommandOption` Defined in: [sdk/js/src/builders/options.ts:110](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L110) #### Returns `CommandOption` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/radiogroupbuilder/ --- # RadioGroupBuilder Defined in: [sdk/js/src/builders/choices.ts:19](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L19) Type 21: one choice of 2–10. ## Constructors ### Constructor > **new RadioGroupBuilder**(): `RadioGroupBuilder` #### Returns `RadioGroupBuilder` ## Methods ### addOptions() > **addOptions**(...`options`): `this` Defined in: [sdk/js/src/builders/choices.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L27) #### Parameters ##### options ...`ChoiceInput`[] #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/choices.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L23) #### Parameters ##### id `string` #### Returns `this` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/choices.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L31) #### Parameters ##### required? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `RadioGroup` Defined in: [sdk/js/src/builders/choices.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/choices.ts#L35) #### Returns `RadioGroup` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/repliableinteraction/ --- # RepliableInteraction Defined in: [sdk/js/src/interactions/base.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L74) Interactions that can be answered with messages (all but autocomplete). ## Extends - [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/) ## Extended by - [`ModalCapableInteraction`](/docs/reference/js/zaun-bot/classes/modalcapableinteraction/) - [`ModalSubmitInteraction`](/docs/reference/js/zaun-bot/classes/modalsubmitinteraction/) ## Constructors ### Constructor > **new RepliableInteraction**(`raw`): `RepliableInteraction` Defined in: [sdk/js/src/interactions/base.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L32) #### Parameters ##### raw `Interaction` #### Returns `RepliableInteraction` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`constructor`](/docs/reference/js/zaun-bot/classes/baseinteraction/#constructor) ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`appPermissions`](/docs/reference/js/zaun-bot/classes/baseinteraction/#apppermissions) *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`botId`](/docs/reference/js/zaun-bot/classes/baseinteraction/#botid) *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`channelId`](/docs/reference/js/zaun-bot/classes/baseinteraction/#channelid) *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`createdTimestamp`](/docs/reference/js/zaun-bot/classes/baseinteraction/#createdtimestamp) *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`deferred`](/docs/reference/js/zaun-bot/classes/baseinteraction/#deferred) *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`id`](/docs/reference/js/zaun-bot/classes/baseinteraction/#id) *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`locale`](/docs/reference/js/zaun-bot/classes/baseinteraction/#locale) *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`member`](/docs/reference/js/zaun-bot/classes/baseinteraction/#member) *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`raw`](/docs/reference/js/zaun-bot/classes/baseinteraction/#raw) *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`replied`](/docs/reference/js/zaun-bot/classes/baseinteraction/#replied) ## Accessors ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`userId`](/docs/reference/js/zaun-bot/classes/baseinteraction/#userid) ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isAnySelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isanyselectmenu) *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isAutocomplete`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isautocomplete) *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isButton`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isbutton) *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isChannelSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ischannelselectmenu) *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isChatInputCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ischatinputcommand) *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#iscommand) *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:56](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L56) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isContextMenuCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#iscontextmenucommand) *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isMentionableSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismentionableselectmenu) *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isMessageComponent`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismessagecomponent) *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isMessageContextMenuCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismessagecontextmenucommand) *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isModalSubmit`](/docs/reference/js/zaun-bot/classes/baseinteraction/#ismodalsubmit) *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isRepliable`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isrepliable) *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isRoleSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isroleselectmenu) *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isStringSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isstringselectmenu) *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L57) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isUserContextMenuCommand`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isusercontextmenucommand) *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from [`BaseInteraction`](/docs/reference/js/zaun-bot/classes/baseinteraction/).[`isUserSelectMenu`](/docs/reference/js/zaun-bot/classes/baseinteraction/#isuserselectmenu) *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/roleselectmenubuilder/ --- # RoleSelectMenuBuilder Defined in: [sdk/js/src/builders/select.ts:144](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L144) Type 6: roles. ## Extends - `EntitySelectBuilder` ## Constructors ### Constructor > **new RoleSelectMenuBuilder**(): `RoleSelectMenuBuilder` #### Returns `RoleSelectMenuBuilder` #### Inherited from `EntitySelectBuilder.constructor` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/select.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L78) ##### Returns `string` #### Inherited from `EntitySelectBuilder.customId` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/select.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L53) #### Parameters ##### id `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setCustomId` *** ### setDefaultRoles() > **setDefaultRoles**(...`ids`): `this` Defined in: [sdk/js/src/builders/select.ts:146](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L146) #### Parameters ##### ids ...`string`[] #### Returns `this` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [sdk/js/src/builders/select.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L74) #### Parameters ##### disabled? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setDisabled` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L65) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMaxValues` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L61) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMinValues` *** ### setPlaceholder() > **setPlaceholder**(`placeholder`): `this` Defined in: [sdk/js/src/builders/select.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L57) #### Parameters ##### placeholder `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setPlaceholder` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/select.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L70) In a modal: whether an answer is needed (default true). #### Parameters ##### required? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setRequired` *** ### toWit() > **toWit**(): `EntitySelect` Defined in: [sdk/js/src/builders/select.ts:124](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L124) #### Returns `EntitySelect` #### Inherited from `EntitySelectBuilder.toWit` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/sectionbuilder/ --- # SectionBuilder Defined in: [sdk/js/src/builders/layout.ts:46](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L46) Type 9: one to three texts with a button or thumbnail beside them. ## Constructors ### Constructor > **new SectionBuilder**(): `SectionBuilder` #### Returns `SectionBuilder` ## Methods ### addTextDisplayComponents() > **addTextDisplayComponents**(...`texts`): `this` Defined in: [sdk/js/src/builders/layout.ts:50](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L50) #### Parameters ##### texts ...[`TextDisplayBuilder`](/docs/reference/js/zaun-bot/classes/textdisplaybuilder/)[] #### Returns `this` *** ### setButtonAccessory() > **setButtonAccessory**(`button`): `this` Defined in: [sdk/js/src/builders/layout.ts:54](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L54) #### Parameters ##### button [`ButtonBuilder`](/docs/reference/js/zaun-bot/classes/buttonbuilder/) #### Returns `this` *** ### setThumbnailAccessory() > **setThumbnailAccessory**(`thumbnail`): `this` Defined in: [sdk/js/src/builders/layout.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L58) #### Parameters ##### thumbnail [`ThumbnailBuilder`](/docs/reference/js/zaun-bot/classes/thumbnailbuilder/) #### Returns `this` *** ### toWit() > **toWit**(): `Section` Defined in: [sdk/js/src/builders/layout.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L62) #### Returns `Section` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/separatorbuilder/ --- # SeparatorBuilder Defined in: [sdk/js/src/builders/layout.ts:119](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L119) Type 14. ## Constructors ### Constructor > **new SeparatorBuilder**(): `SeparatorBuilder` #### Returns `SeparatorBuilder` ## Methods ### setDivider() > **setDivider**(`divider?`): `this` Defined in: [sdk/js/src/builders/layout.ts:122](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L122) #### Parameters ##### divider? `boolean` = `true` #### Returns `this` *** ### setSpacing() > **setSpacing**(`spacing`): `this` Defined in: [sdk/js/src/builders/layout.ts:126](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L126) #### Parameters ##### spacing [`SeparatorSpacingSize`](/docs/reference/js/zaun-bot/type-aliases/separatorspacingsize/) #### Returns `this` *** ### toWit() > **toWit**(): `Separator` Defined in: [sdk/js/src/builders/layout.ts:130](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L130) #### Returns `Separator` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/slashcommandbuilder/ --- # SlashCommandBuilder Defined in: [sdk/js/src/builders/command.ts:117](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L117) A slash command (`CHAT_INPUT`). ## Extends - `WithOptions` ## Implements - [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/) ## Constructors ### Constructor > **new SlashCommandBuilder**(): `SlashCommandBuilder` #### Returns `SlashCommandBuilder` #### Inherited from `WithOptions.constructor` ## Properties ### description > **description**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L27) #### Inherited from [`SlashCommandSubcommandBuilder`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/).[`description`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/#description) *** ### descriptionLocalizations? > `optional` **descriptionLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/builders/command.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L29) #### Inherited from `WithOptions.descriptionLocalizations` *** ### name > **name**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L26) #### Implementation of [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/).[`name`](/docs/reference/js/zaun-bot/interfaces/commandlike/#name) #### Inherited from [`SlashCommandSubcommandBuilder`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/).[`name`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/#name) *** ### nameLocalizations? > `optional` **nameLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/builders/command.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L28) #### Inherited from `WithOptions.nameLocalizations` *** ### options > `readonly` **options**: [`OptionBuilder`](/docs/reference/js/zaun-bot/classes/optionbuilder/)[] = `[]` Defined in: [sdk/js/src/builders/command.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L63) #### Inherited from `WithOptions.options` ## Methods ### addAttachmentOption() > **addAttachmentOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L78) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addAttachmentOption` *** ### addBooleanOption() > **addBooleanOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:72](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L72) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addBooleanOption` *** ### addChannelOption() > **addChannelOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L74) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addChannelOption` *** ### addIntegerOption() > **addIntegerOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:71](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L71) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addIntegerOption` *** ### addMentionableOption() > **addMentionableOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L76) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addMentionableOption` *** ### addNumberOption() > **addNumberOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L77) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addNumberOption` *** ### addRoleOption() > **addRoleOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L75) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addRoleOption` *** ### addStringOption() > **addStringOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L70) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addStringOption` *** ### addSubcommand() > **addSubcommand**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:121](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L121) #### Parameters ##### f (`s`) => [`SlashCommandSubcommandBuilder`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/) #### Returns `this` *** ### addSubcommandGroup() > **addSubcommandGroup**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:125](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L125) #### Parameters ##### f (`g`) => [`SlashCommandSubcommandGroupBuilder`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandgroupbuilder/) #### Returns `this` *** ### addUserOption() > **addUserOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:73](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L73) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addUserOption` *** ### setDefaultMemberPermissions() > **setDefaultMemberPermissions**(`bits`): `this` Defined in: [sdk/js/src/builders/command.ts:130](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L130) Bits the invoker needs (`0n` = owner only; `null` = everyone, the default). #### Parameters ##### bits `number` \| `bigint` #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/command.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L35) #### Parameters ##### description `string` #### Returns `this` #### Inherited from `WithOptions.setDescription` *** ### setDescriptionLocalizations() > **setDescriptionLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L43) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` #### Inherited from `WithOptions.setDescriptionLocalizations` *** ### setName() > **setName**(`name`): `this` Defined in: [sdk/js/src/builders/command.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L31) #### Parameters ##### name `string` #### Returns `this` #### Inherited from `WithOptions.setName` *** ### setNameLocalizations() > **setNameLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L39) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` #### Inherited from `WithOptions.setNameLocalizations` *** ### toJSON() > **toJSON**(): `ApplicationCommand` Defined in: [sdk/js/src/builders/command.ts:149](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L149) the WIT form. #### Returns `ApplicationCommand` *** ### toWit() > **toWit**(): `ApplicationCommand` Defined in: [sdk/js/src/builders/command.ts:135](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L135) #### Returns `ApplicationCommand` #### Implementation of [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/).[`toWit`](/docs/reference/js/zaun-bot/interfaces/commandlike/#towit) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/ --- # SlashCommandSubcommandBuilder Defined in: [sdk/js/src/builders/command.ts:91](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L91) Type 1 option: a sub-command. ## Extends - `WithOptions` ## Constructors ### Constructor > **new SlashCommandSubcommandBuilder**(): `SlashCommandSubcommandBuilder` #### Returns `SlashCommandSubcommandBuilder` #### Inherited from `WithOptions.constructor` ## Properties ### description > **description**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L27) #### Inherited from `WithOptions.description` *** ### descriptionLocalizations? > `optional` **descriptionLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/builders/command.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L29) #### Inherited from `WithOptions.descriptionLocalizations` *** ### name > **name**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L26) #### Inherited from `WithOptions.name` *** ### nameLocalizations? > `optional` **nameLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/builders/command.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L28) #### Inherited from `WithOptions.nameLocalizations` *** ### options > `readonly` **options**: [`OptionBuilder`](/docs/reference/js/zaun-bot/classes/optionbuilder/)[] = `[]` Defined in: [sdk/js/src/builders/command.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L63) #### Inherited from `WithOptions.options` ## Methods ### addAttachmentOption() > **addAttachmentOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L78) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addAttachmentOption` *** ### addBooleanOption() > **addBooleanOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:72](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L72) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addBooleanOption` *** ### addChannelOption() > **addChannelOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L74) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addChannelOption` *** ### addIntegerOption() > **addIntegerOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:71](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L71) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addIntegerOption` *** ### addMentionableOption() > **addMentionableOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L76) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addMentionableOption` *** ### addNumberOption() > **addNumberOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L77) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addNumberOption` *** ### addRoleOption() > **addRoleOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L75) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addRoleOption` *** ### addStringOption() > **addStringOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L70) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addStringOption` *** ### addUserOption() > **addUserOption**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:73](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L73) #### Parameters ##### f `OptionFn` #### Returns `this` #### Inherited from `WithOptions.addUserOption` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/command.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L35) #### Parameters ##### description `string` #### Returns `this` #### Inherited from `WithOptions.setDescription` *** ### setDescriptionLocalizations() > **setDescriptionLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L43) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` #### Inherited from `WithOptions.setDescriptionLocalizations` *** ### setName() > **setName**(`name`): `this` Defined in: [sdk/js/src/builders/command.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L31) #### Parameters ##### name `string` #### Returns `this` #### Inherited from `WithOptions.setName` *** ### setNameLocalizations() > **setNameLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L39) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` #### Inherited from `WithOptions.setNameLocalizations` *** ### toWit() > **toWit**(): `SubCommand` Defined in: [sdk/js/src/builders/command.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L92) #### Returns `SubCommand` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/slashcommandsubcommandgroupbuilder/ --- # SlashCommandSubcommandGroupBuilder Defined in: [sdk/js/src/builders/command.ts:98](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L98) Type 2 option: a group of sub-commands. ## Extends - `Named` ## Constructors ### Constructor > **new SlashCommandSubcommandGroupBuilder**(): `SlashCommandSubcommandGroupBuilder` #### Returns `SlashCommandSubcommandGroupBuilder` #### Inherited from `Named.constructor` ## Properties ### description > **description**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L27) #### Inherited from `Named.description` *** ### descriptionLocalizations? > `optional` **descriptionLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/builders/command.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L29) #### Inherited from `Named.descriptionLocalizations` *** ### name > **name**: `string` = `''` Defined in: [sdk/js/src/builders/command.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L26) #### Inherited from `Named.name` *** ### nameLocalizations? > `optional` **nameLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/builders/command.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L28) #### Inherited from `Named.nameLocalizations` *** ### subcommands > `readonly` **subcommands**: [`SlashCommandSubcommandBuilder`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/)[] = `[]` Defined in: [sdk/js/src/builders/command.ts:99](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L99) ## Methods ### addSubcommand() > **addSubcommand**(`f`): `this` Defined in: [sdk/js/src/builders/command.ts:100](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L100) #### Parameters ##### f (`s`) => [`SlashCommandSubcommandBuilder`](/docs/reference/js/zaun-bot/classes/slashcommandsubcommandbuilder/) #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/command.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L35) #### Parameters ##### description `string` #### Returns `this` #### Inherited from `Named.setDescription` *** ### setDescriptionLocalizations() > **setDescriptionLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L43) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` #### Inherited from `Named.setDescriptionLocalizations` *** ### setName() > **setName**(`name`): `this` Defined in: [sdk/js/src/builders/command.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L31) #### Parameters ##### name `string` #### Returns `this` #### Inherited from `Named.setName` *** ### setNameLocalizations() > **setNameLocalizations**(`map`): `this` Defined in: [sdk/js/src/builders/command.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L39) #### Parameters ##### map `Record`\<`string`, `string`\> #### Returns `this` #### Inherited from `Named.setNameLocalizations` *** ### toWit() > **toWit**(): `SubCommandGroup` Defined in: [sdk/js/src/builders/command.ts:104](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L104) #### Returns `SubCommandGroup` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/stringselectmenubuilder/ --- # StringSelectMenuBuilder Defined in: [sdk/js/src/builders/select.ts:88](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L88) Type 3. ## Extends - `SelectBuilder` ## Constructors ### Constructor > **new StringSelectMenuBuilder**(): `StringSelectMenuBuilder` #### Returns `StringSelectMenuBuilder` #### Inherited from `SelectBuilder.constructor` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/select.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L78) ##### Returns `string` #### Inherited from `SelectBuilder.customId` ## Methods ### addOptions() > **addOptions**(...`options`): `this` Defined in: [sdk/js/src/builders/select.ts:91](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L91) #### Parameters ##### options ...`OptionInput`[] #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/select.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L53) #### Parameters ##### id `string` #### Returns `this` #### Inherited from `SelectBuilder.setCustomId` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [sdk/js/src/builders/select.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L74) #### Parameters ##### disabled? `boolean` = `true` #### Returns `this` #### Inherited from `SelectBuilder.setDisabled` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L65) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `SelectBuilder.setMaxValues` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L61) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `SelectBuilder.setMinValues` *** ### setPlaceholder() > **setPlaceholder**(`placeholder`): `this` Defined in: [sdk/js/src/builders/select.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L57) #### Parameters ##### placeholder `string` #### Returns `this` #### Inherited from `SelectBuilder.setPlaceholder` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/select.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L70) In a modal: whether an answer is needed (default true). #### Parameters ##### required? `boolean` = `true` #### Returns `this` #### Inherited from `SelectBuilder.setRequired` *** ### toWit() > **toWit**(): `StringSelect` Defined in: [sdk/js/src/builders/select.ts:106](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L106) #### Returns `StringSelect` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/stringselectmenuoptionbuilder/ --- # StringSelectMenuOptionBuilder Defined in: [sdk/js/src/builders/select.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L9) One option of a string select. ## Constructors ### Constructor > **new StringSelectMenuOptionBuilder**(): `StringSelectMenuOptionBuilder` #### Returns `StringSelectMenuOptionBuilder` ## Properties ### description? > `optional` **description?**: `string` Defined in: [sdk/js/src/builders/select.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L12) *** ### emoji? > `optional` **emoji?**: `string` Defined in: [sdk/js/src/builders/select.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L13) *** ### isDefault > **isDefault**: `boolean` = `false` Defined in: [sdk/js/src/builders/select.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L14) *** ### label > **label**: `string` = `''` Defined in: [sdk/js/src/builders/select.ts:10](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L10) *** ### value > **value**: `string` = `''` Defined in: [sdk/js/src/builders/select.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L11) ## Methods ### setDefault() > **setDefault**(`isDefault?`): `this` Defined in: [sdk/js/src/builders/select.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L32) #### Parameters ##### isDefault? `boolean` = `true` #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/select.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L24) #### Parameters ##### description `string` #### Returns `this` *** ### setEmoji() > **setEmoji**(`value`): `this` Defined in: [sdk/js/src/builders/select.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L28) #### Parameters ##### value `string` #### Returns `this` *** ### setLabel() > **setLabel**(`label`): `this` Defined in: [sdk/js/src/builders/select.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L16) #### Parameters ##### label `string` #### Returns `this` *** ### setValue() > **setValue**(`value`): `this` Defined in: [sdk/js/src/builders/select.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L20) #### Parameters ##### value `string` #### Returns `this` *** ### toWit() > **toWit**(): `SelectOption` Defined in: [sdk/js/src/builders/select.ts:36](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L36) #### Returns `SelectOption` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/textdisplaybuilder/ --- # TextDisplayBuilder Defined in: [sdk/js/src/builders/layout.ts:10](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L10) Type 10: Markdown text. ## Constructors ### Constructor > **new TextDisplayBuilder**(): `TextDisplayBuilder` #### Returns `TextDisplayBuilder` ## Properties ### content > **content**: `string` = `''` Defined in: [sdk/js/src/builders/layout.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L11) ## Methods ### setContent() > **setContent**(`content`): `this` Defined in: [sdk/js/src/builders/layout.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L12) #### Parameters ##### content `string` #### Returns `this` *** ### toWit() > **toWit**(): `TextDisplay` Defined in: [sdk/js/src/builders/layout.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L16) #### Returns `TextDisplay` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/textinputbuilder/ --- # TextInputBuilder Defined in: [sdk/js/src/builders/text-input.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L13) Type 4. Put it in a [LabelBuilder](/docs/reference/js/zaun-bot/classes/labelbuilder/) (or pass it to `ModalBuilder.addTextInput`). ## Constructors ### Constructor > **new TextInputBuilder**(): `TextInputBuilder` #### Returns `TextInputBuilder` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/text-input.ts:50](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L50) ##### Returns `string` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/text-input.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L22) #### Parameters ##### id `string` #### Returns `this` *** ### setMaxLength() > **setMaxLength**(`n`): `this` Defined in: [sdk/js/src/builders/text-input.ts:34](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L34) #### Parameters ##### n `number` #### Returns `this` *** ### setMinLength() > **setMinLength**(`n`): `this` Defined in: [sdk/js/src/builders/text-input.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L30) #### Parameters ##### n `number` #### Returns `this` *** ### setPlaceholder() > **setPlaceholder**(`placeholder`): `this` Defined in: [sdk/js/src/builders/text-input.ts:46](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L46) #### Parameters ##### placeholder `string` #### Returns `this` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/text-input.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L38) #### Parameters ##### required? `boolean` = `true` #### Returns `this` *** ### setStyle() > **setStyle**(`style`): `this` Defined in: [sdk/js/src/builders/text-input.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L26) #### Parameters ##### style [`TextInputStyle`](/docs/reference/js/zaun-bot/type-aliases/textinputstyle/) #### Returns `this` *** ### setValue() > **setValue**(`value`): `this` Defined in: [sdk/js/src/builders/text-input.ts:42](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L42) #### Parameters ##### value `string` #### Returns `this` *** ### toWit() > **toWit**(): `TextInput` Defined in: [sdk/js/src/builders/text-input.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L53) #### Returns `TextInput` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/thumbnailbuilder/ --- # ThumbnailBuilder Defined in: [sdk/js/src/builders/layout.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L23) Type 11: a small picture, an image attachment of the same message. ## Constructors ### Constructor > **new ThumbnailBuilder**(): `ThumbnailBuilder` #### Returns `ThumbnailBuilder` ## Methods ### setDescription() > **setDescription**(`description`): `this` Defined in: [sdk/js/src/builders/layout.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L31) #### Parameters ##### description `string` #### Returns `this` *** ### setMedia() > **setMedia**(`attachmentId`): `this` Defined in: [sdk/js/src/builders/layout.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L27) #### Parameters ##### attachmentId `string` #### Returns `this` *** ### setSpoiler() > **setSpoiler**(`spoiler?`): `this` Defined in: [sdk/js/src/builders/layout.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L35) #### Parameters ##### spoiler? `boolean` = `true` #### Returns `this` *** ### toWit() > **toWit**(): `Thumbnail` Defined in: [sdk/js/src/builders/layout.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L39) #### Returns `Thumbnail` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/usercontextmenucommandinteraction/ --- # UserContextMenuCommandInteraction Defined in: [sdk/js/src/interactions/command.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L41) A user context-menu command. ## Extends - `CommandInteraction` ## Constructors ### Constructor > **new UserContextMenuCommandInteraction**(`raw`, `data`): `UserContextMenuCommandInteraction` Defined in: [sdk/js/src/interactions/command.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L26) #### Parameters ##### raw `Interaction` ##### data `CommandData` #### Returns `UserContextMenuCommandInteraction` #### Inherited from `CommandInteraction.constructor` ## Properties ### appPermissions > `readonly` **appPermissions**: `bigint` Defined in: [sdk/js/src/interactions/base.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L20) The bot's effective permissions in the channel. #### Inherited from `CommandInteraction.appPermissions` *** ### botId > `readonly` **botId**: `string` Defined in: [sdk/js/src/interactions/base.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L15) The bot's id in this community. #### Inherited from `CommandInteraction.botId` *** ### channelId > `readonly` **channelId**: `string` Defined in: [sdk/js/src/interactions/base.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L16) #### Inherited from `CommandInteraction.channelId` *** ### command > `readonly` **command**: `CommandData` Defined in: [sdk/js/src/interactions/command.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L24) The WIT command data. #### Inherited from `CommandInteraction.command` *** ### commandId > `readonly` **commandId**: `string` Defined in: [sdk/js/src/interactions/command.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L20) #### Inherited from `CommandInteraction.commandId` *** ### commandName > `readonly` **commandName**: `string` Defined in: [sdk/js/src/interactions/command.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L21) #### Inherited from `CommandInteraction.commandName` *** ### createdTimestamp > `readonly` **createdTimestamp**: `number` Defined in: [sdk/js/src/interactions/base.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L24) When the host received it, ms. #### Inherited from `CommandInteraction.createdTimestamp` *** ### deferred > **deferred**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L30) Whether the response was deferred. #### Inherited from `CommandInteraction.deferred` *** ### id > `readonly` **id**: `string` Defined in: [sdk/js/src/interactions/base.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L13) The interaction id. #### Inherited from `CommandInteraction.id` *** ### locale > `readonly` **locale**: `string` Defined in: [sdk/js/src/interactions/base.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L22) The invoker's locale (BCP 47), if their client sent one. #### Inherited from `CommandInteraction.locale` *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/base.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L18) Who triggered it: `interaction.member.send(...)` sends them a DM. #### Inherited from `CommandInteraction.member` *** ### options > `readonly` **options**: [`CommandInteractionOptionResolver`](/docs/reference/js/zaun-bot/classes/commandinteractionoptionresolver/) Defined in: [sdk/js/src/interactions/command.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L22) #### Inherited from `CommandInteraction.options` *** ### raw > `readonly` **raw**: `Interaction` Defined in: [sdk/js/src/interactions/base.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L26) The WIT interaction, for anything the classes do not expose. #### Inherited from `CommandInteraction.raw` *** ### replied > **replied**: `boolean` = `false` Defined in: [sdk/js/src/interactions/base.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L28) Whether an initial response was sent. #### Inherited from `CommandInteraction.replied` ## Accessors ### targetId #### Get Signature > **get** **targetId**(): `string` Defined in: [sdk/js/src/interactions/command.ts:45](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L45) The member acted on. ##### Returns `string` *** ### targetMember #### Get Signature > **get** **targetMember**(): [`Member`](/docs/reference/js/zaun-bot/classes/member/) Defined in: [sdk/js/src/interactions/command.ts:48](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L48) ##### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/) *** ### userId #### Get Signature > **get** **userId**(): `string` Defined in: [sdk/js/src/interactions/base.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L44) The invoker's member id. ##### Returns `string` #### Inherited from `CommandInteraction.userId` ## Methods ### deferReply() > **deferReply**(`options?`): `void` Defined in: [sdk/js/src/interactions/base.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L81) Shows "thinking…" and buys 15 minutes; finish with [editReply](/docs/reference/js/zaun-bot/classes/repliableinteraction/#editreply). #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `void` #### Inherited from `CommandInteraction.deferReply` *** ### deleteReply() > **deleteReply**(): `void` Defined in: [sdk/js/src/interactions/base.ts:92](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L92) Deletes the original response. #### Returns `void` #### Inherited from `CommandInteraction.deleteReply` *** ### editReply() > **editReply**(`payload`): `void` Defined in: [sdk/js/src/interactions/base.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L87) Replaces the original response (ends a deferred reply). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` #### Inherited from `CommandInteraction.editReply` *** ### followUp() > **followUp**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:97](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L97) Another message, within 15 minutes (at most 10). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from `CommandInteraction.followUp` *** ### isAnySelectMenu() > **isAnySelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L67) #### Returns `boolean` #### Inherited from `CommandInteraction.isAnySelectMenu` *** ### isAutocomplete() > **isAutocomplete**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L69) #### Returns `boolean` #### Inherited from `CommandInteraction.isAutocomplete` *** ### isButton() > **isButton**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L61) #### Returns `boolean` #### Inherited from `CommandInteraction.isButton` *** ### isChannelSelectMenu() > **isChannelSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L66) #### Returns `boolean` #### Inherited from `CommandInteraction.isChannelSelectMenu` *** ### isChatInputCommand() > **isChatInputCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L55) #### Returns `boolean` #### Inherited from `CommandInteraction.isChatInputCommand` *** ### isCommand() > **isCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L59) #### Returns `boolean` #### Inherited from `CommandInteraction.isCommand` *** ### isContextMenuCommand() > **isContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/command.ts:42](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L42) #### Returns `boolean` #### Overrides `CommandInteraction.isContextMenuCommand` *** ### isMentionableSelectMenu() > **isMentionableSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L65) #### Returns `boolean` #### Inherited from `CommandInteraction.isMentionableSelectMenu` *** ### isMessageComponent() > **isMessageComponent**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:60](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L60) #### Returns `boolean` #### Inherited from `CommandInteraction.isMessageComponent` *** ### isMessageContextMenuCommand() > **isMessageContextMenuCommand**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:58](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L58) #### Returns `boolean` #### Inherited from `CommandInteraction.isMessageContextMenuCommand` *** ### isModalSubmit() > **isModalSubmit**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L68) #### Returns `boolean` #### Inherited from `CommandInteraction.isModalSubmit` *** ### isRepliable() > **isRepliable**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L70) #### Returns `boolean` #### Inherited from `CommandInteraction.isRepliable` *** ### isRoleSelectMenu() > **isRoleSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L64) #### Returns `boolean` #### Inherited from `CommandInteraction.isRoleSelectMenu` *** ### isStringSelectMenu() > **isStringSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:62](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L62) #### Returns `boolean` #### Inherited from `CommandInteraction.isStringSelectMenu` *** ### isUserContextMenuCommand() > **isUserContextMenuCommand**(): `this is UserContextMenuCommandInteraction` Defined in: [sdk/js/src/interactions/command.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L43) #### Returns `this is UserContextMenuCommandInteraction` #### Overrides `CommandInteraction.isUserContextMenuCommand` *** ### isUserSelectMenu() > **isUserSelectMenu**(): `boolean` Defined in: [sdk/js/src/interactions/base.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L63) #### Returns `boolean` #### Inherited from `CommandInteraction.isUserSelectMenu` *** ### reply() > **reply**(`payload`): `string` Defined in: [sdk/js/src/interactions/base.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L76) Answers with a message in the channel (or only to the invoker with `ephemeral`). #### Parameters ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `string` #### Inherited from `CommandInteraction.reply` *** ### showModal() > **showModal**(`modal`): `void` Defined in: [sdk/js/src/interactions/base.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/base.ts#L105) Opens a modal for the invoker. #### Parameters ##### modal [`ModalBuilder`](/docs/reference/js/zaun-bot/classes/modalbuilder/) #### Returns `void` #### Inherited from `CommandInteraction.showModal` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/userselectmenubuilder/ --- # UserSelectMenuBuilder Defined in: [sdk/js/src/builders/select.ts:135](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L135) Type 5: members. ## Extends - `EntitySelectBuilder` ## Constructors ### Constructor > **new UserSelectMenuBuilder**(): `UserSelectMenuBuilder` #### Returns `UserSelectMenuBuilder` #### Inherited from `EntitySelectBuilder.constructor` ## Accessors ### customId #### Get Signature > **get** **customId**(): `string` Defined in: [sdk/js/src/builders/select.ts:78](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L78) ##### Returns `string` #### Inherited from `EntitySelectBuilder.customId` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [sdk/js/src/builders/select.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L53) #### Parameters ##### id `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setCustomId` *** ### setDefaultUsers() > **setDefaultUsers**(...`ids`): `this` Defined in: [sdk/js/src/builders/select.ts:137](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L137) #### Parameters ##### ids ...`string`[] #### Returns `this` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [sdk/js/src/builders/select.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L74) #### Parameters ##### disabled? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setDisabled` *** ### setMaxValues() > **setMaxValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L65) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMaxValues` *** ### setMinValues() > **setMinValues**(`n`): `this` Defined in: [sdk/js/src/builders/select.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L61) #### Parameters ##### n `number` #### Returns `this` #### Inherited from `EntitySelectBuilder.setMinValues` *** ### setPlaceholder() > **setPlaceholder**(`placeholder`): `this` Defined in: [sdk/js/src/builders/select.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L57) #### Parameters ##### placeholder `string` #### Returns `this` #### Inherited from `EntitySelectBuilder.setPlaceholder` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [sdk/js/src/builders/select.ts:70](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L70) In a modal: whether an answer is needed (default true). #### Parameters ##### required? `boolean` = `true` #### Returns `this` #### Inherited from `EntitySelectBuilder.setRequired` *** ### toWit() > **toWit**(): `EntitySelect` Defined in: [sdk/js/src/builders/select.ts:124](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/select.ts#L124) #### Returns `EntitySelect` #### Inherited from `EntitySelectBuilder.toWit` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/zaunerror/ --- # ZaunError Defined in: [sdk/js/src/errors.ts:6](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L6) The host refused a call (`FORBIDDEN`, `NOT_FOUND`, `RATE_LIMITED`, `NOT_GRANTED`, …). ## Extends - `Error` ## Extended by - [`HttpError`](/docs/reference/js/zaun-bot/classes/httperror/) ## Constructors ### Constructor > **new ZaunError**(`code`, `detail?`, `retryAfterMs?`): `ZaunError` Defined in: [sdk/js/src/errors.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L14) #### Parameters ##### code `string` ##### detail? `string` ##### retryAfterMs? `number` #### Returns `ZaunError` #### Overrides `Error.constructor` ## Properties ### code > `readonly` **code**: `string` Defined in: [sdk/js/src/errors.ts:8](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L8) The protocol error code, or a runtime code such as `NOT_GRANTED`. *** ### detail > `readonly` **detail**: `string` Defined in: [sdk/js/src/errors.ts:10](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L10) The `reason` or `field` the host gave. *** ### retryAfterMs > `readonly` **retryAfterMs**: `number` Defined in: [sdk/js/src/errors.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L12) For `RATE_LIMITED` and `BUSY`: when to try again, in ms. ## Methods ### isUnsupported() > **isUnsupported**(): `boolean` Defined in: [sdk/js/src/errors.ts:27](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L27) Whether the host does not implement this call (or this case of it) yet: an older host, or a feature it lacks, such as volume without an Opus encoder. Fall back to what the bot did before; trying again will not help. #### Returns `boolean` *** ### from() > `static` **from**(`e`): `ZaunError` Defined in: [sdk/js/src/errors.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L32) From the WIT `host-error`. #### Parameters ##### e `HostError` #### Returns `ZaunError` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/classes/zaunvalidationerror/ --- # ZaunValidationError Defined in: [sdk/js/src/errors.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L39) A builder or message breaks a protocol limit; thrown before anything reaches the host. ## Extends - `Error` ## Constructors ### Constructor > **new ZaunValidationError**(`field`, `message`): `ZaunValidationError` Defined in: [sdk/js/src/errors.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L43) #### Parameters ##### field `string` ##### message `string` #### Returns `ZaunValidationError` #### Overrides `Error.constructor` ## Properties ### field > `readonly` **field**: `string` Defined in: [sdk/js/src/errors.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/errors.ts#L41) The field at fault, dotted (`components.custom_id`). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/haspermission/ --- # hasPermission > **hasPermission**(`bits`, `needed`): `boolean` Defined in: [sdk/js/src/permissions.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/permissions.ts#L43) Whether `bits` holds every bit of `needed`. ## Parameters ### bits `bigint` ### needed `bigint` ## Returns `boolean` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/interactionfromwit/ --- # interactionFromWit > **interactionFromWit**(`raw`): [`Interaction`](/docs/reference/js/zaun-bot/type-aliases/interaction/) Defined in: [sdk/js/src/interactions/index.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/index.ts#L23) The class for `raw`. ## Parameters ### raw `Interaction` ## Returns [`Interaction`](/docs/reference/js/zaun-bot/type-aliases/interaction/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/isid/ --- # isId > **isId**(`id`): `boolean` Defined in: [sdk/js/src/mention.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L31) Whether `id` is a well-formed Zaun id: 16 bytes in unpadded base64url. ## Parameters ### id `string` ## Returns `boolean` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/parsementions/ --- # parseMentions > **parseMentions**(`content`): `Mentions` Defined in: [sdk/js/src/mention.ts:45](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L45) The mentions `content` shows: `<@id>` (and the usual `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most 50 members and 20 roles; malformed ids are skipped. Use it only on text the bot wrote: on text from members it would mention whoever they named. ## Parameters ### content `string` ## Returns `Mentions` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/rolemention/ --- # roleMention > **roleMention**(`roleId`): `string` Defined in: [sdk/js/src/mention.ts:23](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L23) The text that shows a role mention: `<@&id>`. ## Parameters ### roleId `string` ## Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/setcommands/ --- # setCommands > **setCommands**(`commands`): `RegisteredCommand`[] Defined in: [sdk/js/src/api.ts:166](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L166) Replaces the bot's commands at run time (the ones from `bot.command` register at start). ## Parameters ### commands [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/)[] ## Returns `RegisteredCommand`[] --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/tobody/ --- # toBody > **toBody**(`payload`, `ephemeral?`): `MessageBody` Defined in: [sdk/js/src/message.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L65) The WIT `message-body` of a payload; `ephemeral` overrides the payload's own flag. ## Parameters ### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) ### ephemeral? `boolean` ## Returns `MessageBody` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/functions/usermention/ --- # userMention > **userMention**(`memberId`): `string` Defined in: [sdk/js/src/mention.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L15) The text that shows a member mention: `<@id>`. ## Parameters ### memberId `string` ## Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/audiostreamoptions/ --- # AudioStreamOptions Defined in: [sdk/js/src/audio.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/audio.ts#L16) ## Properties ### format > **format**: [`AudioFormat`](/docs/reference/js/zaun-bot/type-aliases/audioformat/) Defined in: [sdk/js/src/audio.ts:17](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/audio.ts#L17) *** ### lowWaterMs? > `optional` **lowWaterMs?**: `number` Defined in: [sdk/js/src/audio.ts:19](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/audio.ts#L19) `audioLow` fires when less than this is buffered, in ms (20–2000; default 200). *** ### title? > `optional` **title?**: `string` Defined in: [sdk/js/src/audio.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/audio.ts#L21) Shown as the current title while the stream plays. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/autocompletechoice/ --- # AutocompleteChoice Defined in: [sdk/js/src/interactions/command.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L12) A choice returned to autocomplete. ## Properties ### name > **name**: `string` Defined in: [sdk/js/src/interactions/command.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L13) *** ### nameLocalizations? > `optional` **nameLocalizations?**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/interactions/command.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L15) *** ### value > **value**: `string` \| `number` Defined in: [sdk/js/src/interactions/command.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/command.ts#L14) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/botevents/ --- # BotEvents Defined in: [sdk/js/src/events.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L20) Listener signatures by event name. Community events arrive only when the manifest's `events` names them (or their group: `messages`, `reactions`, `members`, `channels`, `roles`, `typing`, `presence`, `community`, `commands`, `dms`). ## Properties ### audioClose > **audioClose**: () => `unknown` Defined in: [sdk/js/src/events.ts:85](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L85) The `audio` stream closed (drained, closed at once, or the voice stay ended). #### Returns `unknown` *** ### audioLow > **audioLow**: (`bufferedMs`) => `unknown` Defined in: [sdk/js/src/events.ts:83](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L83) The `audio` stream's buffer fell below its low-water mark: write more (ms still buffered). #### Parameters ##### bufferedMs `number` #### Returns `unknown` *** ### channelCreate > **channelCreate**: `On`\<`Channel`\> Defined in: [sdk/js/src/events.ts:47](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L47) (`channels`) *** ### channelDelete > **channelDelete**: `On`\<`string`\> Defined in: [sdk/js/src/events.ts:49](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L49) *** ### channelUpdate > **channelUpdate**: `On`\<`Channel`\> Defined in: [sdk/js/src/events.ts:48](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L48) *** ### commandsUpdate > **commandsUpdate**: `On`\<`string`\> Defined in: [sdk/js/src/events.ts:61](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L61) (`commands`) A bot's command list changed: its bot id. *** ### communityUpdate > **communityUpdate**: `On`\<`CommunityProfile`\> Defined in: [sdk/js/src/events.ts:59](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L59) (`community`) *** ### config > **config**: (`config`, `bot`) => `unknown` Defined in: [sdk/js/src/events.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L24) The owner changed the configuration while the bot runs (no restart): every value. #### Parameters ##### config `ReadonlyMap`\<`string`, `string`\> ##### bot [`Bot`](/docs/reference/js/zaun-bot/classes/bot/) #### Returns `unknown` *** ### dmCreate > **dmCreate**: `On`\<`Channel`\> Defined in: [sdk/js/src/events.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L63) (`dms`) A DM with the bot opened, by the bot or a member. *** ### dmDelete > **dmDelete**: `On`\<`string`\> Defined in: [sdk/js/src/events.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L65) (`dms`) The bot closed a DM: its channel id. *** ### error > **error**: (`error`) => `unknown` Defined in: [sdk/js/src/events.ts:87](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L87) A handler threw or rejected. #### Parameters ##### error `Error` #### Returns `unknown` *** ### init > **init**: (`bot`) => `unknown` Defined in: [sdk/js/src/events.ts:22](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L22) The instance started (`init`), before its commands register. `bot.config` is set. #### Parameters ##### bot [`Bot`](/docs/reference/js/zaun-bot/classes/bot/) #### Returns `unknown` *** ### interactionCreate > **interactionCreate**: (`interaction`) => `unknown` Defined in: [sdk/js/src/events.ts:28](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L28) Any interaction, after its command/component/modal handler ran. (`interactionCreate`) #### Parameters ##### interaction [`Interaction`](/docs/reference/js/zaun-bot/type-aliases/interaction/) #### Returns `unknown` *** ### memberAdd > **memberAdd**: `On`\<[`Member`](/docs/reference/js/zaun-bot/classes/member/)\> Defined in: [sdk/js/src/events.ts:38](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L38) (`members`, capability `members`) *** ### memberRemove > **memberRemove**: `On`\<`string`\> Defined in: [sdk/js/src/events.ts:41](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L41) A member left, was kicked or banned: its id. *** ### memberRolesUpdate > **memberRolesUpdate**: `On`\<`MemberRoles`\> Defined in: [sdk/js/src/events.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L44) *** ### memberTimeout > **memberTimeout**: `On`\<`MemberTimeout`\> Defined in: [sdk/js/src/events.ts:45](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L45) *** ### memberUpdate > **memberUpdate**: `On`\<[`Member`](/docs/reference/js/zaun-bot/classes/member/)\> Defined in: [sdk/js/src/events.ts:39](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L39) *** ### messageCreate > **messageCreate**: `On`\<[`EventMessage`](/docs/reference/js/zaun-bot/type-aliases/eventmessage/)\> Defined in: [sdk/js/src/events.ts:30](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L30) (`messages`) Content follows the `message_content` capability; DMs arrive whole. *** ### messageDelete > **messageDelete**: `On`\<\{ `channelId`: `string`; `messageId`: `string`; \}\> Defined in: [sdk/js/src/events.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L32) *** ### messageDeleteBulk > **messageDeleteBulk**: `On`\<\{ `channelId`: `string`; `messageIds`: `string`[]; \}\> Defined in: [sdk/js/src/events.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L33) *** ### messageReactionAdd > **messageReactionAdd**: `On`\<`Reaction`\> Defined in: [sdk/js/src/events.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L35) (`reactions`) *** ### messageReactionRemove > **messageReactionRemove**: `On`\<`Reaction`\> Defined in: [sdk/js/src/events.ts:36](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L36) *** ### messageUpdate > **messageUpdate**: `On`\<[`EventMessage`](/docs/reference/js/zaun-bot/type-aliases/eventmessage/)\> Defined in: [sdk/js/src/events.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L31) *** ### presenceUpdate > **presenceUpdate**: `On`\<`Presence`\> Defined in: [sdk/js/src/events.ts:57](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L57) (`presence`, capability `presence`) *** ### queueEnd > **queueEnd**: () => `unknown` Defined in: [sdk/js/src/events.ts:81](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L81) The last track played out with nothing queued (not after `stop` or `leave`). #### Returns `unknown` *** ### raw > **raw**: `On`\<\{ `json`: `string`; `kind`: `string`; \}\> Defined in: [sdk/js/src/events.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L67) An event without a typed form: its type and JSON body. (`raw`) *** ### ready > **ready**: `On`\<[`Me`](/docs/reference/js/zaun-bot/interfaces/me/)\> Defined in: [sdk/js/src/events.ts:26](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L26) The bot's connection is up: who it is. (`ready`) *** ### removed > **removed**: `On`\<`string`\> Defined in: [sdk/js/src/events.ts:43](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L43) This bot was removed (kicked or banned): the reason. *** ### roleCreate > **roleCreate**: `On`\<`Role`\> Defined in: [sdk/js/src/events.ts:51](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L51) (`roles`) *** ### roleDelete > **roleDelete**: `On`\<`string`\> Defined in: [sdk/js/src/events.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L53) *** ### roleUpdate > **roleUpdate**: `On`\<`Role`\> Defined in: [sdk/js/src/events.ts:52](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L52) *** ### timer > **timer**: (`timer`) => `unknown` Defined in: [sdk/js/src/events.ts:69](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L69) A timer from `bot.timers` fired. #### Parameters ##### timer ###### id `number` ###### tag `string` #### Returns `unknown` *** ### trackEnd > **trackEnd**: (`title`) => `unknown` Defined in: [sdk/js/src/events.ts:73](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L73) #### Parameters ##### title `string` #### Returns `unknown` *** ### trackError > **trackError**: (`error`) => `unknown` Defined in: [sdk/js/src/events.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L75) A track could not be read (the text names no URL). #### Parameters ##### error `string` #### Returns `unknown` *** ### trackStart > **trackStart**: (`title`) => `unknown` Defined in: [sdk/js/src/events.ts:72](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L72) #### Parameters ##### title `string` #### Returns `unknown` *** ### typingStart > **typingStart**: `On`\<`Typing`\> Defined in: [sdk/js/src/events.ts:55](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L55) (`typing`) *** ### voiceEnd > **voiceEnd**: (`reason`) => `unknown` Defined in: [sdk/js/src/events.ts:79](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L79) The bot's voice stay ended (left, moved, disconnected). #### Parameters ##### reason `string` #### Returns `unknown` *** ### voiceEvent > **voiceEvent**: (`event`) => `unknown` Defined in: [sdk/js/src/events.ts:71](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L71) Voice: anything from the bot's stay or player (the WIT event). #### Parameters ##### event `VoiceEvent` #### Returns `unknown` *** ### voiceMemberJoin > **voiceMemberJoin**: (`memberId`) => `unknown` Defined in: [sdk/js/src/events.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L76) #### Parameters ##### memberId `string` #### Returns `unknown` *** ### voiceMemberLeave > **voiceMemberLeave**: (`memberId`) => `unknown` Defined in: [sdk/js/src/events.ts:77](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/events.ts#L77) #### Parameters ##### memberId `string` #### Returns `unknown` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/command/ --- # Command Defined in: [sdk/js/src/bot.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L31) A registered command. ## Properties ### autocomplete? > `optional` **autocomplete?**: (`i`) => `unknown` Defined in: [sdk/js/src/bot.ts:34](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L34) #### Parameters ##### i [`AutocompleteInteraction`](/docs/reference/js/zaun-bot/classes/autocompleteinteraction/) #### Returns `unknown` *** ### data > **data**: [`CommandLike`](/docs/reference/js/zaun-bot/interfaces/commandlike/) Defined in: [sdk/js/src/bot.ts:32](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L32) *** ### execute? > `optional` **execute?**: (`i`) => `unknown` Defined in: [sdk/js/src/bot.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/bot.ts#L33) #### Parameters ##### i [`ChatInputCommandInteraction`](/docs/reference/js/zaun-bot/classes/chatinputcommandinteraction/) \| [`UserContextMenuCommandInteraction`](/docs/reference/js/zaun-bot/classes/usercontextmenucommandinteraction/) \| [`MessageContextMenuCommandInteraction`](/docs/reference/js/zaun-bot/classes/messagecontextmenucommandinteraction/) #### Returns `unknown` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/commandlike/ --- # CommandLike Defined in: [sdk/js/src/builders/command.ts:111](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L111) Anything that becomes an application command. ## Properties ### name > `readonly` **name**: `string` Defined in: [sdk/js/src/builders/command.ts:112](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L112) ## Methods ### toWit() > **toWit**(): `ApplicationCommand` Defined in: [sdk/js/src/builders/command.ts:113](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L113) #### Returns `ApplicationCommand` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/embeddata/ --- # EmbedData Defined in: [sdk/js/src/builders/embed.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L9) The data `EmbedBuilder` holds. ## Properties ### author? > `optional` **author?**: `object` Defined in: [sdk/js/src/builders/embed.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L15) #### iconAttachment? > `optional` **iconAttachment?**: `string` #### name > **name**: `string` #### url? > `optional` **url?**: `string` *** ### color? > `optional` **color?**: `number` Defined in: [sdk/js/src/builders/embed.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L13) *** ### description? > `optional` **description?**: `string` Defined in: [sdk/js/src/builders/embed.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L11) *** ### fields? > `optional` **fields?**: `object`[] Defined in: [sdk/js/src/builders/embed.ts:19](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L19) #### inline? > `optional` **inline?**: `boolean` #### name > **name**: `string` #### value > **value**: `string` *** ### footer? > `optional` **footer?**: `object` Defined in: [sdk/js/src/builders/embed.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L16) #### iconAttachment? > `optional` **iconAttachment?**: `string` #### text > **text**: `string` *** ### imageAttachment? > `optional` **imageAttachment?**: `string` Defined in: [sdk/js/src/builders/embed.ts:17](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L17) *** ### thumbnailAttachment? > `optional` **thumbnailAttachment?**: `string` Defined in: [sdk/js/src/builders/embed.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L18) *** ### timestamp? > `optional` **timestamp?**: `number` Defined in: [sdk/js/src/builders/embed.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L14) *** ### title? > `optional` **title?**: `string` Defined in: [sdk/js/src/builders/embed.ts:10](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L10) *** ### url? > `optional` **url?**: `string` Defined in: [sdk/js/src/builders/embed.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/embed.ts#L12) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/httpresponse/ --- # HttpResponse Defined in: [sdk/js/src/api.ts:100](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L100) An HTTPS response. ## Properties ### body > **body**: `Uint8Array` Defined in: [sdk/js/src/api.ts:103](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L103) *** ### headers > **headers**: `Record`\<`string`, `string`\> Defined in: [sdk/js/src/api.ts:102](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L102) *** ### status > **status**: `number` Defined in: [sdk/js/src/api.ts:101](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L101) ## Methods ### json() > **json**\<`T`\>(): `T` Defined in: [sdk/js/src/api.ts:105](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L105) #### Type Parameters ##### T `T` = `unknown` #### Returns `T` *** ### text() > **text**(): `string` Defined in: [sdk/js/src/api.ts:104](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L104) #### Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/me/ --- # Me Defined in: [sdk/js/src/context.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L11) Who the bot is in its community, from the host's `ready` event. ## Properties ### botId > **botId**: `string` Defined in: [sdk/js/src/context.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L13) The installation. *** ### communityId > **communityId**: `string` Defined in: [sdk/js/src/context.ts:17](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L17) The community it runs for. *** ### memberId > **memberId**: `string` Defined in: [sdk/js/src/context.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L15) The bot's own member. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/mediagalleryitem/ --- # MediaGalleryItem Defined in: [sdk/js/src/builders/layout.ts:73](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L73) One picture of a gallery. ## Properties ### description? > `optional` **description?**: `string` Defined in: [sdk/js/src/builders/layout.ts:75](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L75) *** ### media > **media**: `string` Defined in: [sdk/js/src/builders/layout.ts:74](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L74) *** ### spoiler? > `optional` **spoiler?**: `boolean` Defined in: [sdk/js/src/builders/layout.ts:76](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L76) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/interfaces/messageoptions/ --- # MessageOptions Defined in: [sdk/js/src/message.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L13) A message to send. ## Properties ### attachments? > `optional` **attachments?**: `string`[] Defined in: [sdk/js/src/message.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L18) Attachment ids from `bot.messages.upload` (or `files` uploaded for you by `send`). *** ### components? > `optional` **components?**: [`TopLevelComponent`](/docs/reference/js/zaun-bot/type-aliases/toplevelcomponent/)[] Defined in: [sdk/js/src/message.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L16) *** ### componentsV2? > `optional` **componentsV2?**: `boolean` Defined in: [sdk/js/src/message.ts:40](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L40) Lay the message out with Components V2 (content and embeds must be empty). Set automatically when a component other than an action row is used. *** ### content? > `optional` **content?**: `string` Defined in: [sdk/js/src/message.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L14) *** ### embeds? > `optional` **embeds?**: ([`EmbedBuilder`](/docs/reference/js/zaun-bot/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-bot/interfaces/embeddata/))[] Defined in: [sdk/js/src/message.ts:15](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L15) *** ### ephemeral? > `optional` **ephemeral?**: `boolean` Defined in: [sdk/js/src/message.ts:31](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L31) Only the invoker sees it (interaction replies and follow-ups only). *** ### mentions? > `optional` **mentions?**: `object` Defined in: [sdk/js/src/message.ts:24](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L24) Who is notified (each id once; ≤ 50 members, ≤ 20 roles). Zaun names mentions explicitly: the content only shows them (`userMention(id)`, `roleMention(id)`). On an edit, absent leaves the mentions as they were, and `{}` clears them. #### everyone? > `optional` **everyone?**: `boolean` #### members? > `optional` **members?**: `string`[] #### roles? > `optional` **roles?**: `string`[] *** ### mentionsFromContent? > `optional` **mentionsFromContent?**: `boolean` Defined in: [sdk/js/src/message.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L29) Also notify whoever `content` shows (`<@id>`, `<@&id>`, `@everyone`; see `parseMentions`). Only for text the bot wrote, never for text a member gave it. *** ### silent? > `optional` **silent?**: `boolean` Defined in: [sdk/js/src/message.ts:33](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L33) Mentions do not notify. *** ### suppressEmbeds? > `optional` **suppressEmbeds?**: `boolean` Defined in: [sdk/js/src/message.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L35) Embeds are not shown. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/applicationcommandoptiontype/ --- # ApplicationCommandOptionType > **ApplicationCommandOptionType** = *typeof* [`ApplicationCommandOptionType`](/docs/reference/js/zaun-bot/variables/applicationcommandoptiontype/)\[keyof *typeof* [`ApplicationCommandOptionType`](/docs/reference/js/zaun-bot/variables/applicationcommandoptiontype/)\] Defined in: [sdk/js/src/builders/options.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L9) Option types (standard numbers; 1 and 2 are sub-commands and groups). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/applicationcommandtype/ --- # ApplicationCommandType > **ApplicationCommandType** = *typeof* [`ApplicationCommandType`](/docs/reference/js/zaun-bot/variables/applicationcommandtype/)\[keyof *typeof* [`ApplicationCommandType`](/docs/reference/js/zaun-bot/variables/applicationcommandtype/)\] Defined in: [sdk/js/src/builders/command.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L12) Command types (standard numbers). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/audioformat/ --- # AudioFormat > **AudioFormat** = `"opus"` \| \{ `pcm`: \{ `channels`: `1` \| `2`; `sampleRate`: `8000` \| `12000` \| `16000` \| `24000` \| `48000`; \}; \} Defined in: [sdk/js/src/audio.ts:14](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/audio.ts#L14) `'opus'` packets the bot encodes, or 16-bit PCM the host encodes (needs an Opus encoder). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/buttoninteraction/ --- # ButtonInteraction > **ButtonInteraction** = [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) Defined in: [sdk/js/src/interactions/component.ts:63](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L63) Type guards for narrowing. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/buttonstyle/ --- # ButtonStyle > **ButtonStyle** = *typeof* [`ButtonStyle`](/docs/reference/js/zaun-bot/variables/buttonstyle/)\[keyof *typeof* [`ButtonStyle`](/docs/reference/js/zaun-bot/variables/buttonstyle/)\] Defined in: [sdk/js/src/builders/button.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L9) Button styles (standard numbers; premium 6 is not supported). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/channelselectmenuinteraction/ --- # ChannelSelectMenuInteraction > **ChannelSelectMenuInteraction** = [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) Defined in: [sdk/js/src/interactions/component.ts:68](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L68) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/containercomponent/ --- # ContainerComponent > **ContainerComponent** = [`ActionRowBuilder`](/docs/reference/js/zaun-bot/classes/actionrowbuilder/) \| [`TextDisplayBuilder`](/docs/reference/js/zaun-bot/classes/textdisplaybuilder/) \| [`SectionBuilder`](/docs/reference/js/zaun-bot/classes/sectionbuilder/) \| [`MediaGalleryBuilder`](/docs/reference/js/zaun-bot/classes/mediagallerybuilder/) \| [`FileBuilder`](/docs/reference/js/zaun-bot/classes/filebuilder/) \| [`SeparatorBuilder`](/docs/reference/js/zaun-bot/classes/separatorbuilder/) Defined in: [sdk/js/src/builders/layout.ts:136](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L136) What a container (and a V2 message) may hold. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/eventmessage/ --- # EventMessage > **EventMessage** = [`Message`](/docs/reference/js/zaun-bot/classes/message/) & `object` Defined in: [sdk/js/src/context.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/context.ts#L21) A message as events deliver it, with whether it is in a DM with the bot. ## Type Declaration ### isDM > `readonly` **isDM**: `boolean` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/interaction/ --- # Interaction > **Interaction** = [`ChatInputCommandInteraction`](/docs/reference/js/zaun-bot/classes/chatinputcommandinteraction/) \| [`UserContextMenuCommandInteraction`](/docs/reference/js/zaun-bot/classes/usercontextmenucommandinteraction/) \| [`MessageContextMenuCommandInteraction`](/docs/reference/js/zaun-bot/classes/messagecontextmenucommandinteraction/) \| [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) \| [`ModalSubmitInteraction`](/docs/reference/js/zaun-bot/classes/modalsubmitinteraction/) \| [`AutocompleteInteraction`](/docs/reference/js/zaun-bot/classes/autocompleteinteraction/) Defined in: [sdk/js/src/interactions/index.ts:18](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/index.ts#L18) Any interaction a bot can receive. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/labelcomponent/ --- # LabelComponent > **LabelComponent** = [`TextInputBuilder`](/docs/reference/js/zaun-bot/classes/textinputbuilder/) \| `Exclude`\<[`RowComponent`](/docs/reference/js/zaun-bot/type-aliases/rowcomponent/), [`ButtonBuilder`](/docs/reference/js/zaun-bot/classes/buttonbuilder/)\> \| [`FileUploadBuilder`](/docs/reference/js/zaun-bot/classes/fileuploadbuilder/) \| [`RadioGroupBuilder`](/docs/reference/js/zaun-bot/classes/radiogroupbuilder/) \| [`CheckboxGroupBuilder`](/docs/reference/js/zaun-bot/classes/checkboxgroupbuilder/) \| [`CheckboxBuilder`](/docs/reference/js/zaun-bot/classes/checkboxbuilder/) Defined in: [sdk/js/src/builders/modal.ts:16](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/modal.ts#L16) What a label may hold. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/loopmode/ --- # LoopMode > **LoopMode** = `w.voiceTypes.LoopMode` Defined in: [sdk/js/src/voice.ts:25](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/voice.ts#L25) What happens when a track ends: `'off'`, `'track'` (repeat it) or `'queue'` (requeue it). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/mentionableselectmenuinteraction/ --- # MentionableSelectMenuInteraction > **MentionableSelectMenuInteraction** = [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) Defined in: [sdk/js/src/interactions/component.ts:67](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L67) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/messagepayload/ --- # MessagePayload > **MessagePayload** = `string` \| [`MessageOptions`](/docs/reference/js/zaun-bot/interfaces/messageoptions/) \| [`EmbedBuilder`](/docs/reference/js/zaun-bot/classes/embedbuilder/) Defined in: [sdk/js/src/message.ts:44](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/message.ts#L44) Anything `reply`, `send`, `followUp` and friends accept. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/presencestatus/ --- # PresenceStatus > **PresenceStatus** = `"online"` \| `"idle"` \| `"dnd"` \| `"invisible"` Defined in: [sdk/js/src/presence.ts:21](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L21) `online`, `idle`, `dnd`, or `invisible` (looks offline to everyone). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/roleselectmenuinteraction/ --- # RoleSelectMenuInteraction > **RoleSelectMenuInteraction** = [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) Defined in: [sdk/js/src/interactions/component.ts:66](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L66) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/rowcomponent/ --- # RowComponent > **RowComponent** = [`ButtonBuilder`](/docs/reference/js/zaun-bot/classes/buttonbuilder/) \| [`StringSelectMenuBuilder`](/docs/reference/js/zaun-bot/classes/stringselectmenubuilder/) \| [`UserSelectMenuBuilder`](/docs/reference/js/zaun-bot/classes/userselectmenubuilder/) \| [`RoleSelectMenuBuilder`](/docs/reference/js/zaun-bot/classes/roleselectmenubuilder/) \| [`MentionableSelectMenuBuilder`](/docs/reference/js/zaun-bot/classes/mentionableselectmenubuilder/) \| [`ChannelSelectMenuBuilder`](/docs/reference/js/zaun-bot/classes/channelselectmenubuilder/) Defined in: [sdk/js/src/builders/row.ts:13](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/row.ts#L13) What an action row may hold. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/separatorspacingsize/ --- # SeparatorSpacingSize > **SeparatorSpacingSize** = *typeof* [`SeparatorSpacingSize`](/docs/reference/js/zaun-bot/variables/separatorspacingsize/)\[keyof *typeof* [`SeparatorSpacingSize`](/docs/reference/js/zaun-bot/variables/separatorspacingsize/)\] Defined in: [sdk/js/src/builders/layout.ts:115](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L115) Separator spacing (standard numbers). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/stringselectmenuinteraction/ --- # StringSelectMenuInteraction > **StringSelectMenuInteraction** = [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) Defined in: [sdk/js/src/interactions/component.ts:64](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L64) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/textinputstyle/ --- # TextInputStyle > **TextInputStyle** = *typeof* [`TextInputStyle`](/docs/reference/js/zaun-bot/variables/textinputstyle/)\[keyof *typeof* [`TextInputStyle`](/docs/reference/js/zaun-bot/variables/textinputstyle/)\] Defined in: [sdk/js/src/builders/text-input.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L9) Text input styles (standard numbers). --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/toplevelcomponent/ --- # TopLevelComponent > **TopLevelComponent** = [`ContainerComponent`](/docs/reference/js/zaun-bot/type-aliases/containercomponent/) \| [`ContainerBuilder`](/docs/reference/js/zaun-bot/classes/containerbuilder/) Defined in: [sdk/js/src/builders/layout.ts:191](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L191) Any top-level message component. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/trackoptions/ --- # TrackOptions > **TrackOptions** = \{ `title?`: `string`; `url`: `string`; \} \| \{ `ogg`: `Uint8Array`; `title?`: `string`; \} \| \{ `pushed`: `true`; `title?`: `string`; \} Defined in: [sdk/js/src/voice.ts:11](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/voice.ts#L11) Something to play: an Ogg Opus or WebM Opus URL (WebM where the host demuxes it), `https://` on a `network` host or `http://`/`https://` on a `local_network` address (the host checks it); Ogg Opus bytes; or pushed Opus packets. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/userselectmenuinteraction/ --- # UserSelectMenuInteraction > **UserSelectMenuInteraction** = [`MessageComponentInteraction`](/docs/reference/js/zaun-bot/classes/messagecomponentinteraction/) Defined in: [sdk/js/src/interactions/component.ts:65](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L65) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/type-aliases/voicestate/ --- # VoiceState > **VoiceState** = `Omit`\<`w.voiceTypes.VoiceState`, `"positionMs"` \| `"durationMs"`\> & `object` Defined in: [sdk/js/src/voice.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/voice.ts#L20) Where the bot is and what it plays. `positionMs` and `durationMs` are numbers here (the WIT `u64`s, converted); `durationMs` is `undefined` for live streams and pushed audio. ## Type Declaration ### durationMs > **durationMs**: `number` \| `undefined` ### positionMs > **positionMs**: `number` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/applicationcommandoptiontype/ --- # ApplicationCommandOptionType > `const` **ApplicationCommandOptionType**: `object` Defined in: [sdk/js/src/builders/options.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/options.ts#L9) Option types (standard numbers; 1 and 2 are sub-commands and groups). ## Type Declaration ### Attachment > `readonly` **Attachment**: `11` = `11` ### Boolean > `readonly` **Boolean**: `5` = `5` ### Channel > `readonly` **Channel**: `7` = `7` ### Integer > `readonly` **Integer**: `4` = `4` ### Mentionable > `readonly` **Mentionable**: `9` = `9` ### Number > `readonly` **Number**: `10` = `10` ### Role > `readonly` **Role**: `8` = `8` ### String > `readonly` **String**: `3` = `3` ### Subcommand > `readonly` **Subcommand**: `1` = `1` ### SubcommandGroup > `readonly` **SubcommandGroup**: `2` = `2` ### User > `readonly` **User**: `6` = `6` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/applicationcommandtype/ --- # ApplicationCommandType > `const` **ApplicationCommandType**: `object` Defined in: [sdk/js/src/builders/command.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/command.ts#L12) Command types (standard numbers). ## Type Declaration ### ChatInput > `readonly` **ChatInput**: `1` = `1` ### Message > `readonly` **Message**: `3` = `3` ### User > `readonly` **User**: `2` = `2` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/audio/ --- # audio > `const` **audio**: `object` Defined in: [sdk/js/src/audio.ts:29](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/audio.ts#L29) The bot's audio output stream. Errors throw `ZaunError`. ## Type Declaration ### bufferedMs() > **bufferedMs**(): `number` The audio written and not yet played, in ms (0 without a stream). #### Returns `number` ### clear() > **clear**(): `void` Drops everything buffered at once; the stream stays open. #### Returns `void` ### close() > **close**(`drain?`): `void` Closes the stream, after the buffer has played (`drain`, the default) or at once. #### Parameters ##### drain? `boolean` = `true` #### Returns `void` ### open() > **open**(`options`): `void` Opens the stream, pausing the player. `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take (PCM without an encoder). #### Parameters ##### options [`AudioStreamOptions`](/docs/reference/js/zaun-bot/interfaces/audiostreamoptions/) #### Returns `void` ### writeOpus() > **writeOpus**(`packets`): `number` Opus packets (2.5–120 ms each, ≤ 1000 bytes); returns the ms buffered (`BUSY` past 3 s). #### Parameters ##### packets `Uint8Array`\<`ArrayBufferLike`\>[] #### Returns `number` ### writePcm() > **writePcm**(`samples`): `number` Interleaved samples, any count; returns the ms buffered (`BUSY` past 3 s). #### Parameters ##### samples `Int16Array` #### Returns `number` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/buttonstyle/ --- # ButtonStyle > `const` **ButtonStyle**: `object` Defined in: [sdk/js/src/builders/button.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/button.ts#L9) Button styles (standard numbers; premium 6 is not supported). ## Type Declaration ### Danger > `readonly` **Danger**: `4` = `4` ### Link > `readonly` **Link**: `5` = `5` ### Primary > `readonly` **Primary**: `1` = `1` ### Secondary > `readonly` **Secondary**: `2` = `2` ### Success > `readonly` **Success**: `3` = `3` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/community/ --- # community > `const` **community**: `object` Defined in: [sdk/js/src/api.ts:151](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L151) Reads and moderation, checked by the host against the bot's grants and permissions. ## Type Declaration ### addRole > **addRole**: (`memberId`, `roleId`) => `void` #### Parameters ##### memberId `string` ##### roleId `string` #### Returns `void` ### getChannel > **getChannel**: (`id`) => `Channel` #### Parameters ##### id `string` #### Returns `Channel` ### getMember > **getMember**: (`id`) => [`Member`](/docs/reference/js/zaun-bot/classes/member/) #### Parameters ##### id `string` #### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/) ### getRole > **getRole**: (`id`) => `Role` #### Parameters ##### id `string` #### Returns `Role` ### kick > **kick**: (`memberId`, `reason?`) => `void` #### Parameters ##### memberId `string` ##### reason? `string` #### Returns `void` ### listChannels > **listChannels**: () => `Channel`[] #### Returns `Channel`[] ### listMembers > **listMembers**: (`options`) => [`Member`](/docs/reference/js/zaun-bot/classes/member/)[] #### Parameters ##### options? ###### after? `string` ###### limit? `number` #### Returns [`Member`](/docs/reference/js/zaun-bot/classes/member/)[] ### listRoles > **listRoles**: () => `Role`[] #### Returns `Role`[] ### removeRole > **removeRole**: (`memberId`, `roleId`) => `void` #### Parameters ##### memberId `string` ##### roleId `string` #### Returns `void` ### timeout > **timeout**: (`memberId`, `until`, `reason?`) => `void` Times a member out until `until` (ms); `null` clears it. #### Parameters ##### memberId `string` ##### until `number` ##### reason? `string` #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/componenttype/ --- # ComponentType > `const` **ComponentType**: `object` Defined in: [sdk/js/src/interactions/component.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/interactions/component.ts#L9) Component types (standard numbers). ## Type Declaration ### ActionRow > `readonly` **ActionRow**: `1` = `1` ### Button > `readonly` **Button**: `2` = `2` ### ChannelSelect > `readonly` **ChannelSelect**: `8` = `8` ### Checkbox > `readonly` **Checkbox**: `23` = `23` ### CheckboxGroup > `readonly` **CheckboxGroup**: `22` = `22` ### Container > `readonly` **Container**: `17` = `17` ### File > `readonly` **File**: `13` = `13` ### FileUpload > `readonly` **FileUpload**: `19` = `19` ### Label > `readonly` **Label**: `18` = `18` ### MediaGallery > `readonly` **MediaGallery**: `12` = `12` ### MentionableSelect > `readonly` **MentionableSelect**: `7` = `7` ### RadioGroup > `readonly` **RadioGroup**: `21` = `21` ### RoleSelect > `readonly` **RoleSelect**: `6` = `6` ### Section > `readonly` **Section**: `9` = `9` ### Separator > `readonly` **Separator**: `14` = `14` ### StringSelect > `readonly` **StringSelect**: `3` = `3` ### TextDisplay > `readonly` **TextDisplay**: `10` = `10` ### TextInput > `readonly` **TextInput**: `4` = `4` ### Thumbnail > `readonly` **Thumbnail**: `11` = `11` ### UserSelect > `readonly` **UserSelect**: `5` = `5` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/dms/ --- # dms > `const` **dms**: `object` Defined in: [sdk/js/src/dms.ts:8](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/dms.ts#L8) The bot's DMs. A member can turn DMs from bots off; then `open` throws `FORBIDDEN`. ## Type Declaration ### close() > **close**(`channelId`): `void` Hides a DM from the bot's list. #### Parameters ##### channelId `string` #### Returns `void` ### listOpen() > **listOpen**(): `Channel`[] The DMs the bot has open. #### Returns `Channel`[] ### open() > **open**(`memberId`): `Channel` The DM with `memberId`, opened when there is none. #### Parameters ##### memberId `string` #### Returns `Channel` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/everyonemention/ --- # everyoneMention > `const` **everyoneMention**: `"@everyone"` = `'@everyone'` Defined in: [sdk/js/src/mention.ts:10](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L10) The text that shows `@everyone`. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/http/ --- # http > `const` **http**: `object` Defined in: [sdk/js/src/api.ts:121](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L121) HTTPS to hosts in the bot's `network` grant, and `http://` or `https://` to the exact `host:port` addresses of its `local_network` grant. The host makes the request and checks the URL; the SDK passes it through. ## Type Declaration ### fetch() > **fetch**(`url`, `init?`): [`HttpResponse`](/docs/reference/js/zaun-bot/interfaces/httpresponse/) #### Parameters ##### url `string` ##### init? ###### body? `string` \| `Uint8Array`\<`ArrayBufferLike`\> ###### headers? `Record`\<`string`, `string`\> ###### method? `string` ###### timeoutMs? `number` #### Returns [`HttpResponse`](/docs/reference/js/zaun-bot/interfaces/httpresponse/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/limits/ --- # Limits > `const` **Limits**: `object` Defined in: [sdk/js/src/limits.ts:2](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/limits.ts#L2) Protocol limits, checked by the builders before sending. ## Type Declaration ### autocompleteChoices > `readonly` **autocompleteChoices**: `25` = `25` ### buttonLabel > `readonly` **buttonLabel**: `80` = `80` ### buttonsPerRow > `readonly` **buttonsPerRow**: `5` = `5` ### chatInputCommands > `readonly` **chatInputCommands**: `100` = `100` ### checkboxOptions > `readonly` **checkboxOptions**: readonly \[`1`, `10`\] ### choices > `readonly` **choices**: `25` = `25` ### choiceText > `readonly` **choiceText**: `100` = `100` ### commandDescription > `readonly` **commandDescription**: `100` = `100` ### commandName > `readonly` **commandName**: `32` = `32` ### commandOptions > `readonly` **commandOptions**: `25` = `25` ### componentsTotal > `readonly` **componentsTotal**: `40` = `40` ### contextMenuCommands > `readonly` **contextMenuCommands**: `15` = `15` ### customId > `readonly` **customId**: `100` = `100` ### embedAuthor > `readonly` **embedAuthor**: `256` = `256` ### embedDescription > `readonly` **embedDescription**: `4096` = `4096` ### embedFieldName > `readonly` **embedFieldName**: `256` = `256` ### embedFields > `readonly` **embedFields**: `25` = `25` ### embedFieldValue > `readonly` **embedFieldValue**: `1024` = `1024` ### embedFooter > `readonly` **embedFooter**: `2048` = `2048` ### embeds > `readonly` **embeds**: `10` = `10` ### embedTitle > `readonly` **embedTitle**: `256` = `256` ### embedTotal > `readonly` **embedTotal**: `6000` = `6000` ### fileUploads > `readonly` **fileUploads**: `10` = `10` ### followups > `readonly` **followups**: `10` = `10` ### labelDescription > `readonly` **labelDescription**: `100` = `100` ### labelText > `readonly` **labelText**: `45` = `45` ### mediaDescription > `readonly` **mediaDescription**: `1024` = `1024` ### mediaGalleryItems > `readonly` **mediaGalleryItems**: `10` = `10` ### messageContent > `readonly` **messageContent**: `4000` = `4000` ### modalItems > `readonly` **modalItems**: `5` = `5` ### modalTitle > `readonly` **modalTitle**: `45` = `45` ### optionLength > `readonly` **optionLength**: `6000` = `6000` ### radioOptions > `readonly` **radioOptions**: readonly \[`2`, `10`\] ### rows > `readonly` **rows**: `5` = `5` ### sectionTexts > `readonly` **sectionTexts**: `3` = `3` ### selectOptions > `readonly` **selectOptions**: `25` = `25` ### selectOptionText > `readonly` **selectOptionText**: `100` = `100` ### selectPlaceholder > `readonly` **selectPlaceholder**: `150` = `150` ### textDisplayTotal > `readonly` **textDisplayTotal**: `4000` = `4000` ### textInput > `readonly` **textInput**: `4000` = `4000` ### textInputPlaceholder > `readonly` **textInputPlaceholder**: `100` = `100` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/log/ --- # log > `const` **log**: `Record`\<`"trace"` \| `"debug"` \| `"info"` \| `"warn"` \| `"error"`, (...`args`) => `void`\> Defined in: [sdk/js/src/api.ts:148](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L148) Lines for the operator (`zaun-host bot logs`); rate-limited by the host. --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/membermention/ --- # memberMention > `const` **memberMention**: (`memberId`) => `string` = `userMention` Defined in: [sdk/js/src/mention.ts:20](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L20) Same as `userMention`: Zaun calls users members. The text that shows a member mention: `<@id>`. ## Parameters ### memberId `string` ## Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/mentionlimits/ --- # MentionLimits > `const` **MentionLimits**: `object` Defined in: [sdk/js/src/mention.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/mention.ts#L12) Most members, and roles, one message may mention (spec §12). ## Type Declaration ### members > `readonly` **members**: `50` = `50` ### roles > `readonly` **roles**: `20` = `20` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/messages/ --- # messages > `const` **messages**: `object` Defined in: [sdk/js/src/api.ts:12](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L12) Messages and reactions in channels the bot can see. ## Type Declaration ### delete() > **delete**(`channelId`, `messageId`): `void` #### Parameters ##### channelId `string` ##### messageId `string` #### Returns `void` ### dm() > **dm**(`memberId`, `payload`): `object` A direct message to `memberId` (capability `dms`): opens the DM when needed. Returns the DM's channel id and the message id. #### Parameters ##### memberId `string` ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `object` ##### channelId > **channelId**: `string` ##### messageId > **messageId**: `string` ### edit() > **edit**(`channelId`, `messageId`, `payload`): `void` Edits one of the bot's messages. #### Parameters ##### channelId `string` ##### messageId `string` ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) #### Returns `void` ### history() > **history**(`channelId`, `options?`): [`Message`](/docs/reference/js/zaun-bot/classes/message/)[] Up to `limit` (1–100) messages before the sequence `before`. #### Parameters ##### channelId `string` ##### options? ###### before? `number` ###### limit? `number` #### Returns [`Message`](/docs/reference/js/zaun-bot/classes/message/)[] ### react() > **react**(`channelId`, `messageId`, `emoji`): `void` #### Parameters ##### channelId `string` ##### messageId `string` ##### emoji `string` #### Returns `void` ### send() > **send**(`channelId`, `payload`, `options?`): `string` Posts a message; returns its id. #### Parameters ##### channelId `string` ##### payload [`MessagePayload`](/docs/reference/js/zaun-bot/type-aliases/messagepayload/) ##### options? ###### replyTo? `string` #### Returns `string` ### unreact() > **unreact**(`channelId`, `messageId`, `emoji`): `void` #### Parameters ##### channelId `string` ##### messageId `string` ##### emoji `string` #### Returns `void` ### upload() > **upload**(`channelId`, `name`, `mime`, `bytes`): `string` Uploads a file for the bot's next message (capability `attachments`); returns its id. #### Parameters ##### channelId `string` ##### name `string` ##### mime `string` ##### bytes `Uint8Array` #### Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/permissionflagsbits/ --- # PermissionFlagsBits > `const` **PermissionFlagsBits**: `object` Defined in: [sdk/js/src/permissions.ts:2](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/permissions.ts#L2) Zaun permission bits. ## Type Declaration ### AddReactions > `readonly` **AddReactions**: `bigint` ### Administrator > `readonly` **Administrator**: `bigint` ### ApproveMembers > `readonly` **ApproveMembers**: `bigint` ### AttachFiles > `readonly` **AttachFiles**: `bigint` ### BanMembers > `readonly` **BanMembers**: `bigint` ### BypassSlowmode > `readonly` **BypassSlowmode**: `bigint` ### ChangeNickname > `readonly` **ChangeNickname**: `bigint` ### Connect > `readonly` **Connect**: `bigint` ### CreateInvite > `readonly` **CreateInvite**: `bigint` ### CreateThreads > `readonly` **CreateThreads**: `bigint` ### DeafenMembers > `readonly` **DeafenMembers**: `bigint` ### EmbedLinks > `readonly` **EmbedLinks**: `bigint` ### KickMembers > `readonly` **KickMembers**: `bigint` ### ManageChannels > `readonly` **ManageChannels**: `bigint` ### ManageCommunity > `readonly` **ManageCommunity**: `bigint` ### ManageEmojis > `readonly` **ManageEmojis**: `bigint` ### ManageInvites > `readonly` **ManageInvites**: `bigint` ### ManageMessages > `readonly` **ManageMessages**: `bigint` ### ManageNicknames > `readonly` **ManageNicknames**: `bigint` ### ManageReports > `readonly` **ManageReports**: `bigint` ### ManageRoles > `readonly` **ManageRoles**: `bigint` ### ManageSafety > `readonly` **ManageSafety**: `bigint` ### ManageThreads > `readonly` **ManageThreads**: `bigint` ### ManageWebhooks > `readonly` **ManageWebhooks**: `bigint` ### MentionEveryone > `readonly` **MentionEveryone**: `bigint` ### MoveMembers > `readonly` **MoveMembers**: `bigint` ### MuteMembers > `readonly` **MuteMembers**: `bigint` ### ReadMessageHistory > `readonly` **ReadMessageHistory**: `bigint` ### SendMessages > `readonly` **SendMessages**: `bigint` ### SendMessagesInThreads > `readonly` **SendMessagesInThreads**: `bigint` ### Speak > `readonly` **Speak**: `bigint` ### Stream > `readonly` **Stream**: `bigint` ### TimeoutMembers > `readonly` **TimeoutMembers**: `bigint` ### UseApplicationCommands > `readonly` **UseApplicationCommands**: `bigint` ### Video > `readonly` **Video**: `bigint` ### ViewAuditLog > `readonly` **ViewAuditLog**: `bigint` ### ViewChannel > `readonly` **ViewChannel**: `bigint` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/presence/ --- # presence > `const` **presence**: `object` Defined in: [sdk/js/src/presence.ts:83](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/presence.ts#L83) The bot's presence and custom status text. ## Type Declaration ### clearStatus() > **clearStatus**(): `void` Clears the custom status text and emoji. #### Returns `void` ### set() > **set**(`status`, `activity?`): `void` Sets the status and activity (none: no activity). #### Parameters ##### status [`PresenceStatus`](/docs/reference/js/zaun-bot/type-aliases/presencestatus/) ##### activity? [`Activity`](/docs/reference/js/zaun-bot/classes/activity/) #### Returns `void` ### setStatus() > **setStatus**(`text?`, `emoji?`, `expiresAt?`): `void` Sets the custom status text and emoji, cleared by the host at `expiresAt` (ms) if given. #### Parameters ##### text? `string` ##### emoji? `string` ##### expiresAt? `number` \| `bigint` #### Returns `void` ### setStatusText() > **setStatusText**(`text`): `void` Sets the custom status text, kept until changed. #### Parameters ##### text `string` #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/separatorspacingsize/ --- # SeparatorSpacingSize > `const` **SeparatorSpacingSize**: `object` Defined in: [sdk/js/src/builders/layout.ts:115](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/layout.ts#L115) Separator spacing (standard numbers). ## Type Declaration ### Large > `readonly` **Large**: `2` = `2` ### Small > `readonly` **Small**: `1` = `1` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/storage/ --- # storage > `const` **storage**: `object` Defined in: [sdk/js/src/api.ts:53](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L53) The bot's key-value storage (capability `storage_bytes`). ## Type Declaration ### delete() > **delete**(`key`): `void` #### Parameters ##### key `string` #### Returns `void` ### get() > **get**(`key`): `Uint8Array`\<`ArrayBufferLike`\> #### Parameters ##### key `string` #### Returns `Uint8Array`\<`ArrayBufferLike`\> ### getJSON() > **getJSON**\<`T`\>(`key`): `T` A JSON value (bigints are not supported by JSON). #### Type Parameters ##### T `T` = `unknown` #### Parameters ##### key `string` #### Returns `T` ### getString() > **getString**(`key`): `string` #### Parameters ##### key `string` #### Returns `string` ### keys() > **keys**(`prefix?`, `options?`): `string`[] Keys starting with `prefix`, in order. #### Parameters ##### prefix? `string` = `''` ##### options? ###### after? `string` ###### limit? `number` #### Returns `string`[] ### set() > **set**(`key`, `value`): `void` #### Parameters ##### key `string` ##### value `Uint8Array` #### Returns `void` ### setJSON() > **setJSON**(`key`, `value`): `void` #### Parameters ##### key `string` ##### value `unknown` #### Returns `void` ### setString() > **setString**(`key`, `value`): `void` #### Parameters ##### key `string` ##### value `string` #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/textinputstyle/ --- # TextInputStyle > `const` **TextInputStyle**: `object` Defined in: [sdk/js/src/builders/text-input.ts:9](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/builders/text-input.ts#L9) Text input styles (standard numbers). ## Type Declaration ### Paragraph > `readonly` **Paragraph**: `2` = `2` ### Short > `readonly` **Short**: `1` = `1` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/timers/ --- # timers > `const` **timers**: `object` Defined in: [sdk/js/src/api.ts:85](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/api.ts#L85) Timers (capability `timers`): they fire the bot's `timer` event. ## Type Declaration ### after() > **after**(`ms`, `tag`): `number` Once after `ms`; returns the timer id. #### Parameters ##### ms `number` ##### tag `string` #### Returns `number` ### cancel() > **cancel**(`id`): `void` #### Parameters ##### id `number` #### Returns `void` ### every() > **every**(`ms`, `tag`): `number` Every `ms` (≥ 1000). #### Parameters ##### ms `number` ##### tag `string` #### Returns `number` --- url: https://zaunchat.github.io/docs/reference/js/zaun-bot/variables/voice/ --- # voice > `const` **voice**: `object` Defined in: [sdk/js/src/voice.ts:35](https://github.com/zaunchat/zaun-bot/blob/main/sdk/js/src/voice.ts#L35) The bot's voice stay and player. Errors throw `ZaunError` (`FORBIDDEN` without grants). ## Type Declaration ### clearQueue() > **clearQueue**(): `void` Empties the queue; unlike `stop`, the current track keeps playing. #### Returns `void` ### endStream() > **endStream**(): `void` The `pushed` track ends once its buffer has played. #### Returns `void` ### enqueue() > **enqueue**(`t`): `number` Adds to the queue (≤ 100); returns its length. #### Parameters ##### t `string` \| [`TrackOptions`](/docs/reference/js/zaun-bot/type-aliases/trackoptions/) #### Returns `number` ### join() > **join**(`channelId`): `void` Joins a voice channel (leaving another first); returns once audio can flow. #### Parameters ##### channelId `string` #### Returns `void` ### leave() > **leave**(): `void` Leaves; playback stops and the queue clears. #### Returns `void` ### moveTrack() > **moveTrack**(`from`, `to`): `void` Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. #### Parameters ##### from `number` ##### to `number` #### Returns `void` ### pause() > **pause**(): `void` #### Returns `void` ### play() > **play**(`t`): `void` Plays now, replacing the current track (a string is a URL). #### Parameters ##### t `string` \| [`TrackOptions`](/docs/reference/js/zaun-bot/type-aliases/trackoptions/) #### Returns `void` ### push() > **push**(`packets`): `number` Opus packets for the current `pushed` track; returns ms buffered (`BUSY` past 3 s). #### Parameters ##### packets `Uint8Array`\<`ArrayBufferLike`\>[] #### Returns `number` ### remove() > **remove**(`index`): `string` Removes the queued track at `index` (0 plays next); returns its title. Throws `NOT_FOUND` past the end. Like every queue call, `UNSUPPORTED` on hosts without queue control. #### Parameters ##### index `number` #### Returns `string` ### resume() > **resume**(): `void` #### Returns `void` ### seek() > **seek**(`ms`): `void` Jumps to `ms` into the current track; past the end, the track ends. Throws `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. #### Parameters ##### ms `number` #### Returns `void` ### setLoop() > **setLoop**(`mode`): `void` Sets what happens when a track ends. #### Parameters ##### mode `LoopMode` #### Returns `void` ### setVolume() > **setVolume**(`percent`): `void` Sets the playback volume, 0–200 % (100 when the bot joins). Throws `ZaunError` `BAD_REQUEST` (detail `percent`) outside 0–200, checked before the call, and `UNSUPPORTED` on hosts without an Opus encoder, which is most of them for now: tell the member and go on. #### Parameters ##### percent `number` #### Returns `void` ### shuffle() > **shuffle**(): `void` Puts the queue in a random order; the current track keeps playing. #### Returns `void` ### skip() > **skip**(): `void` #### Returns `void` ### state() > **state**(): [`VoiceState`](/docs/reference/js/zaun-bot/type-aliases/voicestate/) #### Returns [`VoiceState`](/docs/reference/js/zaun-bot/type-aliases/voicestate/) ### stop() > **stop**(): `void` Ends the current track and clears the queue. #### Returns `void` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/readme/ --- # zaun-client ## Classes - [ActionRowBuilder](/docs/reference/js/zaun-client/classes/actionrowbuilder/) - [Attachment](/docs/reference/js/zaun-client/classes/attachment/) - [AttachmentReader](/docs/reference/js/zaun-client/classes/attachmentreader/) - [ButtonBuilder](/docs/reference/js/zaun-client/classes/buttonbuilder/) - [Channel](/docs/reference/js/zaun-client/classes/channel/) - [Client](/docs/reference/js/zaun-client/classes/client/) - [Collection](/docs/reference/js/zaun-client/classes/collection/) - [CommandBuilder](/docs/reference/js/zaun-client/classes/commandbuilder/) - [Community](/docs/reference/js/zaun-client/classes/community/) - [ContainerBuilder](/docs/reference/js/zaun-client/classes/containerbuilder/) - [Embed](/docs/reference/js/zaun-client/classes/embed/) - [EmbedBuilder](/docs/reference/js/zaun-client/classes/embedbuilder/) - [Interaction](/docs/reference/js/zaun-client/classes/interaction/) - [Member](/docs/reference/js/zaun-client/classes/member/) - [Message](/docs/reference/js/zaun-client/classes/message/) - [MessageMentions](/docs/reference/js/zaun-client/classes/messagementions/) - [ModalBuilder](/docs/reference/js/zaun-client/classes/modalbuilder/) - [Permissions](/docs/reference/js/zaun-client/classes/permissions/) - [RawClient](/docs/reference/js/zaun-client/classes/rawclient/) - [Role](/docs/reference/js/zaun-client/classes/role/) - [SelectBuilder](/docs/reference/js/zaun-client/classes/selectbuilder/) - [SimplexClient](/docs/reference/js/zaun-client/classes/simplexclient/) - [TextInputBuilder](/docs/reference/js/zaun-client/classes/textinputbuilder/) - [VoiceConnection](/docs/reference/js/zaun-client/classes/voiceconnection/) - [ZaunError](/docs/reference/js/zaun-client/classes/zaunerror/) ## Interfaces - [Activity](/docs/reference/js/zaun-client/interfaces/activity/) - [AllowedMentions](/docs/reference/js/zaun-client/interfaces/allowedmentions/) - [ApplicationCommandData](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) - [BotCapabilities](/docs/reference/js/zaun-client/interfaces/botcapabilities/) - [BotCard](/docs/reference/js/zaun-client/interfaces/botcard/) - [BotConfigKey](/docs/reference/js/zaun-client/interfaces/botconfigkey/) - [BotSource](/docs/reference/js/zaun-client/interfaces/botsource/) - [CatalogSeen](/docs/reference/js/zaun-client/interfaces/catalogseen/) - [CatalogVerification](/docs/reference/js/zaun-client/interfaces/catalogverification/) - [ClientEvents](/docs/reference/js/zaun-client/interfaces/clientevents/) - [CommandOptionData](/docs/reference/js/zaun-client/interfaces/commandoptiondata/) - [DmChannelData](/docs/reference/js/zaun-client/interfaces/dmchanneldata/) - [DmSettings](/docs/reference/js/zaun-client/interfaces/dmsettings/) - [EmbedData](/docs/reference/js/zaun-client/interfaces/embeddata/) - [EmbedFieldData](/docs/reference/js/zaun-client/interfaces/embedfielddata/) - [FileToSend](/docs/reference/js/zaun-client/interfaces/filetosend/) - [HistoryVerification](/docs/reference/js/zaun-client/interfaces/historyverification/) - [InstallSource](/docs/reference/js/zaun-client/interfaces/installsource/) - [MentionsData](/docs/reference/js/zaun-client/interfaces/mentionsdata/) - [MentionsInput](/docs/reference/js/zaun-client/interfaces/mentionsinput/) - [OptionValueData](/docs/reference/js/zaun-client/interfaces/optionvaluedata/) - [PackageIdentity](/docs/reference/js/zaun-client/interfaces/packageidentity/) - [PackageInspection](/docs/reference/js/zaun-client/interfaces/packageinspection/) - [Presence](/docs/reference/js/zaun-client/interfaces/presence/) - [RegistryError](/docs/reference/js/zaun-client/interfaces/registryerror/) - [StartOptions](/docs/reference/js/zaun-client/interfaces/startoptions/) - [VoiceEvents](/docs/reference/js/zaun-client/interfaces/voiceevents/) - [VoiceState](/docs/reference/js/zaun-client/interfaces/voicestate/) ## Type Aliases - [BotMessageOptions](/docs/reference/js/zaun-client/type-aliases/botmessageoptions/) - [ComponentData](/docs/reference/js/zaun-client/type-aliases/componentdata/) - [MessageEditOptions](/docs/reference/js/zaun-client/type-aliases/messageeditoptions/) - [MessageOptions](/docs/reference/js/zaun-client/type-aliases/messageoptions/) - [PermissionFlag](/docs/reference/js/zaun-client/type-aliases/permissionflag/) - [PermissionResolvable](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/) - [PictureSource](/docs/reference/js/zaun-client/type-aliases/picturesource/) ## Variables - [ApplicationCommandType](/docs/reference/js/zaun-client/variables/applicationcommandtype/) - [ButtonStyle](/docs/reference/js/zaun-client/variables/buttonstyle/) - [ComponentType](/docs/reference/js/zaun-client/variables/componenttype/) - [everyoneMention](/docs/reference/js/zaun-client/variables/everyonemention/) - [InteractionType](/docs/reference/js/zaun-client/variables/interactiontype/) - [MentionLimits](/docs/reference/js/zaun-client/variables/mentionlimits/) - [MessageFlags](/docs/reference/js/zaun-client/variables/messageflags/) - [OptionType](/docs/reference/js/zaun-client/variables/optiontype/) - [RawAttachmentReader](/docs/reference/js/zaun-client/variables/rawattachmentreader/) - [TextInputStyle](/docs/reference/js/zaun-client/variables/textinputstyle/) ## Functions - [inspectPackage](/docs/reference/js/zaun-client/functions/inspectpackage/) - [memberMention](/docs/reference/js/zaun-client/functions/membermention/) - [parseMentions](/docs/reference/js/zaun-client/functions/parsementions/) - [registryKeyId](/docs/reference/js/zaun-client/functions/registrykeyid/) - [roleMention](/docs/reference/js/zaun-client/functions/rolemention/) - [userMention](/docs/reference/js/zaun-client/functions/usermention/) - [verifyCatalog](/docs/reference/js/zaun-client/functions/verifycatalog/) - [verifyHistory](/docs/reference/js/zaun-client/functions/verifyhistory/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/actionrowbuilder/ --- # ActionRowBuilder Defined in: [zaun/js/index.d.ts:429](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L429) ## Extends - `Builder`\<[`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)\> ## Constructors ### Constructor > **new ActionRowBuilder**(`components?`): `ActionRowBuilder` Defined in: [zaun/js/index.d.ts:430](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L430) #### Parameters ##### components? ([`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \})[] #### Returns `ActionRowBuilder` #### Overrides `Builder.constructor` ## Properties ### data > **data**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### Inherited from `Builder.data` ## Methods ### addComponents() > **addComponents**(...`components`): `this` Defined in: [zaun/js/index.d.ts:431](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L431) #### Parameters ##### components ...([`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \})[] #### Returns `this` *** ### toJSON() > **toJSON**(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/attachment/ --- # Attachment Defined in: [zaun/js/index.d.ts:693](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L693) ## Constructors ### Constructor > **new Attachment**(): `Attachment` #### Returns `Attachment` ## Properties ### contentType > `readonly` **contentType**: `string` Defined in: [zaun/js/index.d.ts:698](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L698) *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:695](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L695) *** ### message > `readonly` **message**: [`Message`](/docs/reference/js/zaun-client/classes/message/) Defined in: [zaun/js/index.d.ts:694](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L694) *** ### name > `readonly` **name**: `string` Defined in: [zaun/js/index.d.ts:696](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L696) *** ### size > `readonly` **size**: `number` Defined in: [zaun/js/index.d.ts:697](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L697) ## Methods ### download() > **download**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> Defined in: [zaun/js/index.d.ts:700](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L700) The bytes, checked against the attachment's size and SHA3-256. #### Returns `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> *** ### open() > **open**(): `Promise`\<[`AttachmentReader`](/docs/reference/js/zaun-client/classes/attachmentreader/)\> Defined in: [zaun/js/index.d.ts:703](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L703) The file to read while it downloads, once its first chunk is here and the file's length is the attachment's. The host's download permission and limits apply as for `download`. #### Returns `Promise`\<[`AttachmentReader`](/docs/reference/js/zaun-client/classes/attachmentreader/)\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/attachmentreader/ --- # AttachmentReader Defined in: [zaun/js/index.d.ts:710](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L710) An attachment read while it downloads. Every byte a read gives is plaintext of a chunk whose SHA-256 the file's description (sent by the host over the post-quantum connection) named. The attachment's own SHA3-256, and XFTP's whole-file digest and tag, are checked once every chunk was read in order: `verified()`. ## Constructors ### Constructor > **new AttachmentReader**(): `AttachmentReader` #### Returns `AttachmentReader` ## Properties ### attachment > `readonly` **attachment**: [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/) Defined in: [zaun/js/index.d.ts:711](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L711) *** ### raw > `readonly` **raw**: `RawAttachmentReader` Defined in: [zaun/js/index.d.ts:712](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L712) *** ### size > `readonly` **size**: `number` Defined in: [zaun/js/index.d.ts:714](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L714) The attachment's size in bytes. ## Methods ### close() > **close**(): `void` Defined in: [zaun/js/index.d.ts:726](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L726) Stops the download; waiting and later reads reject with `closed`. #### Returns `void` *** ### progress() > **progress**(): `object` Defined in: [zaun/js/index.d.ts:724](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L724) Encrypted bytes fetched so far (again after an eviction) and of the whole file. #### Returns `object` ##### fetched > **fetched**: `number` ##### total > **total**: `number` *** ### read() > **read**(`offset`, `length`, `signal?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> Defined in: [zaun/js/index.d.ts:718](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L718) Up to `length` bytes from `offset`: fewer when the range runs past what is downloaded, none at the end. Waits for the first chunk the range needs. `signal` gives it up (`aborted`); a failed check rejects with `mismatch`, a closed reader with `closed`. #### Parameters ##### offset `number` ##### length `number` ##### signal? `AbortSignal` #### Returns `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> *** ### verified() > **verified**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:722](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L722) Resolves once every chunk went through the whole-file checks and the file's size and SHA3-256 are the attachment's; rejects with `mismatch` (and fails every read after) when not, or with why the download stopped. #### Returns `Promise`\<`void`\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/buttonbuilder/ --- # ButtonBuilder Defined in: [zaun/js/index.d.ts:413](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L413) ## Extends - `Builder`\<[`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)\> ## Constructors ### Constructor > **new ButtonBuilder**(`data?`): `ButtonBuilder` Defined in: [zaun/js/index.d.ts:414](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L414) #### Parameters ##### data? `object` #### Returns `ButtonBuilder` #### Overrides `Builder.constructor` ## Properties ### data > **data**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### Inherited from `Builder.data` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [zaun/js/index.d.ts:418](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L418) #### Parameters ##### id `string` #### Returns `this` *** ### setDisabled() > **setDisabled**(`disabled?`): `this` Defined in: [zaun/js/index.d.ts:420](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L420) #### Parameters ##### disabled? `boolean` #### Returns `this` *** ### setEmoji() > **setEmoji**(`emoji`): `this` Defined in: [zaun/js/index.d.ts:417](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L417) #### Parameters ##### emoji `string` #### Returns `this` *** ### setLabel() > **setLabel**(`label`): `this` Defined in: [zaun/js/index.d.ts:416](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L416) #### Parameters ##### label `string` #### Returns `this` *** ### setStyle() > **setStyle**(`style`): `this` Defined in: [zaun/js/index.d.ts:415](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L415) #### Parameters ##### style `number` #### Returns `this` *** ### setURL() > **setURL**(`url`): `this` Defined in: [zaun/js/index.d.ts:419](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L419) #### Parameters ##### url `string` #### Returns `this` *** ### toJSON() > **toJSON**(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/channel/ --- # Channel Defined in: [zaun/js/index.d.ts:646](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L646) ## Constructors ### Constructor > **new Channel**(): `Channel` #### Returns `Channel` ## Properties ### client > `readonly` **client**: [`Client`](/docs/reference/js/zaun-client/classes/client/) Defined in: [zaun/js/index.d.ts:647](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L647) *** ### community > `readonly` **community**: [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:648](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L648) *** ### data > `readonly` **data**: `any` Defined in: [zaun/js/index.d.ts:658](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L658) *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:649](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L649) *** ### isDM > `readonly` **isDM**: `boolean` Defined in: [zaun/js/index.d.ts:686](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L686) DM: a direct message, not a community channel. *** ### members > `readonly` **members**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\> Defined in: [zaun/js/index.d.ts:656](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L656) Who is in this voice channel now. *** ### messages > `readonly` **messages**: `object` Defined in: [zaun/js/index.d.ts:657](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L657) #### fetch() > **fetch**(`options?`): `Promise`\<[`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Message`](/docs/reference/js/zaun-client/classes/message/)\>\> ##### Parameters ###### options? ###### before? `number` ###### limit? `number` ##### Returns `Promise`\<[`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Message`](/docs/reference/js/zaun-client/classes/message/)\>\> *** ### name > `readonly` **name**: `string` Defined in: [zaun/js/index.d.ts:650](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L650) *** ### parent > `readonly` **parent**: `Channel` Defined in: [zaun/js/index.d.ts:654](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L654) *** ### position > `readonly` **position**: `number` Defined in: [zaun/js/index.d.ts:653](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L653) *** ### recipient > `readonly` **recipient**: [`Member`](/docs/reference/js/zaun-client/classes/member/) Defined in: [zaun/js/index.d.ts:688](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L688) DM: the other participant of a direct message, or null. *** ### topic > `readonly` **topic**: `string` Defined in: [zaun/js/index.d.ts:652](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L652) *** ### type > `readonly` **type**: `"text"` \| `"announcement"` \| `"voice"` \| `"category"` \| `"forum"` \| `"stage"` Defined in: [zaun/js/index.d.ts:651](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L651) *** ### typing > `readonly` **typing**: \{ `kind`: `"named"`; `member_ids`: `string`[]; \} \| \{ `count`: `1` \| `2` \| `3`; `kind`: `"anonymous"`; \} Defined in: [zaun/js/index.d.ts:662](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L662) Who else is typing now, or `null`; anonymous channels give only a count (3 = three or more). *** ### typingMode > `readonly` **typingMode**: `"named"` \| `"anonymous"` \| `"off"` Defined in: [zaun/js/index.d.ts:660](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L660) Who sees typing here. ## Methods ### autocomplete() > **autocomplete**(`command`, `options`): `Promise`\<`string`\> Defined in: [zaun/js/index.d.ts:678](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L678) Asks for suggestions for the option marked `focused`; they come as `autocomplete`. #### Parameters ##### command `string` \| [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) ##### options [`OptionValueData`](/docs/reference/js/zaun-client/interfaces/optionvaluedata/)[] #### Returns `Promise`\<`string`\> *** ### click() > **click**(`message`, `customId`, `values?`): `Promise`\<`string`\> Defined in: [zaun/js/index.d.ts:676](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L676) Clicks a button, or chooses `values` in a select, of bot message `message` (its id). #### Parameters ##### message `string` ##### customId `string` ##### values? `string`[] #### Returns `Promise`\<`string`\> *** ### closeDm() > **closeDm**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:690](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L690) DM: closes a direct message for this member. #### Returns `Promise`\<`void`\> *** ### delete() > **delete**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:684](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L684) #### Returns `Promise`\<`void`\> *** ### invokeCommand() > **invokeCommand**(`command`, `options?`, `target?`): `Promise`\<`string`\> Defined in: [zaun/js/index.d.ts:674](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L674) Runs a bot command here: a command object, its id, or a slash command's name (`"help"`, looked up in `community.commands`; rejects when no bot or several have it). Resolves with the interaction id (answers come as events). #### Parameters ##### command `string` \| [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) ##### options? [`OptionValueData`](/docs/reference/js/zaun-client/interfaces/optionvaluedata/)[] ##### target? `string` #### Returns `Promise`\<`string`\> *** ### isCategory() > **isCategory**(): `boolean` Defined in: [zaun/js/index.d.ts:669](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L669) #### Returns `boolean` *** ### isText() > **isText**(): `boolean` Defined in: [zaun/js/index.d.ts:667](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L667) #### Returns `boolean` *** ### isVoice() > **isVoice**(): `boolean` Defined in: [zaun/js/index.d.ts:668](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L668) #### Returns `boolean` *** ### join() > **join**(`options?`): `Promise`\<[`VoiceConnection`](/docs/reference/js/zaun-client/classes/voiceconnection/)\> Defined in: [zaun/js/index.d.ts:683](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L683) Joins this voice channel (browsers with WebRTC only). Relayed through the host's TURN server unless `allowDirect`, and sealed end to end. #### Parameters ##### options? ###### allowDirect? `boolean` ###### selfDeaf? `boolean` ###### selfMute? `boolean` ###### track? `MediaStreamTrack` #### Returns `Promise`\<[`VoiceConnection`](/docs/reference/js/zaun-client/classes/voiceconnection/)\> *** ### send() > **send**(`options`): `Promise`\<[`Message`](/docs/reference/js/zaun-client/classes/message/)\> Defined in: [zaun/js/index.d.ts:670](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L670) #### Parameters ##### options [`MessageOptions`](/docs/reference/js/zaun-client/type-aliases/messageoptions/) #### Returns `Promise`\<[`Message`](/docs/reference/js/zaun-client/classes/message/)\> *** ### setTypingMode() > **setTypingMode**(`mode`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:666](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L666) typing: sets who sees typing here (`MANAGE_CHANNELS`). #### Parameters ##### mode `"named"` \| `"anonymous"` \| `"off"` #### Returns `Promise`\<`void`\> *** ### startTyping() > **startTyping**(): `boolean` Defined in: [zaun/js/index.d.ts:664](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L664) Says this member is typing; `false` (nothing sent) where typing is `off`. #### Returns `boolean` *** ### submitModal() > **submitModal**(`modal`, `customId`, `components`): `Promise`\<`string`\> Defined in: [zaun/js/index.d.ts:680](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L680) Submits a modal from `modalOpen` (its `interaction` is `modal`). #### Parameters ##### modal `string` ##### customId `string` ##### components `object`[] #### Returns `Promise`\<`string`\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/client/ --- # Client Defined in: [zaun/js/index.d.ts:938](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L938) ## Constructors ### Constructor > **new Client**(): `Client` #### Returns `Client` ## Properties ### communities > `readonly` **communities**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Community`](/docs/reference/js/zaun-client/classes/community/)\> Defined in: [zaun/js/index.d.ts:944](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L944) *** ### raw > `readonly` **raw**: [`RawClient`](/docs/reference/js/zaun-client/classes/rawclient/) Defined in: [zaun/js/index.d.ts:942](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L942) *** ### saved > `readonly` **saved**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Community`](/docs/reference/js/zaun-client/classes/community/)\> Defined in: [zaun/js/index.d.ts:946](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L946) The communities kept in the store, known as soon as `start` resolves. *** ### simplex > `readonly` **simplex**: [`SimplexClient`](/docs/reference/js/zaun-client/classes/simplexclient/) Defined in: [zaun/js/index.d.ts:943](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L943) ## Methods ### close() > **close**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:955](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L955) #### Returns `Promise`\<`void`\> *** ### community() > **community**(`id`): [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:947](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L947) #### Parameters ##### id `string` #### Returns [`Community`](/docs/reference/js/zaun-client/classes/community/) *** ### createCommunity() > **createCommunity**(`options`): `Promise`\<[`Community`](/docs/reference/js/zaun-client/classes/community/)\> Defined in: [zaun/js/index.d.ts:949](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L949) #### Parameters ##### options ###### displayName? `string` ###### host `string` ###### hostKey `string` ###### name `string` #### Returns `Promise`\<[`Community`](/docs/reference/js/zaun-client/classes/community/)\> *** ### join() > **join**(`invite`, `displayName?`): `Promise`\<[`Community`](/docs/reference/js/zaun-client/classes/community/)\> Defined in: [zaun/js/index.d.ts:948](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L948) #### Parameters ##### invite `string` ##### displayName? `string` #### Returns `Promise`\<[`Community`](/docs/reference/js/zaun-client/classes/community/)\> *** ### off() > **off**\<`E`\>(`name`, `f`): `this` Defined in: [zaun/js/index.d.ts:952](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L952) #### Type Parameters ##### E `E` *extends* keyof [`ClientEvents`](/docs/reference/js/zaun-client/interfaces/clientevents/) #### Parameters ##### name `E` ##### f (...`args`) => `void` #### Returns `this` *** ### on() > **on**\<`E`\>(`name`, `f`): `this` Defined in: [zaun/js/index.d.ts:950](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L950) #### Type Parameters ##### E `E` *extends* keyof [`ClientEvents`](/docs/reference/js/zaun-client/interfaces/clientevents/) #### Parameters ##### name `E` ##### f (...`args`) => `void` #### Returns `this` *** ### once() > **once**\<`E`\>(`name`, `f?`): `Promise`\<[`ClientEvents`](/docs/reference/js/zaun-client/interfaces/clientevents/)\[`E`\]\[`0`\]\> Defined in: [zaun/js/index.d.ts:951](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L951) #### Type Parameters ##### E `E` *extends* keyof [`ClientEvents`](/docs/reference/js/zaun-client/interfaces/clientevents/) #### Parameters ##### name `E` ##### f? (...`args`) => `void` #### Returns `Promise`\<[`ClientEvents`](/docs/reference/js/zaun-client/interfaces/clientevents/)\[`E`\]\[`0`\]\> *** ### save() > **save**(): `Uint8Array` Defined in: [zaun/js/index.d.ts:953](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L953) #### Returns `Uint8Array` *** ### saveChanges() > **saveChanges**(): `Uint8Array` Defined in: [zaun/js/index.d.ts:954](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L954) #### Returns `Uint8Array` *** ### setPresence() > **setPresence**(`status`, `activity?`): `boolean` Defined in: [zaun/js/index.d.ts:941](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L941) presence: status and activity in every community; `false` when either is not valid. #### Parameters ##### status `"online"` \| `"idle"` \| `"dnd"` \| `"invisible"` ##### activity? [`Activity`](/docs/reference/js/zaun-client/interfaces/activity/) #### Returns `boolean` *** ### start() > `static` **start**(`options`): `Promise`\<`Client`\> Defined in: [zaun/js/index.d.ts:939](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L939) #### Parameters ##### options [`StartOptions`](/docs/reference/js/zaun-client/interfaces/startoptions/) #### Returns `Promise`\<`Client`\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/collection/ --- # Collection Defined in: [zaun/js/index.d.ts:52](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L52) ## Extends - `Map`\<`K`, `V`\> ## Type Parameters ### K `K` ### V `V` ## Constructors ### Constructor > **new Collection**\<`K`, `V`\>(`entries?`): `Collection`\<`K`, `V`\> Defined in: ../../../node\_modules/typescript/lib/lib.es2015.collection.d.ts:50 #### Parameters ##### entries? readonly (readonly \[`K`, `V`\])[] #### Returns `Collection`\<`K`, `V`\> #### Inherited from `Map.constructor` ### Constructor > **new Collection**\<`K`, `V`\>(`iterable?`): `Collection`\<`K`, `V`\> Defined in: ../../../node\_modules/typescript/lib/lib.es2015.collection.d.ts:49 #### Parameters ##### iterable? `Iterable`\ #### Returns `Collection`\<`K`, `V`\> #### Inherited from `Map.constructor` ## Methods ### every() > **every**(`f`): `boolean` Defined in: [zaun/js/index.d.ts:57](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L57) #### Parameters ##### f (`v`, `k`, `c`) => `boolean` #### Returns `boolean` *** ### filter() > **filter**(`f`): `Collection`\<`K`, `V`\> Defined in: [zaun/js/index.d.ts:54](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L54) #### Parameters ##### f (`v`, `k`, `c`) => `boolean` #### Returns `Collection`\<`K`, `V`\> *** ### find() > **find**(`f`): `V` Defined in: [zaun/js/index.d.ts:53](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L53) #### Parameters ##### f (`v`, `k`, `c`) => `boolean` #### Returns `V` *** ### first() > **first**(): `V` Defined in: [zaun/js/index.d.ts:58](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L58) #### Returns `V` *** ### map() > **map**\<`T`\>(`f`): `T`[] Defined in: [zaun/js/index.d.ts:55](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L55) #### Type Parameters ##### T `T` #### Parameters ##### f (`v`, `k`, `c`) => `T` #### Returns `T`[] *** ### some() > **some**(`f`): `boolean` Defined in: [zaun/js/index.d.ts:56](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L56) #### Parameters ##### f (`v`, `k`, `c`) => `boolean` #### Returns `boolean` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/commandbuilder/ --- # CommandBuilder Defined in: [zaun/js/index.d.ts:456](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L456) ## Extends - `Builder`\<[`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)\> ## Constructors ### Constructor > **new CommandBuilder**(`data?`): `CommandBuilder` Defined in: [zaun/js/index.d.ts:457](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L457) #### Parameters ##### data? `object` #### Returns `CommandBuilder` #### Overrides `Builder.constructor` ## Properties ### data > **data**: [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### Inherited from `Builder.data` ## Methods ### addOption() > **addOption**(`option`): `this` Defined in: [zaun/js/index.d.ts:462](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L462) #### Parameters ##### option [`CommandOptionData`](/docs/reference/js/zaun-client/interfaces/commandoptiondata/) \| \{ `toJSON`(): [`CommandOptionData`](/docs/reference/js/zaun-client/interfaces/commandoptiondata/); \} #### Returns `this` *** ### setDefaultMemberPermissions() > **setDefaultMemberPermissions**(`bits`): `this` Defined in: [zaun/js/index.d.ts:461](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L461) #### Parameters ##### bits `string` \| `bigint` #### Returns `this` *** ### setDescription() > **setDescription**(`text`): `this` Defined in: [zaun/js/index.d.ts:459](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L459) #### Parameters ##### text `string` #### Returns `this` *** ### setName() > **setName**(`name`): `this` Defined in: [zaun/js/index.d.ts:458](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L458) #### Parameters ##### name `string` #### Returns `this` *** ### setType() > **setType**(`type`): `this` Defined in: [zaun/js/index.d.ts:460](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L460) #### Parameters ##### type `number` #### Returns `this` *** ### toJSON() > **toJSON**(): [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/community/ --- # Community Defined in: [zaun/js/index.d.ts:81](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L81) ## Constructors ### Constructor > **new Community**(): `Community` #### Returns `Community` ## Properties ### bots > `readonly` **bots**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:108](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L108) Installed bots' public cards, as last heard. *** ### channels > `readonly` **channels**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\> & `object` Defined in: [zaun/js/index.d.ts:88](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L88) #### Type Declaration ##### create() > **create**(`name`, `options?`): `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)\> ###### Parameters ###### name `string` ###### options? ###### parent? `string` \| [`Channel`](/docs/reference/js/zaun-client/classes/channel/) ###### type? `"text"` \| `"announcement"` \| `"voice"` \| `"category"` ###### Returns `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)\> *** ### client > `readonly` **client**: [`Client`](/docs/reference/js/zaun-client/classes/client/) Defined in: [zaun/js/index.d.ts:82](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L82) *** ### commands > `readonly` **commands**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)\> Defined in: [zaun/js/index.d.ts:106](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L106) Bot commands in this community, as last heard (each with its `bot_id`). *** ### data > `readonly` **data**: `any` Defined in: [zaun/js/index.d.ts:96](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L96) The cache as plain data. *** ### description > `readonly` **description**: `string` Defined in: [zaun/js/index.d.ts:85](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L85) *** ### dms > `readonly` **dms**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)[] Defined in: [zaun/js/index.d.ts:137](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L137) DM: this member's open direct messages with bots, from the cache. *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:83](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L83) *** ### isOwner > `readonly` **isOwner**: `boolean` Defined in: [zaun/js/index.d.ts:86](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L86) *** ### me > `readonly` **me**: [`Member`](/docs/reference/js/zaun-client/classes/member/) Defined in: [zaun/js/index.d.ts:87](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L87) *** ### members > `readonly` **members**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\> & `object` Defined in: [zaun/js/index.d.ts:94](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L94) #### Type Declaration ##### fetch() > **fetch**(): `Promise`\<[`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\>\> ###### Returns `Promise`\<[`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\>\> *** ### name > `readonly` **name**: `string` Defined in: [zaun/js/index.d.ts:84](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L84) *** ### presences > `readonly` **presences**: ([`Presence`](/docs/reference/js/zaun-client/interfaces/presence/) & `object`)[] Defined in: [zaun/js/index.d.ts:113](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L113) presence: every member not offline. *** ### roles > `readonly` **roles**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Role`](/docs/reference/js/zaun-client/classes/role/)\> & `object` Defined in: [zaun/js/index.d.ts:91](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L91) #### Type Declaration ##### create() > **create**(`name`, `options?`): `Promise`\<[`Role`](/docs/reference/js/zaun-client/classes/role/)\> ###### Parameters ###### name `string` ###### options? ###### permissions? [`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/) ###### Returns `Promise`\<[`Role`](/docs/reference/js/zaun-client/classes/role/)\> ## Methods ### bot() > **bot**(`botId`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:110](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L110) #### Parameters ##### botId `string` #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> *** ### botConfig() > **botConfig**(`bot`): `Promise`\<`Record`\<`string`, `string`\>\> Defined in: [zaun/js/index.d.ts:131](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L131) Owner only: the values set for a bot's settings (secrets as `"••••"`); a key not there uses its card's `default`. #### Parameters ##### bot `string` \| [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/) #### Returns `Promise`\<`Record`\<`string`, `string`\>\> *** ### channel() > **channel**(`id`): [`Channel`](/docs/reference/js/zaun-client/classes/channel/) Defined in: [zaun/js/index.d.ts:97](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L97) #### Parameters ##### id `string` #### Returns [`Channel`](/docs/reference/js/zaun-client/classes/channel/) *** ### configureBot() > **configureBot**(`bot`, `values`): `Promise`\<`Record`\<`string`, `string`\>\> Defined in: [zaun/js/index.d.ts:128](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L128) Owner only: sets or clears (`null`: back to the card's `default`) the values of the settings a bot declares (`BotCard.config`); resolves with every value the owner has set, a secret one as `"••••"` (write-only). Rejects with `FORBIDDEN` (not the owner), `NOT_FOUND`, or `BAD_REQUEST` for a key the bot does not declare. zaun-host 0.4.0. #### Parameters ##### bot `string` \| [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/) ##### values `Record`\<`string`, `string` \| `null`\> #### Returns `Promise`\<`Record`\<`string`, `string`\>\> *** ### createInvite() > **createInvite**(`options?`): `Promise`\<`string`\> Defined in: [zaun/js/index.d.ts:100](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L100) #### Parameters ##### options? ###### expiresIn? `number` ###### maxUses? `number` #### Returns `Promise`\<`string`\> *** ### disableBot() > **disableBot**(`botId`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:122](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L122) #### Parameters ##### botId `string` #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> *** ### dmSettings() > **dmSettings**(): `Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\> Defined in: [zaun/js/index.d.ts:141](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L141) DM: whether bots may open DMs with this member. #### Returns `Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\> *** ### enableBot() > **enableBot**(`botId`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:121](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L121) #### Parameters ##### botId `string` #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> *** ### fetchBots() > **fetchBots**(): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)[]\> Defined in: [zaun/js/index.d.ts:109](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L109) #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)[]\> *** ### fetchDms() > **fetchDms**(): `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)[]\> Defined in: [zaun/js/index.d.ts:139](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L139) DM: reloads the open DMs from the host. #### Returns `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)[]\> *** ### grantBot() > **grantBot**(`botId`, `grants`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:120](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L120) #### Parameters ##### botId `string` ##### grants ###### capabilities? [`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/) ###### permissions? [`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/) #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> *** ### installBot() > **installBot**(`pkg`, `options?`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:118](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L118) Owner only: installs the `.zbot` uploaded as attachment `pkg`, with the registry `source` it was verified against, if any. #### Parameters ##### pkg `string` ##### options? ###### grants? \{ `capabilities?`: [`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/); `permissions?`: `string`; \} ###### grants.capabilities? [`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/) ###### grants.permissions? `string` ###### rolePosition? `number` ###### source? [`InstallSource`](/docs/reference/js/zaun-client/interfaces/installsource/) #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> *** ### leave() > **leave**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:104](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L104) Leaves (the owner cannot). Once the host accepts, the community is forgotten here: its state and member key leave the store, `communityDelete` follows with `{ t: "left" }`, and a later join of it from the same store starts afresh. #### Returns `Promise`\<`void`\> *** ### member() > **member**(`id`): [`Member`](/docs/reference/js/zaun-client/classes/member/) Defined in: [zaun/js/index.d.ts:98](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L98) #### Parameters ##### id `string` #### Returns [`Member`](/docs/reference/js/zaun-client/classes/member/) *** ### registerBot() > **registerBot**(`member`, `name?`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:133](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L133) Owner only: marks a member connected over SimpleX as an external bot. #### Parameters ##### member `string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/) ##### name? `string` #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> *** ### removeBot() > **removeBot**(`botId`, `options?`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:123](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L123) #### Parameters ##### botId `string` ##### options? ###### keepData? `boolean` #### Returns `Promise`\<`void`\> *** ### role() > **role**(`id`): [`Role`](/docs/reference/js/zaun-client/classes/role/) Defined in: [zaun/js/index.d.ts:99](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L99) #### Parameters ##### id `string` #### Returns [`Role`](/docs/reference/js/zaun-client/classes/role/) *** ### setCommands() > **setCommands**(`commands`): `Promise`\<[`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)[]\> Defined in: [zaun/js/index.d.ts:135](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L135) As a bot: replaces this bot's commands. #### Parameters ##### commands ([`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) \| [`CommandBuilder`](/docs/reference/js/zaun-client/classes/commandbuilder/))[] #### Returns `Promise`\<[`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/)[]\> *** ### setDmsFromBots() > **setDmsFromBots**(`allow`): `Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\> Defined in: [zaun/js/index.d.ts:142](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L142) #### Parameters ##### allow `boolean` #### Returns `Promise`\<[`DmSettings`](/docs/reference/js/zaun-client/interfaces/dmsettings/)\> *** ### setStatusText() > **setStatusText**(`text`, `options?`): `Promise`\<`any`\> Defined in: [zaun/js/index.d.ts:115](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L115) Sets this member's custom status here; no text and no emoji clears it. #### Parameters ##### text `string` ##### options? ###### emoji? `string` ###### expiresAt? `number` \| `Date` #### Returns `Promise`\<`any`\> *** ### updateBot() > **updateBot**(`botId`, `pkg`, `options?`): `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> Defined in: [zaun/js/index.d.ts:119](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L119) #### Parameters ##### botId `string` ##### pkg `string` ##### options? ###### source? [`InstallSource`](/docs/reference/js/zaun-client/interfaces/installsource/) #### Returns `Promise`\<[`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/containerbuilder/ --- # ContainerBuilder Defined in: [zaun/js/index.d.ts:449](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L449) ## Extends - `Builder`\<[`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)\> ## Constructors ### Constructor > **new ContainerBuilder**(`data?`): `ContainerBuilder` Defined in: [zaun/js/index.d.ts:450](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L450) #### Parameters ##### data? `object` #### Returns `ContainerBuilder` #### Overrides `Builder.constructor` ## Properties ### data > **data**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### Inherited from `Builder.data` ## Methods ### addComponents() > **addComponents**(...`components`): `this` Defined in: [zaun/js/index.d.ts:454](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L454) #### Parameters ##### components ...([`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \})[] #### Returns `this` *** ### addSeparator() > **addSeparator**(`spacing?`): `this` Defined in: [zaun/js/index.d.ts:453](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L453) #### Parameters ##### spacing? `1` \| `2` #### Returns `this` *** ### addText() > **addText**(`content`): `this` Defined in: [zaun/js/index.d.ts:452](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L452) #### Parameters ##### content `string` #### Returns `this` *** ### setAccentColor() > **setAccentColor**(`rgb`): `this` Defined in: [zaun/js/index.d.ts:451](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L451) #### Parameters ##### rgb `number` #### Returns `this` *** ### toJSON() > **toJSON**(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/embed/ --- # Embed Defined in: [zaun/js/index.d.ts:538](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L538) An embed on a message, as received. Pictures are the message's attachments (`null` when the message object does not have them, as on an edit's event; `data` has their ids). ## Constructors ### Constructor > **new Embed**(): `Embed` #### Returns `Embed` ## Properties ### author > `readonly` **author**: `object` Defined in: [zaun/js/index.d.ts:548](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L548) #### icon > **icon**: [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/) #### name > **name**: `string` #### url > **url**: `string` *** ### color > `readonly` **color**: `number` Defined in: [zaun/js/index.d.ts:544](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L544) *** ### data > `readonly` **data**: [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) Defined in: [zaun/js/index.d.ts:540](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L540) *** ### description > `readonly` **description**: `string` Defined in: [zaun/js/index.d.ts:542](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L542) *** ### fields > `readonly` **fields**: `object`[] Defined in: [zaun/js/index.d.ts:547](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L547) #### inline > **inline**: `boolean` #### name > **name**: `string` #### value > **value**: `string` *** ### footer > `readonly` **footer**: `object` Defined in: [zaun/js/index.d.ts:549](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L549) #### icon > **icon**: [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/) #### text > **text**: `string` *** ### hexColor > `readonly` **hexColor**: `string` Defined in: [zaun/js/index.d.ts:545](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L545) *** ### image > `readonly` **image**: [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/) Defined in: [zaun/js/index.d.ts:550](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L550) *** ### message > `readonly` **message**: [`Message`](/docs/reference/js/zaun-client/classes/message/) Defined in: [zaun/js/index.d.ts:539](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L539) *** ### thumbnail > `readonly` **thumbnail**: [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/) Defined in: [zaun/js/index.d.ts:551](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L551) *** ### timestamp > `readonly` **timestamp**: `Date` Defined in: [zaun/js/index.d.ts:546](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L546) *** ### title > `readonly` **title**: `string` Defined in: [zaun/js/index.d.ts:541](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L541) *** ### url > `readonly` **url**: `string` Defined in: [zaun/js/index.d.ts:543](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L543) ## Methods ### toJSON() > **toJSON**(): [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) Defined in: [zaun/js/index.d.ts:552](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L552) #### Returns [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/embedbuilder/ --- # EmbedBuilder Defined in: [zaun/js/index.d.ts:514](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L514) A rich embed. Up to 10 per message; limits as the protocol's (title 256, description 4 096, 25 fields, 6 000 characters in all). ## Constructors ### Constructor > **new EmbedBuilder**(`data?`): `EmbedBuilder` Defined in: [zaun/js/index.d.ts:515](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L515) #### Parameters ##### data? [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) \| [`Embed`](/docs/reference/js/zaun-client/classes/embed/) #### Returns `EmbedBuilder` ## Properties ### data > `readonly` **data**: [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) Defined in: [zaun/js/index.d.ts:518](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L518) The protocol's fields; pictures still to upload are not in it yet. ## Methods ### addFields() > **addFields**(...`fields`): `this` Defined in: [zaun/js/index.d.ts:530](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L530) #### Parameters ##### fields ...([`EmbedFieldData`](/docs/reference/js/zaun-client/interfaces/embedfielddata/) \| [`EmbedFieldData`](/docs/reference/js/zaun-client/interfaces/embedfielddata/)[])[] #### Returns `this` *** ### setAuthor() > **setAuthor**(`author`): `this` Defined in: [zaun/js/index.d.ts:526](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L526) #### Parameters ##### author ###### icon? [`PictureSource`](/docs/reference/js/zaun-client/type-aliases/picturesource/) ###### name `string` ###### url? `string` #### Returns `this` *** ### setColor() > **setColor**(`color`): `this` Defined in: [zaun/js/index.d.ts:523](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L523) #### Parameters ##### color `number` \| `` `#${string}` `` \| \[`number`, `number`, `number`\] #### Returns `this` *** ### setDescription() > **setDescription**(`description`): `this` Defined in: [zaun/js/index.d.ts:520](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L520) #### Parameters ##### description `string` #### Returns `this` *** ### setFields() > **setFields**(...`fields`): `this` Defined in: [zaun/js/index.d.ts:531](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L531) #### Parameters ##### fields ...([`EmbedFieldData`](/docs/reference/js/zaun-client/interfaces/embedfielddata/) \| [`EmbedFieldData`](/docs/reference/js/zaun-client/interfaces/embedfielddata/)[])[] #### Returns `this` *** ### setFooter() > **setFooter**(`footer`): `this` Defined in: [zaun/js/index.d.ts:527](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L527) #### Parameters ##### footer ###### icon? [`PictureSource`](/docs/reference/js/zaun-client/type-aliases/picturesource/) ###### text `string` #### Returns `this` *** ### setImage() > **setImage**(`picture`): `this` Defined in: [zaun/js/index.d.ts:528](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L528) #### Parameters ##### picture [`PictureSource`](/docs/reference/js/zaun-client/type-aliases/picturesource/) #### Returns `this` *** ### setThumbnail() > **setThumbnail**(`picture`): `this` Defined in: [zaun/js/index.d.ts:529](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L529) #### Parameters ##### picture [`PictureSource`](/docs/reference/js/zaun-client/type-aliases/picturesource/) #### Returns `this` *** ### setTimestamp() > **setTimestamp**(`time?`): `this` Defined in: [zaun/js/index.d.ts:525](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L525) Now when not given. #### Parameters ##### time? `number` \| `Date` #### Returns `this` *** ### setTitle() > **setTitle**(`title`): `this` Defined in: [zaun/js/index.d.ts:519](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L519) #### Parameters ##### title `string` #### Returns `this` *** ### setURL() > **setURL**(`url`): `this` Defined in: [zaun/js/index.d.ts:522](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L522) `https://` only. #### Parameters ##### url `string` #### Returns `this` *** ### spliceFields() > **spliceFields**(`index`, `deleteCount`, ...`fields`): `this` Defined in: [zaun/js/index.d.ts:532](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L532) #### Parameters ##### index `number` ##### deleteCount `number` ##### fields ...([`EmbedFieldData`](/docs/reference/js/zaun-client/interfaces/embedfielddata/) \| [`EmbedFieldData`](/docs/reference/js/zaun-client/interfaces/embedfielddata/)[])[] #### Returns `this` *** ### toJSON() > **toJSON**(): [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) Defined in: [zaun/js/index.d.ts:533](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L533) #### Returns [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) *** ### from() > `static` **from**(`other`): `EmbedBuilder` Defined in: [zaun/js/index.d.ts:516](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L516) #### Parameters ##### other `EmbedBuilder` \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/) \| [`Embed`](/docs/reference/js/zaun-client/classes/embed/) #### Returns `EmbedBuilder` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/interaction/ --- # Interaction Defined in: [zaun/js/index.d.ts:374](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L374) As a bot: someone used one of this bot's commands, components or modals. ## Constructors ### Constructor > **new Interaction**(): `Interaction` #### Returns `Interaction` ## Properties ### channel > `readonly` **channel**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/) Defined in: [zaun/js/index.d.ts:379](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L379) *** ### commandName > `readonly` **commandName**: `string` Defined in: [zaun/js/index.d.ts:383](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L383) *** ### community > `readonly` **community**: [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:375](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L375) *** ### customId > `readonly` **customId**: `string` Defined in: [zaun/js/index.d.ts:385](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L385) *** ### data > `readonly` **data**: `any` Defined in: [zaun/js/index.d.ts:382](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L382) The interaction as the host sent it. *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:376](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L376) *** ### member > `readonly` **member**: [`Member`](/docs/reference/js/zaun-client/classes/member/) Defined in: [zaun/js/index.d.ts:380](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L380) *** ### options > `readonly` **options**: [`OptionValueData`](/docs/reference/js/zaun-client/interfaces/optionvaluedata/)[] Defined in: [zaun/js/index.d.ts:384](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L384) *** ### type > `readonly` **type**: `number` Defined in: [zaun/js/index.d.ts:378](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L378) InteractionType: 2 command, 3 component, 4 autocomplete, 5 modal submit. *** ### values > `readonly` **values**: `string`[] Defined in: [zaun/js/index.d.ts:386](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L386) ## Methods ### autocomplete() > **autocomplete**(`choices`): `Promise`\<`unknown`\> Defined in: [zaun/js/index.d.ts:394](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L394) #### Parameters ##### choices `object`[] #### Returns `Promise`\<`unknown`\> *** ### defer() > **defer**(`options?`): `Promise`\<\{ `message_id?`: `string`; \}\> Defined in: [zaun/js/index.d.ts:391](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L391) #### Parameters ##### options? ###### ephemeral? `boolean` #### Returns `Promise`\<\{ `message_id?`: `string`; \}\> *** ### deferUpdate() > **deferUpdate**(): `Promise`\<`unknown`\> Defined in: [zaun/js/index.d.ts:392](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L392) #### Returns `Promise`\<`unknown`\> *** ### deleteReply() > **deleteReply**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:398](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L398) #### Returns `Promise`\<`void`\> *** ### editReply() > **editReply**(`options`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:397](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L397) #### Parameters ##### options [`BotMessageOptions`](/docs/reference/js/zaun-client/type-aliases/botmessageoptions/) #### Returns `Promise`\<`void`\> *** ### field() > **field**(`customId`): `string` Defined in: [zaun/js/index.d.ts:388](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L388) #### Parameters ##### customId `string` #### Returns `string` *** ### followUp() > **followUp**(`options`): `Promise`\<\{ `message_id?`: `string`; \}\> Defined in: [zaun/js/index.d.ts:396](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L396) #### Parameters ##### options [`BotMessageOptions`](/docs/reference/js/zaun-client/type-aliases/botmessageoptions/) #### Returns `Promise`\<\{ `message_id?`: `string`; \}\> *** ### option() > **option**(`name`): `string` \| `number` \| `boolean` Defined in: [zaun/js/index.d.ts:387](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L387) #### Parameters ##### name `string` #### Returns `string` \| `number` \| `boolean` *** ### reply() > **reply**(`options`): `Promise`\<\{ `message_id?`: `string`; \}\> Defined in: [zaun/js/index.d.ts:390](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L390) #### Parameters ##### options [`BotMessageOptions`](/docs/reference/js/zaun-client/type-aliases/botmessageoptions/) #### Returns `Promise`\<\{ `message_id?`: `string`; \}\> *** ### respond() > **respond**(`type`, `data?`): `Promise`\<\{ `message_id?`: `string`; \}\> Defined in: [zaun/js/index.d.ts:389](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L389) #### Parameters ##### type `number` ##### data? `unknown` #### Returns `Promise`\<\{ `message_id?`: `string`; \}\> *** ### showModal() > **showModal**(`modal`): `Promise`\<`unknown`\> Defined in: [zaun/js/index.d.ts:395](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L395) #### Parameters ##### modal [`ModalBuilder`](/docs/reference/js/zaun-client/classes/modalbuilder/) \| \{ `components`: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)[]; `custom_id`: `string`; `title`: `string`; \} #### Returns `Promise`\<`unknown`\> *** ### update() > **update**(`options`): `Promise`\<\{ `message_id?`: `string`; \}\> Defined in: [zaun/js/index.d.ts:393](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L393) #### Parameters ##### options [`BotMessageOptions`](/docs/reference/js/zaun-client/type-aliases/botmessageoptions/) #### Returns `Promise`\<\{ `message_id?`: `string`; \}\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/member/ --- # Member Defined in: [zaun/js/index.d.ts:776](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L776) ## Constructors ### Constructor > **new Member**(): `Member` #### Returns `Member` ## Properties ### botId > `readonly` **botId**: `string` Defined in: [zaun/js/index.d.ts:796](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L796) The bot this member is, if it is one. *** ### client > `readonly` **client**: [`Client`](/docs/reference/js/zaun-client/classes/client/) Defined in: [zaun/js/index.d.ts:777](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L777) *** ### community > `readonly` **community**: [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:778](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L778) *** ### data > `readonly` **data**: `any` Defined in: [zaun/js/index.d.ts:793](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L793) *** ### displayName > `readonly` **displayName**: `string` Defined in: [zaun/js/index.d.ts:782](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L782) *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:779](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L779) *** ### isBot > `readonly` **isBot**: `boolean` Defined in: [zaun/js/index.d.ts:797](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L797) *** ### isMe > `readonly` **isMe**: `boolean` Defined in: [zaun/js/index.d.ts:791](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L791) *** ### isTimedOut > `readonly` **isTimedOut**: `boolean` Defined in: [zaun/js/index.d.ts:785](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L785) *** ### joinedAt > `readonly` **joinedAt**: `Date` Defined in: [zaun/js/index.d.ts:783](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L783) *** ### partial > `readonly` **partial**: `boolean` Defined in: [zaun/js/index.d.ts:781](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L781) The cache does not have this member yet (`community.members.fetch()`). *** ### presence > `readonly` **presence**: [`Presence`](/docs/reference/js/zaun-client/interfaces/presence/) Defined in: [zaun/js/index.d.ts:787](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L787) presence: status and activity (`offline` when unknown). *** ### roles > `readonly` **roles**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Role`](/docs/reference/js/zaun-client/classes/role/)\> & `object` Defined in: [zaun/js/index.d.ts:792](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L792) #### Type Declaration ##### add() > **add**(`role`): `Promise`\<`void`\> ###### Parameters ###### role `string` \| [`Role`](/docs/reference/js/zaun-client/classes/role/) ###### Returns `Promise`\<`void`\> ##### remove() > **remove**(`role`): `Promise`\<`void`\> ###### Parameters ###### role `string` \| [`Role`](/docs/reference/js/zaun-client/classes/role/) ###### Returns `Promise`\<`void`\> *** ### statusEmoji > `readonly` **statusEmoji**: `string` Defined in: [zaun/js/index.d.ts:790](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L790) *** ### statusText > `readonly` **statusText**: `string` Defined in: [zaun/js/index.d.ts:789](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L789) Custom status text and emoji, if set. *** ### timedOutUntil > `readonly` **timedOutUntil**: `Date` Defined in: [zaun/js/index.d.ts:784](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L784) ## Methods ### ban() > **ban**(`reason?`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:801](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L801) #### Parameters ##### reason? `string` #### Returns `Promise`\<`void`\> *** ### canUse() > **canUse**(`command`, `channel?`): `boolean` Defined in: [zaun/js/index.d.ts:799](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L799) Whether this member may use bot `command` in `channel`, as the cache sees it. #### Parameters ##### command [`ApplicationCommandData`](/docs/reference/js/zaun-client/interfaces/applicationcommanddata/) ##### channel? `string` \| [`Channel`](/docs/reference/js/zaun-client/classes/channel/) #### Returns `boolean` *** ### dm() > **dm**(): `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)\> Defined in: [zaun/js/index.d.ts:809](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L809) DM: the direct message with this member, opened if needed. Rejects with `FORBIDDEN` (`dms_closed`) or `RATE_LIMITED` (`dms`). #### Returns `Promise`\<[`Channel`](/docs/reference/js/zaun-client/classes/channel/)\> *** ### fingerprint() > **fingerprint**(): `string` Defined in: [zaun/js/index.d.ts:804](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L804) #### Returns `string` *** ### kick() > **kick**(`reason?`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:800](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L800) #### Parameters ##### reason? `string` #### Returns `Promise`\<`void`\> *** ### mention() > **mention**(): `string` Defined in: [zaun/js/index.d.ts:806](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L806) `<@id>`: the text that shows a mention of this member. #### Returns `string` *** ### permissions() > **permissions**(`channel?`): [`Permissions`](/docs/reference/js/zaun-client/classes/permissions/) Defined in: [zaun/js/index.d.ts:794](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L794) #### Parameters ##### channel? `string` \| [`Channel`](/docs/reference/js/zaun-client/classes/channel/) #### Returns [`Permissions`](/docs/reference/js/zaun-client/classes/permissions/) *** ### send() > **send**(`options`): `Promise`\<[`Message`](/docs/reference/js/zaun-client/classes/message/)\> Defined in: [zaun/js/index.d.ts:811](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L811) DM: sends this member a direct message. #### Parameters ##### options [`MessageOptions`](/docs/reference/js/zaun-client/type-aliases/messageoptions/) #### Returns `Promise`\<[`Message`](/docs/reference/js/zaun-client/classes/message/)\> *** ### timeout() > **timeout**(`ms`, `reason?`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:803](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L803) For `ms` milliseconds; `null` lifts it. #### Parameters ##### ms `number` ##### reason? `string` #### Returns `Promise`\<`void`\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/message/ --- # Message Defined in: [zaun/js/index.d.ts:729](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L729) ## Constructors ### Constructor > **new Message**(): `Message` #### Returns `Message` ## Properties ### attachments > `readonly` **attachments**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/)\> Defined in: [zaun/js/index.d.ts:742](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L742) *** ### author > `readonly` **author**: [`Member`](/docs/reference/js/zaun-client/classes/member/) Defined in: [zaun/js/index.d.ts:736](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L736) *** ### authorId > `readonly` **authorId**: `string` Defined in: [zaun/js/index.d.ts:735](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L735) *** ### channel > `readonly` **channel**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/) Defined in: [zaun/js/index.d.ts:732](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L732) *** ### client > `readonly` **client**: [`Client`](/docs/reference/js/zaun-client/classes/client/) Defined in: [zaun/js/index.d.ts:730](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L730) *** ### community > `readonly` **community**: [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:731](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L731) *** ### components > `readonly` **components**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)[] Defined in: [zaun/js/index.d.ts:750](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L750) A bot's buttons, selects and layout; `null` on a partial message. *** ### content > **content**: `string` Defined in: [zaun/js/index.d.ts:734](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L734) *** ### createdAt > `readonly` **createdAt**: `Date` Defined in: [zaun/js/index.d.ts:739](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L739) *** ### editedAt > `readonly` **editedAt**: `Date` Defined in: [zaun/js/index.d.ts:740](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L740) *** ### embeds > **embeds**: [`Embed`](/docs/reference/js/zaun-client/classes/embed/)[] Defined in: [zaun/js/index.d.ts:745](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L745) Its embeds; on a partial message `null` when the event did not say (an edit that left them as they were). *** ### flags > `readonly` **flags**: `number` Defined in: [zaun/js/index.d.ts:752](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L752) MessageFlags bits. *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:733](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L733) *** ### interaction > `readonly` **interaction**: `object` Defined in: [zaun/js/index.d.ts:754](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L754) The interaction a bot's reply answers. #### interaction\_id > **interaction\_id**: `string` #### member\_id > **member\_id**: `string` #### name? > `optional` **name?**: `string` #### type > **type**: `number` *** ### loading > `readonly` **loading**: `boolean` Defined in: [zaun/js/index.d.ts:756](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L756) A deferred bot reply still "thinking…". *** ### mentions > **mentions**: [`MessageMentions`](/docs/reference/js/zaun-client/classes/messagementions/) Defined in: [zaun/js/index.d.ts:760](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L760) Who it mentions; `null` on a partial message whose event did not say (an edit that left them as they were). On a message `send` returns, and after an `edit` that named some, the ones asked for (the host may have dropped some). *** ### mentionsMe > `readonly` **mentionsMe**: `boolean` Defined in: [zaun/js/index.d.ts:762](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L762) Whether it mentions this client's member: by id, by one of its roles, or `@everyone`. *** ### mine > `readonly` **mine**: `boolean` Defined in: [zaun/js/index.d.ts:737](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L737) *** ### partial > `readonly` **partial**: `boolean` Defined in: [zaun/js/index.d.ts:748](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L748) Known only by what an event said (no history is kept): its id, and for an edit its new text and author. It still acts: reply, edit, delete, react. *** ### replyTo > `readonly` **replyTo**: `string` Defined in: [zaun/js/index.d.ts:741](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L741) *** ### sequence > `readonly` **sequence**: `number` Defined in: [zaun/js/index.d.ts:738](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L738) *** ### silent > `readonly` **silent**: `boolean` Defined in: [zaun/js/index.d.ts:764](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L764) Sent with SuppressNotifications: its mentions notify nobody. ## Methods ### click() > **click**(`customId`, `values?`): `Promise`\<`string`\> Defined in: [zaun/js/index.d.ts:766](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L766) Clicks a button, or chooses `values` in a select; resolves with the interaction id. #### Parameters ##### customId `string` ##### values? `string`[] #### Returns `Promise`\<`string`\> *** ### delete() > **delete**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:771](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L771) #### Returns `Promise`\<`void`\> *** ### edit() > **edit**(`options`): `Promise`\<`Message`\> Defined in: [zaun/js/index.d.ts:770](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L770) Resolves with this message, its `content`, `embeds` and (when the edit named any) `mentions` as sent. #### Parameters ##### options [`MessageEditOptions`](/docs/reference/js/zaun-client/type-aliases/messageeditoptions/) #### Returns `Promise`\<`Message`\> *** ### react() > **react**(`emoji`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:772](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L772) #### Parameters ##### emoji `string` #### Returns `Promise`\<`void`\> *** ### reply() > **reply**(`options`): `Promise`\<`Message`\> Defined in: [zaun/js/index.d.ts:767](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L767) #### Parameters ##### options [`MessageOptions`](/docs/reference/js/zaun-client/type-aliases/messageoptions/) #### Returns `Promise`\<`Message`\> *** ### unreact() > **unreact**(`emoji`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:773](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L773) #### Parameters ##### emoji `string` #### Returns `Promise`\<`void`\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/messagementions/ --- # MessageMentions Defined in: [zaun/js/index.d.ts:599](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L599) Who a message mentions, as the host honoured them. ## Constructors ### Constructor > **new MessageMentions**(): `MessageMentions` #### Returns `MessageMentions` ## Properties ### empty > `readonly` **empty**: `boolean` Defined in: [zaun/js/index.d.ts:608](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L608) *** ### everyone > `readonly` **everyone**: `boolean` Defined in: [zaun/js/index.d.ts:600](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L600) *** ### memberIds > `readonly` **memberIds**: `string`[] Defined in: [zaun/js/index.d.ts:601](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L601) *** ### members > `readonly` **members**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\> Defined in: [zaun/js/index.d.ts:604](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L604) id → Member, from the community cache (partial until it has them). *** ### roleIds > `readonly` **roleIds**: `string`[] Defined in: [zaun/js/index.d.ts:602](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L602) *** ### roles > `readonly` **roles**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Role`](/docs/reference/js/zaun-client/classes/role/)\> Defined in: [zaun/js/index.d.ts:607](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L607) *** ### users > `readonly` **users**: [`Collection`](/docs/reference/js/zaun-client/classes/collection/)\<`string`, [`Member`](/docs/reference/js/zaun-client/classes/member/)\> Defined in: [zaun/js/index.d.ts:606](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L606) Same as `members`. ## Methods ### has() > **has**(`target`, `options?`): `boolean` Defined in: [zaun/js/index.d.ts:610](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L610) Whether `target` is named, mentioned by `@everyone`, or (a member) by one of its roles. #### Parameters ##### target `string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/) \| [`Role`](/docs/reference/js/zaun-client/classes/role/) ##### options? ###### ignoreEveryone? `boolean` ###### ignoreRoles? `boolean` #### Returns `boolean` *** ### toJSON() > **toJSON**(): [`MentionsData`](/docs/reference/js/zaun-client/interfaces/mentionsdata/) Defined in: [zaun/js/index.d.ts:611](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L611) #### Returns [`MentionsData`](/docs/reference/js/zaun-client/interfaces/mentionsdata/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/modalbuilder/ --- # ModalBuilder Defined in: [zaun/js/index.d.ts:442](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L442) ## Extends - `Builder`\<\{ `components`: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)[]; `custom_id`: `string`; `title`: `string`; \}\> ## Constructors ### Constructor > **new ModalBuilder**(`data?`): `ModalBuilder` Defined in: [zaun/js/index.d.ts:443](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L443) #### Parameters ##### data? `object` #### Returns `ModalBuilder` #### Overrides `Builder<{ custom_id: string; title: string; components: ComponentData[] }>.constructor` ## Properties ### data > **data**: `object` Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### components > **components**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)[] #### custom\_id > **custom\_id**: `string` #### title > **title**: `string` #### Inherited from `Builder.data` ## Methods ### addField() > **addField**(`label`, `input`, `description?`): `this` Defined in: [zaun/js/index.d.ts:446](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L446) #### Parameters ##### label `string` ##### input [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \} ##### description? `string` #### Returns `this` *** ### addText() > **addText**(`content`): `this` Defined in: [zaun/js/index.d.ts:447](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L447) #### Parameters ##### content `string` #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [zaun/js/index.d.ts:444](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L444) #### Parameters ##### id `string` #### Returns `this` *** ### setTitle() > **setTitle**(`title`): `this` Defined in: [zaun/js/index.d.ts:445](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L445) #### Parameters ##### title `string` #### Returns `this` *** ### toJSON() > **toJSON**(): `object` Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns `object` ##### components > **components**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)[] ##### custom\_id > **custom\_id**: `string` ##### title > **title**: `string` #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/permissions/ --- # Permissions Defined in: [zaun/js/index.d.ts:72](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L72) ## Constructors ### Constructor > **new Permissions**(`bits?`): `Permissions` Defined in: [zaun/js/index.d.ts:75](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L75) #### Parameters ##### bits? [`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/) #### Returns `Permissions` ## Properties ### bitfield > **bitfield**: `bigint` Defined in: [zaun/js/index.d.ts:76](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L76) *** ### Flags > `static` **Flags**: `Record`\<[`PermissionFlag`](/docs/reference/js/zaun-client/type-aliases/permissionflag/), `bigint`\> Defined in: [zaun/js/index.d.ts:73](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L73) ## Methods ### has() > **has**(`flag`): `boolean` Defined in: [zaun/js/index.d.ts:77](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L77) #### Parameters ##### flag [`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/) #### Returns `boolean` *** ### toArray() > **toArray**(): [`PermissionFlag`](/docs/reference/js/zaun-client/type-aliases/permissionflag/)[] Defined in: [zaun/js/index.d.ts:78](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L78) #### Returns [`PermissionFlag`](/docs/reference/js/zaun-client/type-aliases/permissionflag/)[] *** ### resolve() > `static` **resolve**(`p`): `bigint` Defined in: [zaun/js/index.d.ts:74](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L74) #### Parameters ##### p [`PermissionResolvable`](/docs/reference/js/zaun-client/type-aliases/permissionresolvable/) #### Returns `bigint` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/rawclient/ --- # RawClient Defined in: zaun/pkg/web/zaun\_client.d.ts:2 The low-level wasm-bindgen client (see the Rust API). ## Constructors ### Constructor > **new RawClient**(): `RawClient` #### Returns `RawClient` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/role/ --- # Role Defined in: [zaun/js/index.d.ts:814](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L814) ## Constructors ### Constructor > **new Role**(): `Role` #### Returns `Role` ## Properties ### color > `readonly` **color**: `number` Defined in: [zaun/js/index.d.ts:818](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L818) *** ### community > `readonly` **community**: [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:815](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L815) *** ### id > `readonly` **id**: `string` Defined in: [zaun/js/index.d.ts:816](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L816) *** ### managedBy > `readonly` **managedBy**: `string` Defined in: [zaun/js/index.d.ts:822](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L822) The bot whose managed role this is. *** ### name > `readonly` **name**: `string` Defined in: [zaun/js/index.d.ts:817](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L817) *** ### permissions > `readonly` **permissions**: [`Permissions`](/docs/reference/js/zaun-client/classes/permissions/) Defined in: [zaun/js/index.d.ts:820](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L820) *** ### position > `readonly` **position**: `number` Defined in: [zaun/js/index.d.ts:819](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L819) ## Methods ### delete() > **delete**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:825](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L825) #### Returns `Promise`\<`void`\> *** ### mention() > **mention**(): `string` Defined in: [zaun/js/index.d.ts:824](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L824) `<@&id>`: the text that shows a mention of this role. #### Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/selectbuilder/ --- # SelectBuilder Defined in: [zaun/js/index.d.ts:422](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L422) ## Extends - `Builder`\<[`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)\> ## Constructors ### Constructor > **new SelectBuilder**(`type?`, `data?`): `SelectBuilder` Defined in: [zaun/js/index.d.ts:423](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L423) #### Parameters ##### type? `number` ##### data? `object` #### Returns `SelectBuilder` #### Overrides `Builder.constructor` ## Properties ### data > **data**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### Inherited from `Builder.data` ## Methods ### addOption() > **addOption**(`label`, `value`, `more?`): `this` Defined in: [zaun/js/index.d.ts:427](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L427) #### Parameters ##### label `string` ##### value `string` ##### more? ###### default? `boolean` ###### description? `string` ###### emoji? `string` #### Returns `this` *** ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [zaun/js/index.d.ts:424](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L424) #### Parameters ##### id `string` #### Returns `this` *** ### setPlaceholder() > **setPlaceholder**(`text`): `this` Defined in: [zaun/js/index.d.ts:425](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L425) #### Parameters ##### text `string` #### Returns `this` *** ### setRange() > **setRange**(`min`, `max`): `this` Defined in: [zaun/js/index.d.ts:426](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L426) #### Parameters ##### min `number` ##### max `number` #### Returns `this` *** ### toJSON() > **toJSON**(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/simplexclient/ --- # SimplexClient Defined in: zaun/pkg/web/zaun\_client.d.ts:4 The SimpleX client the wasm module runs. ## Constructors ### Constructor > **new SimplexClient**(): `SimplexClient` #### Returns `SimplexClient` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/textinputbuilder/ --- # TextInputBuilder Defined in: [zaun/js/index.d.ts:433](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L433) ## Extends - `Builder`\<[`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/)\> ## Constructors ### Constructor > **new TextInputBuilder**(`data?`): `TextInputBuilder` Defined in: [zaun/js/index.d.ts:434](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L434) #### Parameters ##### data? `object` #### Returns `TextInputBuilder` #### Overrides `Builder.constructor` ## Properties ### data > **data**: [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:410](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L410) #### Inherited from `Builder.data` ## Methods ### setCustomId() > **setCustomId**(`id`): `this` Defined in: [zaun/js/index.d.ts:435](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L435) #### Parameters ##### id `string` #### Returns `this` *** ### setLength() > **setLength**(`min`, `max`): `this` Defined in: [zaun/js/index.d.ts:437](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L437) #### Parameters ##### min `number` ##### max `number` #### Returns `this` *** ### setPlaceholder() > **setPlaceholder**(`text`): `this` Defined in: [zaun/js/index.d.ts:439](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L439) #### Parameters ##### text `string` #### Returns `this` *** ### setRequired() > **setRequired**(`required?`): `this` Defined in: [zaun/js/index.d.ts:438](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L438) #### Parameters ##### required? `boolean` #### Returns `this` *** ### setStyle() > **setStyle**(`style`): `this` Defined in: [zaun/js/index.d.ts:436](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L436) #### Parameters ##### style `number` #### Returns `this` *** ### setValue() > **setValue**(`text`): `this` Defined in: [zaun/js/index.d.ts:440](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L440) #### Parameters ##### text `string` #### Returns `this` *** ### toJSON() > **toJSON**(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) Defined in: [zaun/js/index.d.ts:411](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L411) #### Returns [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) #### Inherited from `Builder.toJSON` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/voiceconnection/ --- # VoiceConnection Defined in: [zaun/js/index.d.ts:843](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L843) ## Constructors ### Constructor > **new VoiceConnection**(): `VoiceConnection` #### Returns `VoiceConnection` ## Properties ### canSend > `readonly` **canSend**: `boolean` Defined in: [zaun/js/index.d.ts:846](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L846) *** ### channel > `readonly` **channel**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/) Defined in: [zaun/js/index.d.ts:844](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L844) *** ### community > `readonly` **community**: [`Community`](/docs/reference/js/zaun-client/classes/community/) Defined in: [zaun/js/index.d.ts:845](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L845) ## Methods ### deafen() > **deafen**(`on?`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:859](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L859) #### Parameters ##### on? `boolean` #### Returns `Promise`\<`void`\> *** ### disconnect() > **disconnect**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:861](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L861) #### Returns `Promise`\<`void`\> *** ### mute() > **mute**(`on?`): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:857](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L857) #### Parameters ##### on? `boolean` #### Returns `Promise`\<`void`\> *** ### off() > **off**\<`E`\>(`name`, `f`): `this` Defined in: [zaun/js/index.d.ts:849](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L849) #### Type Parameters ##### E `E` *extends* keyof [`VoiceEvents`](/docs/reference/js/zaun-client/interfaces/voiceevents/) #### Parameters ##### name `E` ##### f (...`args`) => `void` #### Returns `this` *** ### on() > **on**\<`E`\>(`name`, `f`): `this` Defined in: [zaun/js/index.d.ts:848](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L848) #### Type Parameters ##### E `E` *extends* keyof [`VoiceEvents`](/docs/reference/js/zaun-client/interfaces/voiceevents/) #### Parameters ##### name `E` ##### f (...`args`) => `void` #### Returns `this` *** ### play() > **play**(`file`): `object` Defined in: [zaun/js/index.d.ts:856](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L856) Node.js and Bun: plays an Ogg Opus file (bytes, or a path in Node.js) in real time. #### Parameters ##### file `string` \| `Uint8Array`\<`ArrayBufferLike`\> #### Returns `object` ##### finished > **finished**: `Promise`\<`void`\> ##### stop() > **stop**(): `void` ###### Returns `void` *** ### sendAudio() > **sendAudio**(`frame`): `number` Defined in: [zaun/js/index.d.ts:854](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L854) Node.js and Bun: sends one Opus packet, sealed for each peer, in real time; returns to how many peers it went. #### Parameters ##### frame `Uint8Array` #### Returns `number` *** ### setTrack() > **setTrack**(`track`): `void` Defined in: [zaun/js/index.d.ts:851](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L851) Browsers: sends `track`, or nothing with null. #### Parameters ##### track `MediaStreamTrack` #### Returns `void` *** ### stats() > **stats**(): `object` Defined in: [zaun/js/index.d.ts:847](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L847) #### Returns `object` ##### received > **received**: `number` ##### refused > **refused**: `number` ##### sent > **sent**: `number` *** ### undeafen() > **undeafen**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:860](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L860) #### Returns `Promise`\<`void`\> *** ### unmute() > **unmute**(): `Promise`\<`void`\> Defined in: [zaun/js/index.d.ts:858](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L858) #### Returns `Promise`\<`void`\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/classes/zaunerror/ --- # ZaunError Defined in: [zaun/js/index.d.ts:43](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L43) ## Extends - `Error` ## Constructors ### Constructor > **new ZaunError**(`message?`): `ZaunError` Defined in: ../../../node\_modules/typescript/lib/lib.es5.d.ts:1082 #### Parameters ##### message? `string` #### Returns `ZaunError` #### Inherited from `Error.constructor` ### Constructor > **new ZaunError**(`message?`, `options?`): `ZaunError` Defined in: ../../../node\_modules/typescript/lib/lib.es5.d.ts:1082 #### Parameters ##### message? `string` ##### options? `ErrorOptions` #### Returns `ZaunError` #### Inherited from `Error.constructor` ## Properties ### body? > `optional` **body?**: `unknown` Defined in: [zaun/js/index.d.ts:49](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L49) *** ### code > **code**: `string` Defined in: [zaun/js/index.d.ts:46](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L46) Lowercase for a local failure (`timeout`, `closed`, `bad_link`, `unsupported`, …), or the host's own code (`FORBIDDEN`, `RATE_LIMITED`, …). *** ### command? > `optional` **command?**: `string` Defined in: [zaun/js/index.d.ts:48](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L48) The command the host refused. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/inspectpackage/ --- # inspectPackage > **inspectPackage**(`bytes`): `Promise`\<[`PackageInspection`](/docs/reference/js/zaun-client/interfaces/packageinspection/)\> Defined in: [zaun/js/index.d.ts:313](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L313) What a `.zbot` file says, whether it is signed, and whether it passes the registry's checks. ## Parameters ### bytes `Bytes` ## Returns `Promise`\<[`PackageInspection`](/docs/reference/js/zaun-client/interfaces/packageinspection/)\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/membermention/ --- # memberMention > **memberMention**(`member`): `string` Defined in: [zaun/js/index.d.ts:617](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L617) Same as `userMention`. ## Parameters ### member `string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/) ## Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/parsementions/ --- # parseMentions > **parseMentions**(`content`): [`MentionsData`](/docs/reference/js/zaun-client/interfaces/mentionsdata/) Defined in: [zaun/js/index.d.ts:623](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L623) The mentions the text shows: `<@id>`, `<@!id>`, `<@&id>`, `@everyone`; each id once, at most 50 members and 20 roles. ## Parameters ### content `string` ## Returns [`MentionsData`](/docs/reference/js/zaun-client/interfaces/mentionsdata/) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/registrykeyid/ --- # registryKeyId > **registryKeyId**(`key`): `Promise`\<\{ `errors`: [`RegistryError`](/docs/reference/js/zaun-client/interfaces/registryerror/)[]; `id`: `string`; `ok`: `boolean`; \}\> Defined in: [zaun/js/index.d.ts:315](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L315) The id of a base64url public key, as a bot card's `source.registry_id` names it. ## Parameters ### key `string` ## Returns `Promise`\<\{ `errors`: [`RegistryError`](/docs/reference/js/zaun-client/interfaces/registryerror/)[]; `id`: `string`; `ok`: `boolean`; \}\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/rolemention/ --- # roleMention > **roleMention**(`role`): `string` Defined in: [zaun/js/index.d.ts:619](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L619) `<@&id>`: the text that shows a role mention. ## Parameters ### role `string` \| [`Role`](/docs/reference/js/zaun-client/classes/role/) ## Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/usermention/ --- # userMention > **userMention**(`member`): `string` Defined in: [zaun/js/index.d.ts:615](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L615) `<@id>`: the text that shows a member mention. ## Parameters ### member `string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/) ## Returns `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/verifycatalog/ --- # verifyCatalog > **verifyCatalog**(`bytes`, `signature`, `pinnedKeys`, `options?`): `Promise`\<[`CatalogVerification`](/docs/reference/js/zaun-client/interfaces/catalogverification/)\> Defined in: [zaun/js/index.d.ts:297](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L297) Verifies `catalog.json` (exact bytes) and `catalog.json.sig` against the pinned key (base64url) whose id the catalog names. `now`: Unix seconds or a Date (default: this device's clock). `seen`: what an earlier success returned for this registry, so a rollback is refused. ## Parameters ### bytes `Bytes` ### signature `string` \| `Uint8Array`\<`ArrayBufferLike`\> ### pinnedKeys `string` \| `string`[] ### options? #### now? `number` \| `Date` #### seen? [`CatalogSeen`](/docs/reference/js/zaun-client/interfaces/catalogseen/) ## Returns `Promise`\<[`CatalogVerification`](/docs/reference/js/zaun-client/interfaces/catalogverification/)\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/functions/verifyhistory/ --- # verifyHistory > **verifyHistory**(`catalogBytes`, `signature`, `pinnedKeys`, `appId`, `historyBytes`, `options?`): `Promise`\<[`HistoryVerification`](/docs/reference/js/zaun-client/interfaces/historyverification/)\> Defined in: [zaun/js/index.d.ts:304](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L304) Verifies the catalog, then `history/.json` against the hash it lists. ## Parameters ### catalogBytes `Bytes` ### signature `string` \| `Uint8Array`\<`ArrayBufferLike`\> ### pinnedKeys `string` \| `string`[] ### appId `string` ### historyBytes `Bytes` ### options? #### now? `number` \| `Date` ## Returns `Promise`\<[`HistoryVerification`](/docs/reference/js/zaun-client/interfaces/historyverification/)\> --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/activity/ --- # Activity Defined in: [zaun/js/index.d.ts:8](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L8) presence: what a member is doing. ## Properties ### details? > `optional` **details?**: `string` Defined in: [zaun/js/index.d.ts:11](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L11) *** ### emoji? > `optional` **emoji?**: `string` Defined in: [zaun/js/index.d.ts:17](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L17) custom only. *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:10](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L10) *** ### started\_at? > `optional` **started\_at?**: `number` Defined in: [zaun/js/index.d.ts:15](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L15) *** ### state? > `optional` **state?**: `string` Defined in: [zaun/js/index.d.ts:12](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L12) *** ### type > **type**: `"playing"` \| `"streaming"` \| `"listening"` \| `"watching"` \| `"competing"` \| `"custom"` Defined in: [zaun/js/index.d.ts:9](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L9) *** ### url? > `optional` **url?**: `string` Defined in: [zaun/js/index.d.ts:14](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L14) streaming only: an https link, opened only after the reader confirms. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/allowedmentions/ --- # AllowedMentions Defined in: [zaun/js/index.d.ts:585](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L585) other libraries's `allowedMentions`, applied to the mentions the content shows. ## Properties ### parse? > `optional` **parse?**: (`"users"` \| `"roles"` \| `"everyone"`)[] Defined in: [zaun/js/index.d.ts:586](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L586) *** ### roles? > `optional` **roles?**: (`string` \| [`Role`](/docs/reference/js/zaun-client/classes/role/))[] Defined in: [zaun/js/index.d.ts:588](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L588) *** ### users? > `optional` **users?**: (`string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/))[] Defined in: [zaun/js/index.d.ts:587](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L587) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/applicationcommanddata/ --- # ApplicationCommandData Defined in: [zaun/js/index.d.ts:332](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L332) ## Properties ### bot\_id? > `optional` **bot\_id?**: `string` Defined in: [zaun/js/index.d.ts:334](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L334) *** ### command\_id? > `optional` **command\_id?**: `string` Defined in: [zaun/js/index.d.ts:333](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L333) *** ### default\_member\_permissions? > `optional` **default\_member\_permissions?**: `string` Defined in: [zaun/js/index.d.ts:340](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L340) *** ### description? > `optional` **description?**: `string` Defined in: [zaun/js/index.d.ts:338](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L338) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:337](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L337) *** ### options? > `optional` **options?**: [`CommandOptionData`](/docs/reference/js/zaun-client/interfaces/commandoptiondata/)[] Defined in: [zaun/js/index.d.ts:339](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L339) *** ### type? > `optional` **type?**: `number` Defined in: [zaun/js/index.d.ts:336](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L336) ApplicationCommandType: 1 slash, 2 user, 3 message. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/botcapabilities/ --- # BotCapabilities Defined in: [zaun/js/index.d.ts:147](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L147) ## Properties ### attachments? > `optional` **attachments?**: `boolean` Defined in: [zaun/js/index.d.ts:152](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L152) *** ### local\_network? > `optional` **local\_network?**: `string`[] Defined in: [zaun/js/index.d.ts:157](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L157) Exact `host:port` addresses next to the host it may reach (≤ 8); only the operator's ceiling lets any be granted. Absent when none. *** ### members? > `optional` **members?**: `boolean` Defined in: [zaun/js/index.d.ts:149](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L149) *** ### message\_content? > `optional` **message\_content?**: `boolean` Defined in: [zaun/js/index.d.ts:148](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L148) *** ### network? > `optional` **network?**: `string`[] Defined in: [zaun/js/index.d.ts:154](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L154) *** ### presence? > `optional` **presence?**: `boolean` Defined in: [zaun/js/index.d.ts:150](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L150) *** ### storage\_bytes? > `optional` **storage\_bytes?**: `number` Defined in: [zaun/js/index.d.ts:153](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L153) *** ### timers? > `optional` **timers?**: `boolean` Defined in: [zaun/js/index.d.ts:151](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L151) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/botcard/ --- # BotCard Defined in: [zaun/js/index.d.ts:170](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L170) A bot's public card: every member can read what it was granted. ## Properties ### app\_id > **app\_id**: `string` Defined in: [zaun/js/index.d.ts:173](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L173) *** ### bot\_id > **bot\_id**: `string` Defined in: [zaun/js/index.d.ts:171](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L171) *** ### capabilities > **capabilities**: `Required`\<`Omit`\<[`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/), `"local_network"`\>\> & `Pick`\<[`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/), `"local_network"`\> Defined in: [zaun/js/index.d.ts:182](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L182) *** ### config? > `optional` **config?**: `Record`\<`string`, [`BotConfigKey`](/docs/reference/js/zaun-client/interfaces/botconfigkey/)\> Defined in: [zaun/js/index.d.ts:186](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L186) The settings it declares, never their values (absent when none). *** ### description? > `optional` **description?**: `string` Defined in: [zaun/js/index.d.ts:175](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L175) *** ### events > **events**: `string`[] Defined in: [zaun/js/index.d.ts:184](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L184) *** ### granted\_at > **granted\_at**: `number` Defined in: [zaun/js/index.d.ts:190](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L190) *** ### installed\_at > **installed\_at**: `number` Defined in: [zaun/js/index.d.ts:187](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L187) *** ### installed\_by > **installed\_by**: `string` Defined in: [zaun/js/index.d.ts:188](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L188) *** ### kind > **kind**: `"hosted"` \| `"external"` Defined in: [zaun/js/index.d.ts:179](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L179) *** ### member\_id > **member\_id**: `string` Defined in: [zaun/js/index.d.ts:172](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L172) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:174](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L174) *** ### permissions > **permissions**: `string` Defined in: [zaun/js/index.d.ts:181](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L181) *** ### publisher > **publisher**: `string` Defined in: [zaun/js/index.d.ts:177](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L177) *** ### requested? > `optional` **requested?**: `object` Defined in: [zaun/js/index.d.ts:183](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L183) #### capabilities > **capabilities**: [`BotCapabilities`](/docs/reference/js/zaun-client/interfaces/botcapabilities/) #### permissions > **permissions**: `string` *** ### signed > **signed**: `boolean` Defined in: [zaun/js/index.d.ts:178](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L178) *** ### source? > `optional` **source?**: [`BotSource`](/docs/reference/js/zaun-client/interfaces/botsource/) Defined in: [zaun/js/index.d.ts:194](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L194) Where the host confirmed the running version came from; absent from older hosts and for bots installed before they recorded it (read that as `direct`). `kind` is the host's claim: show Official or Community only when `registry_id` is also the key id you pin. *** ### state > **state**: `"enabled"` \| `"disabled"` \| `"pending_approval"` \| `"crashed"` Defined in: [zaun/js/index.d.ts:180](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L180) *** ### updated\_at > **updated\_at**: `number` Defined in: [zaun/js/index.d.ts:189](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L189) *** ### version > **version**: `string` Defined in: [zaun/js/index.d.ts:176](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L176) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/botconfigkey/ --- # BotConfigKey Defined in: [zaun/js/index.d.ts:161](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L161) A setting a bot's manifest declares; the owner sets its value. ## Properties ### default? > `optional` **default?**: `string` Defined in: [zaun/js/index.d.ts:164](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L164) Used while the owner has set nothing; never for a secret. *** ### description > **description**: `string` Defined in: [zaun/js/index.d.ts:162](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L162) *** ### secret? > `optional` **secret?**: `boolean` Defined in: [zaun/js/index.d.ts:166](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L166) Masked wherever it is shown. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/botsource/ --- # BotSource Defined in: [zaun/js/index.d.ts:198](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L198) A bot card's `source`. An unknown `kind` reads as `direct`. ## Properties ### kind > **kind**: `"official"` \| `"community"` \| `"third_party"` \| `"direct"` Defined in: [zaun/js/index.d.ts:199](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L199) *** ### registry\_id? > `optional` **registry\_id?**: `string` Defined in: [zaun/js/index.d.ts:201](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L201) The registry key's id (`registryKeyId` of the key), present unless `direct`. *** ### registry\_name? > `optional` **registry\_name?**: `string` Defined in: [zaun/js/index.d.ts:203](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L203) The host operator's name for the registry: a label, never trust. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/catalogseen/ --- # CatalogSeen Defined in: [zaun/js/index.d.ts:227](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L227) What to store for a registry after a success, and pass back as `seen` next time. ## Properties ### serial > **serial**: `number` Defined in: [zaun/js/index.d.ts:228](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L228) *** ### sha3 > **sha3**: `string` Defined in: [zaun/js/index.d.ts:229](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L229) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/catalogverification/ --- # CatalogVerification Defined in: [zaun/js/index.d.ts:234](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L234) `verifyCatalog`'s report. `ok` false: only `errors` holds. `ok` but not `installable`: the catalog expired; show it with its advisories, never install or update from it. ## Properties ### bots > **bots**: `number` Defined in: [zaun/js/index.d.ts:247](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L247) How many bots it lists. *** ### catalog > **catalog**: `any` Defined in: [zaun/js/index.d.ts:252](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L252) The verified catalog (registry-spec format); `null` unless `ok`. *** ### errors > **errors**: [`RegistryError`](/docs/reference/js/zaun-client/interfaces/registryerror/)[] Defined in: [zaun/js/index.d.ts:253](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L253) *** ### expired > **expired**: `boolean` Defined in: [zaun/js/index.d.ts:245](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L245) *** ### expires > **expires**: `number` Defined in: [zaun/js/index.d.ts:244](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L244) *** ### installable > **installable**: `boolean` Defined in: [zaun/js/index.d.ts:236](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L236) *** ### issued\_at > **issued\_at**: `number` Defined in: [zaun/js/index.d.ts:243](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L243) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:240](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L240) The registry's own name and profile: claims, never a badge. *** ### ok > **ok**: `boolean` Defined in: [zaun/js/index.d.ts:235](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L235) *** ### profile > **profile**: `"official"` \| `"community"` \| `"private"` Defined in: [zaun/js/index.d.ts:241](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L241) *** ### registry\_id > **registry\_id**: `string` Defined in: [zaun/js/index.d.ts:238](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L238) The id of the pinned key that verified it. *** ### seen > **seen**: [`CatalogSeen`](/docs/reference/js/zaun-client/interfaces/catalogseen/) Defined in: [zaun/js/index.d.ts:250](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L250) *** ### serial > **serial**: `number` Defined in: [zaun/js/index.d.ts:242](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L242) *** ### sha3 > **sha3**: `string` Defined in: [zaun/js/index.d.ts:249](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L249) SHA3-256 of the catalog bytes, hex. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/clientevents/ --- # ClientEvents Defined in: [zaun/js/index.d.ts:880](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L880) ## Properties ### appsReady > **appsReady**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/)\] Defined in: [zaun/js/index.d.ts:921](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L921) The community's bots and their commands loaded (just after `ready`). *** ### autocomplete > **autocomplete**: \[`suggestions`: `object`\] Defined in: [zaun/js/index.d.ts:934](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L934) *** ### botRemove > **botRemove**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `botId`: `string`, `member`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:928](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L928) *** ### botUpdate > **botUpdate**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `card`: [`BotCard`](/docs/reference/js/zaun-client/interfaces/botcard/)\] Defined in: [zaun/js/index.d.ts:927](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L927) *** ### change > **change**: \[\] Defined in: [zaun/js/index.d.ts:918](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L918) *** ### channelCreate > **channelCreate**: \[`channel`: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\] Defined in: [zaun/js/index.d.ts:888](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L888) *** ### channelDelete > **channelDelete**: \[`channel`: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\] Defined in: [zaun/js/index.d.ts:890](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L890) *** ### channelUpdate > **channelUpdate**: \[`channel`: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\] Defined in: [zaun/js/index.d.ts:889](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L889) *** ### commandsUpdate > **commandsUpdate**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `botId`: `string`\] Defined in: [zaun/js/index.d.ts:926](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L926) *** ### communityDelete > **communityDelete**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `reason`: `object`\] Defined in: [zaun/js/index.d.ts:902](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L902) This member left, or was kicked or banned, and the community is forgotten here. A removal while this client was away arrives on its next session (a host after 0.4.0 says it again after the welcome; a 0.4.0 host does not, and the community stays unreachable until it is joined again). `reason.t`: `"left"`, `"kicked"`, `"banned"`, `"rejected"`, `"expired"`. *** ### communityMoved > **communityMoved**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `host`: `string`\] Defined in: [zaun/js/index.d.ts:908](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L908) *** ### communityMoveRefused > **communityMoveRefused**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `code`: `string`\] Defined in: [zaun/js/index.d.ts:909](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L909) *** ### communityMoving > **communityMoving**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/), `host`: `string`\] Defined in: [zaun/js/index.d.ts:907](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L907) *** ### communityUpdate > **communityUpdate**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/)\] Defined in: [zaun/js/index.d.ts:897](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L897) *** ### disconnect > **disconnect**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/)\] Defined in: [zaun/js/index.d.ts:910](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L910) *** ### dmCreate > **dmCreate**: \[`channel`: [`Channel`](/docs/reference/js/zaun-client/classes/channel/), `recipient`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:912](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L912) DM: a direct message became known (opened by either side, or on load). *** ### dmDelete > **dmDelete**: \[`channel`: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\] Defined in: [zaun/js/index.d.ts:914](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L914) DM: this member closed a direct message. *** ### interactionCreate > **interactionCreate**: \[`interaction`: [`Interaction`](/docs/reference/js/zaun-client/classes/interaction/)\] Defined in: [zaun/js/index.d.ts:930](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L930) As a bot: someone used one of this bot's commands, components or modals. *** ### interactionFail > **interactionFail**: \[`failure`: `object`\] Defined in: [zaun/js/index.d.ts:935](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L935) *** ### interactionReply > **interactionReply**: \[`reply`: `object`\] Defined in: [zaun/js/index.d.ts:932](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L932) A bot's ephemeral reply: only this member sees it, nothing keeps it; key by `message.id`. *** ### memberAdd > **memberAdd**: \[`member`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:894](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L894) *** ### memberRemove > **memberRemove**: \[`member`: [`Member`](/docs/reference/js/zaun-client/classes/member/), `reason`: `unknown`\] Defined in: [zaun/js/index.d.ts:896](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L896) *** ### memberUpdate > **memberUpdate**: \[`member`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:895](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L895) *** ### messageCreate > **messageCreate**: \[`message`: [`Message`](/docs/reference/js/zaun-client/classes/message/)\] Defined in: [zaun/js/index.d.ts:882](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L882) *** ### messageDelete > **messageDelete**: \[`message`: [`Message`](/docs/reference/js/zaun-client/classes/message/), `by`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:884](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L884) *** ### messageDeleteBulk > **messageDeleteBulk**: \[`messages`: [`Message`](/docs/reference/js/zaun-client/classes/message/)[], `channel`: [`Channel`](/docs/reference/js/zaun-client/classes/channel/)\] Defined in: [zaun/js/index.d.ts:885](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L885) *** ### messageReactionAdd > **messageReactionAdd**: \[`reaction`: `object`, `member`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:886](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L886) *** ### messageReactionRemove > **messageReactionRemove**: \[`reaction`: `object`, `member`: [`Member`](/docs/reference/js/zaun-client/classes/member/)\] Defined in: [zaun/js/index.d.ts:887](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L887) *** ### messageUpdate > **messageUpdate**: \[`message`: [`Message`](/docs/reference/js/zaun-client/classes/message/)\] Defined in: [zaun/js/index.d.ts:883](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L883) *** ### modalOpen > **modalOpen**: \[`modal`: `object`\] Defined in: [zaun/js/index.d.ts:933](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L933) *** ### offline > **offline**: \[\] Defined in: [zaun/js/index.d.ts:915](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L915) *** ### online > **online**: \[\] Defined in: [zaun/js/index.d.ts:916](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L916) *** ### presencesReady > **presencesReady**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/)\] Defined in: [zaun/js/index.d.ts:923](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L923) presence: who is online loaded (after `ready`). *** ### presenceUpdate > **presenceUpdate**: \[`presence`: [`Presence`](/docs/reference/js/zaun-client/interfaces/presence/) & `object`\] Defined in: [zaun/js/index.d.ts:925](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L925) presence: a member's status or activity changed. *** ### raw > **raw**: \[`update`: `object`\] Defined in: [zaun/js/index.d.ts:919](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L919) *** ### ready > **ready**: \[`community`: [`Community`](/docs/reference/js/zaun-client/classes/community/)\] Defined in: [zaun/js/index.d.ts:881](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L881) *** ### roleCreate > **roleCreate**: \[`role`: [`Role`](/docs/reference/js/zaun-client/classes/role/)\] Defined in: [zaun/js/index.d.ts:891](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L891) *** ### roleDelete > **roleDelete**: \[`role`: [`Role`](/docs/reference/js/zaun-client/classes/role/)\] Defined in: [zaun/js/index.d.ts:893](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L893) *** ### roleUpdate > **roleUpdate**: \[`role`: [`Role`](/docs/reference/js/zaun-client/classes/role/)\] Defined in: [zaun/js/index.d.ts:892](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L892) *** ### typingStart > **typingStart**: \[`typing`: `object`\] Defined in: [zaun/js/index.d.ts:906](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L906) Someone else is typing: `members` in a named channel; in an anonymous one `members` is empty and `count` is 1, 2 or 3 (three or more). *** ### voiceStateUpdate > **voiceStateUpdate**: \[`state`: [`VoiceState`](/docs/reference/js/zaun-client/interfaces/voicestate/)\] Defined in: [zaun/js/index.d.ts:903](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L903) *** ### warning > **warning**: \[`warning`: `object`\] Defined in: [zaun/js/index.d.ts:917](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L917) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/commandoptiondata/ --- # CommandOptionData Defined in: [zaun/js/index.d.ts:317](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L317) ## Properties ### autocomplete? > `optional` **autocomplete?**: `boolean` Defined in: [zaun/js/index.d.ts:329](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L329) *** ### channel\_types? > `optional` **channel\_types?**: `unknown`[] Defined in: [zaun/js/index.d.ts:324](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L324) *** ### choices? > `optional` **choices?**: `object`[] Defined in: [zaun/js/index.d.ts:322](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L322) #### name > **name**: `string` #### value > **value**: `string` \| `number` *** ### description > **description**: `string` Defined in: [zaun/js/index.d.ts:320](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L320) *** ### max\_length? > `optional` **max\_length?**: `number` Defined in: [zaun/js/index.d.ts:328](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L328) *** ### max\_value? > `optional` **max\_value?**: `number` Defined in: [zaun/js/index.d.ts:326](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L326) *** ### min\_length? > `optional` **min\_length?**: `number` Defined in: [zaun/js/index.d.ts:327](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L327) *** ### min\_value? > `optional` **min\_value?**: `number` Defined in: [zaun/js/index.d.ts:325](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L325) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:319](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L319) *** ### options? > `optional` **options?**: `CommandOptionData`[] Defined in: [zaun/js/index.d.ts:323](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L323) *** ### required? > `optional` **required?**: `boolean` Defined in: [zaun/js/index.d.ts:321](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L321) *** ### type > **type**: `number` Defined in: [zaun/js/index.d.ts:318](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L318) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/dmchanneldata/ --- # DmChannelData Defined in: [zaun/js/index.d.ts:471](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L471) DM: a DM channel object (a channel of kind `dm` and its two participants). ## Indexable > \[`field`: `string`\]: `unknown` ## Properties ### channel\_id > **channel\_id**: `string` Defined in: [zaun/js/index.d.ts:472](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L472) *** ### participants > **participants**: \[`string`, `string`\] Defined in: [zaun/js/index.d.ts:473](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L473) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/dmsettings/ --- # DmSettings Defined in: [zaun/js/index.d.ts:466](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L466) DM: `member.settings.get` / `.update`. ## Properties ### dms\_from\_bots > **dms\_from\_bots**: `boolean` Defined in: [zaun/js/index.d.ts:467](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L467) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/embeddata/ --- # EmbedData Defined in: [zaun/js/index.d.ts:490](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L490) An embed as the protocol has it; pictures are attachment ids of the same message. ## Properties ### author? > `optional` **author?**: `object` Defined in: [zaun/js/index.d.ts:499](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L499) #### icon? > `optional` **icon?**: `string` #### name > **name**: `string` #### url? > `optional` **url?**: `string` *** ### color? > `optional` **color?**: `number` Defined in: [zaun/js/index.d.ts:496](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L496) `0xRRGGBB`. *** ### description? > `optional` **description?**: `string` Defined in: [zaun/js/index.d.ts:492](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L492) *** ### fields? > `optional` **fields?**: `object`[] Defined in: [zaun/js/index.d.ts:503](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L503) #### inline? > `optional` **inline?**: `boolean` #### name > **name**: `string` #### value > **value**: `string` *** ### footer? > `optional` **footer?**: `object` Defined in: [zaun/js/index.d.ts:500](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L500) #### icon? > `optional` **icon?**: `string` #### text > **text**: `string` *** ### image? > `optional` **image?**: `string` Defined in: [zaun/js/index.d.ts:501](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L501) *** ### thumbnail? > `optional` **thumbnail?**: `string` Defined in: [zaun/js/index.d.ts:502](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L502) *** ### timestamp? > `optional` **timestamp?**: `number` Defined in: [zaun/js/index.d.ts:498](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L498) ms since the epoch. *** ### title? > `optional` **title?**: `string` Defined in: [zaun/js/index.d.ts:491](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L491) *** ### url? > `optional` **url?**: `string` Defined in: [zaun/js/index.d.ts:494](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L494) The title's link, `https://` only. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/embedfielddata/ --- # EmbedFieldData Defined in: [zaun/js/index.d.ts:506](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L506) ## Properties ### inline? > `optional` **inline?**: `boolean` Defined in: [zaun/js/index.d.ts:509](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L509) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:507](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L507) *** ### value > **value**: `string` Defined in: [zaun/js/index.d.ts:508](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L508) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/filetosend/ --- # FileToSend Defined in: [zaun/js/index.d.ts:477](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L477) ## Properties ### contentType? > `optional` **contentType?**: `string` Defined in: [zaun/js/index.d.ts:481](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L481) Guessed from the name when not given. *** ### data > **data**: `ArrayBuffer` \| `Blob` \| `Uint8Array`\<`ArrayBufferLike`\> Defined in: [zaun/js/index.d.ts:479](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L479) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:478](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L478) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/historyverification/ --- # HistoryVerification Defined in: [zaun/js/index.d.ts:257](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L257) `verifyHistory`'s report. ## Properties ### errors > **errors**: [`RegistryError`](/docs/reference/js/zaun-client/interfaces/registryerror/)[] Defined in: [zaun/js/index.d.ts:263](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L263) *** ### history > **history**: `any` Defined in: [zaun/js/index.d.ts:262](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L262) The verified history file; `null` unless `ok`. *** ### ok > **ok**: `boolean` Defined in: [zaun/js/index.d.ts:258](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L258) *** ### versions > **versions**: `string`[] Defined in: [zaun/js/index.d.ts:260](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L260) The releases' versions, highest first. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/installsource/ --- # InstallSource Defined in: [zaun/js/index.d.ts:207](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L207) `installBot` / `updateBot`'s `source`: what the app verified the package against. ## Properties ### catalog > **catalog**: `string` Defined in: [zaun/js/index.d.ts:209](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L209) Attachment id of the uploaded `catalog.json`, its exact bytes (at most 16 MiB). *** ### history? > `optional` **history?**: `string` Defined in: [zaun/js/index.d.ts:213](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L213) Attachment id of the uploaded `history/.json`, for a version not in `latest`. *** ### signature > **signature**: `string` Defined in: [zaun/js/index.d.ts:211](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L211) The text of `catalog.json.sig` (at most 4,608 bytes). --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/mentionsdata/ --- # MentionsData Defined in: [zaun/js/index.d.ts:592](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L592) The protocol's mentions object. ## Properties ### everyone > **everyone**: `boolean` Defined in: [zaun/js/index.d.ts:593](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L593) *** ### members > **members**: `string`[] Defined in: [zaun/js/index.d.ts:594](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L594) *** ### roles > **roles**: `string`[] Defined in: [zaun/js/index.d.ts:595](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L595) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/mentionsinput/ --- # MentionsInput Defined in: [zaun/js/index.d.ts:576](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L576) Who a post notifies: ids, or the Member and Role objects. The host drops `everyone`, and roles that are not mentionable, without `MENTION_EVERYONE`, and members not in the community. ## Properties ### everyone? > `optional` **everyone?**: `boolean` Defined in: [zaun/js/index.d.ts:577](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L577) *** ### members? > `optional` **members?**: (`string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/))[] Defined in: [zaun/js/index.d.ts:578](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L578) *** ### roles? > `optional` **roles?**: (`string` \| [`Role`](/docs/reference/js/zaun-client/classes/role/))[] Defined in: [zaun/js/index.d.ts:581](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L581) *** ### users? > `optional` **users?**: (`string` \| [`Member`](/docs/reference/js/zaun-client/classes/member/))[] Defined in: [zaun/js/index.d.ts:580](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L580) Same as `members`. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/optionvaluedata/ --- # OptionValueData Defined in: [zaun/js/index.d.ts:344](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L344) An option value given to a command: `{ name, type, value?, options?, focused? }`. ## Properties ### focused? > `optional` **focused?**: `boolean` Defined in: [zaun/js/index.d.ts:349](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L349) *** ### name > **name**: `string` Defined in: [zaun/js/index.d.ts:345](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L345) *** ### options? > `optional` **options?**: `OptionValueData`[] Defined in: [zaun/js/index.d.ts:348](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L348) *** ### type > **type**: `number` Defined in: [zaun/js/index.d.ts:346](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L346) *** ### value? > `optional` **value?**: `string` \| `number` \| `boolean` Defined in: [zaun/js/index.d.ts:347](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L347) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/packageidentity/ --- # PackageIdentity Defined in: [zaun/js/index.d.ts:267](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L267) What a package's header says about itself. ## Extended by - [`PackageInspection`](/docs/reference/js/zaun-client/interfaces/packageinspection/) ## Properties ### app\_id > **app\_id**: `string` Defined in: [zaun/js/index.d.ts:268](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L268) *** ### created\_at > **created\_at**: `number` Defined in: [zaun/js/index.d.ts:272](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L272) *** ### manifest > **manifest**: `any` Defined in: [zaun/js/index.d.ts:273](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L273) *** ### publisher\_id > **publisher\_id**: `string` Defined in: [zaun/js/index.d.ts:271](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L271) *** ### version > **version**: `string` Defined in: [zaun/js/index.d.ts:269](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L269) *** ### world > **world**: `string` Defined in: [zaun/js/index.d.ts:270](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L270) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/packageinspection/ --- # PackageInspection Defined in: [zaun/js/index.d.ts:278](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L278) `inspectPackage`'s report. The identity fields are set only when `signed_ok`; an unsigned or badly signed file's claims are under `claimed`, never to be shown as fact. ## Extends - [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/) ## Properties ### app\_id > **app\_id**: `string` Defined in: [zaun/js/index.d.ts:268](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L268) #### Inherited from [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/).[`app_id`](/docs/reference/js/zaun-client/interfaces/packageidentity/#app_id) *** ### claimed > **claimed**: [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/) Defined in: [zaun/js/index.d.ts:279](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L279) *** ### component\_size > **component\_size**: `number` Defined in: [zaun/js/index.d.ts:287](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L287) *** ### created\_at > **created\_at**: `number` Defined in: [zaun/js/index.d.ts:272](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L272) #### Inherited from [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/).[`created_at`](/docs/reference/js/zaun-client/interfaces/packageidentity/#created_at) *** ### errors > **errors**: [`RegistryError`](/docs/reference/js/zaun-client/interfaces/registryerror/)[] Defined in: [zaun/js/index.d.ts:289](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L289) *** ### header\_hash > **header\_hash**: `string` Defined in: [zaun/js/index.d.ts:285](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L285) *** ### manifest > **manifest**: `any` Defined in: [zaun/js/index.d.ts:273](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L273) #### Inherited from [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/).[`manifest`](/docs/reference/js/zaun-client/interfaces/packageidentity/#manifest) *** ### manifest\_sha3 > **manifest\_sha3**: `string` Defined in: [zaun/js/index.d.ts:286](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L286) *** ### publisher\_id > **publisher\_id**: `string` Defined in: [zaun/js/index.d.ts:271](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L271) #### Inherited from [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/).[`publisher_id`](/docs/reference/js/zaun-client/interfaces/packageidentity/#publisher_id) *** ### sha3 > **sha3**: `string` Defined in: [zaun/js/index.d.ts:284](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L284) SHA3-256 of the whole file, hex: compare it with the catalog's `sha3`. *** ### signed\_ok > **signed\_ok**: `boolean` Defined in: [zaun/js/index.d.ts:280](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L280) *** ### size > **size**: `number` Defined in: [zaun/js/index.d.ts:288](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L288) *** ### valid > **valid**: `boolean` Defined in: [zaun/js/index.d.ts:282](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L282) Every registry package check passed: signature, hashes, world, manifest, component. *** ### version > **version**: `string` Defined in: [zaun/js/index.d.ts:269](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L269) #### Inherited from [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/).[`version`](/docs/reference/js/zaun-client/interfaces/packageidentity/#version) *** ### world > **world**: `string` Defined in: [zaun/js/index.d.ts:270](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L270) #### Inherited from [`PackageIdentity`](/docs/reference/js/zaun-client/interfaces/packageidentity/).[`world`](/docs/reference/js/zaun-client/interfaces/packageidentity/#world) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/presence/ --- # Presence Defined in: [zaun/js/index.d.ts:20](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L20) presence: a member's status and activity as everyone sees it. ## Properties ### activity > **activity**: [`Activity`](/docs/reference/js/zaun-client/interfaces/activity/) Defined in: [zaun/js/index.d.ts:22](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L22) *** ### status > **status**: `"online"` \| `"idle"` \| `"dnd"` \| `"offline"` Defined in: [zaun/js/index.d.ts:21](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L21) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/registryerror/ --- # RegistryError Defined in: [zaun/js/index.d.ts:219](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L219) One finding, with the registry's stable code (`E-CATALOG-SIGNATURE`, …). ## Properties ### code > **code**: `string` Defined in: [zaun/js/index.d.ts:220](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L220) *** ### hint > **hint**: `string` Defined in: [zaun/js/index.d.ts:222](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L222) *** ### message > **message**: `string` Defined in: [zaun/js/index.d.ts:221](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L221) *** ### severity > **severity**: `"error"` \| `"warning"` Defined in: [zaun/js/index.d.ts:223](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L223) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/startoptions/ --- # StartOptions Defined in: [zaun/js/index.d.ts:25](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L25) ## Properties ### changes? > `optional` **changes?**: `Uint8Array`\<`ArrayBufferLike`\>[] Defined in: [zaun/js/index.d.ts:36](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L36) *** ### commandTimeout? > `optional` **commandTimeout?**: `number` Defined in: [zaun/js/index.d.ts:38](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L38) Milliseconds: a command (60 000), a join or creation (120 000), a file (600 000). *** ### joinTimeout? > `optional` **joinTimeout?**: `number` Defined in: [zaun/js/index.d.ts:39](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L39) *** ### key > **key**: `string` Defined in: [zaun/js/index.d.ts:27](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L27) The store's passphrase. *** ### name? > `optional` **name?**: `string` Defined in: [zaun/js/index.d.ts:29](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L29) The SimpleX profile name a new store starts with. *** ### relays? > `optional` **relays?**: `string`[] Defined in: [zaun/js/index.d.ts:31](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L31) `smp://…` and `xftp://…` servers; the official ones without. *** ### snapshot? > `optional` **snapshot?**: `Uint8Array` Defined in: [zaun/js/index.d.ts:35](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L35) A saved store (`client.save()`), and what changed since (`client.saveChanges()`). *** ### transferTimeout? > `optional` **transferTimeout?**: `number` Defined in: [zaun/js/index.d.ts:40](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L40) *** ### tunnel? > `optional` **tunnel?**: `string` Defined in: [zaun/js/index.d.ts:33](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L33) In a browser: a WebSocket tunnel to the relays (`wss://…/v1`). --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/voiceevents/ --- # VoiceEvents Defined in: [zaun/js/index.d.ts:828](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L828) ## Properties ### audio > **audio**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:836](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L836) Node.js and Bun: one opened Opus frame (48 kHz) from a participant. *** ### connected > **connected**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:832](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L832) *** ### ended > **ended**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:839](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L839) *** ### joined > **joined**: \[`participant`: `any`\] Defined in: [zaun/js/index.d.ts:829](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L829) *** ### keyChanged > **keyChanged**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:838](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L838) *** ### left > **left**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:831](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L831) *** ### rekeyed > **rekeyed**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:837](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L837) *** ### track > **track**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:834](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L834) Browsers: a participant's audio, to play. *** ### updated > **updated**: \[`participant`: `any`\] Defined in: [zaun/js/index.d.ts:830](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L830) *** ### warning > **warning**: \[`event`: `object`\] Defined in: [zaun/js/index.d.ts:840](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L840) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/interfaces/voicestate/ --- # VoiceState Defined in: [zaun/js/index.d.ts:864](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L864) ## Properties ### channel > **channel**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/) Defined in: [zaun/js/index.d.ts:866](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L866) *** ### joined > **joined**: `boolean` Defined in: [zaun/js/index.d.ts:867](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L867) *** ### left > **left**: `boolean` Defined in: [zaun/js/index.d.ts:868](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L868) *** ### member > **member**: [`Member`](/docs/reference/js/zaun-client/classes/member/) Defined in: [zaun/js/index.d.ts:865](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L865) *** ### movedTo > **movedTo**: [`Channel`](/docs/reference/js/zaun-client/classes/channel/) Defined in: [zaun/js/index.d.ts:872](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L872) Where a moderator moved them; null unless `left`. *** ### reason > **reason**: `string` Defined in: [zaun/js/index.d.ts:870](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L870) Why they left; null unless `left`. *** ### selfDeaf > **selfDeaf**: `boolean` Defined in: [zaun/js/index.d.ts:875](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L875) *** ### selfMute > **selfMute**: `boolean` Defined in: [zaun/js/index.d.ts:874](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L874) Mute and deafen: null when they left (a leave does not say). *** ### serverDeaf > **serverDeaf**: `boolean` Defined in: [zaun/js/index.d.ts:877](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L877) *** ### serverMute > **serverMute**: `boolean` Defined in: [zaun/js/index.d.ts:876](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L876) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/botmessageoptions/ --- # BotMessageOptions > **BotMessageOptions** = `string` \| \{ `allowedMentions?`: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/); `attachments?`: `string`[]; `components?`: ([`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \})[]; `content?`: `string`; `embeds?`: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[]; `ephemeral?`: `boolean`; `flags?`: `number`; `mentions?`: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/); \} Defined in: [zaun/js/index.d.ts:355](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L355) ## Union Members `string` *** ### Type Literal \{ `allowedMentions?`: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/); `attachments?`: `string`[]; `components?`: ([`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \})[]; `content?`: `string`; `embeds?`: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[]; `ephemeral?`: `boolean`; `flags?`: `number`; `mentions?`: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/); \} #### allowedMentions? > `optional` **allowedMentions?**: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/) As `send`'s, applied to the `content` given here: an edit that keeps its text and gives this names nobody, clearing the mentions. #### attachments? > `optional` **attachments?**: `string`[] #### components? > `optional` **components?**: ([`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/) \| \{ `toJSON`(): [`ComponentData`](/docs/reference/js/zaun-client/type-aliases/componentdata/); \})[] #### content? > `optional` **content?**: `string` #### embeds? > `optional` **embeds?**: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[] #### ephemeral? > `optional` **ephemeral?**: `boolean` #### flags? > `optional` **flags?**: `number` #### mentions? > `optional` **mentions?**: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/) Who it notifies, as `send`'s. On `reply` and `followUp` none when absent; on `update` and `editReply` absent keeps the message's mentions and any set replaces them (`{}` clears). --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/componentdata/ --- # ComponentData > **ComponentData** = `object` Defined in: [zaun/js/index.d.ts:353](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L353) A component as the wire has it; `type` is a ComponentType. ## Indexable > \[`key`: `string`\]: `unknown` ## Properties ### type > **type**: `number` Defined in: [zaun/js/index.d.ts:353](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L353) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/messageeditoptions/ --- # MessageEditOptions > **MessageEditOptions** = `string` \| [`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| \{ `allowedMentions?`: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/); `content?`: `string`; `embeds?`: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[] \| `null`; `mentions?`: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/); \} Defined in: [zaun/js/index.d.ts:629](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L629) New text, an embed, or `{ content?, embeds?, mentions?, allowedMentions? }`: text not given stays; `embeds` replaces them all (`[]` removes them) and may show only attachments the message has. ## Union Members `string` *** [`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) *** ### Type Literal \{ `allowedMentions?`: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/); `content?`: `string`; `embeds?`: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[] \| `null`; `mentions?`: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/); \} #### allowedMentions? > `optional` **allowedMentions?**: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/) As `send`'s, applied to the text the message is left with (the new `content`, or its own). #### content? > `optional` **content?**: `string` #### embeds? > `optional` **embeds?**: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[] \| `null` #### mentions? > `optional` **mentions?**: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/) As `send`'s. With neither this nor `allowedMentions` the message keeps its mentions (the edit sends none, and the host leaves them). With either, the ones named replace them all: `{}` or nothing the content shows clears them, `@everyone` too. Naming anyone needs SEND_MESSAGES and counts against the mentions rate limit (`RATE_LIMITED`). zaun-host 0.4.0 or newer; an older host ignores it. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/messageoptions/ --- # MessageOptions > **MessageOptions** = `string` \| [`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| \{ `allowedMentions?`: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/); `content?`: `string`; `embeds?`: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[]; `files?`: ([`FileToSend`](/docs/reference/js/zaun-client/interfaces/filetosend/) \| `Blob`)[]; `mentions?`: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/); `reply?`: [`Message`](/docs/reference/js/zaun-client/classes/message/) \| `string`; \} Defined in: [zaun/js/index.d.ts:557](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L557) Text, an embed, or a whole message. Content may be empty beside embeds or files; files and embed pictures are 10 at most in all. ## Union Members `string` *** [`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) *** ### Type Literal \{ `allowedMentions?`: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/); `content?`: `string`; `embeds?`: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[]; `files?`: ([`FileToSend`](/docs/reference/js/zaun-client/interfaces/filetosend/) \| `Blob`)[]; `mentions?`: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/); `reply?`: [`Message`](/docs/reference/js/zaun-client/classes/message/) \| `string`; \} #### allowedMentions? > `optional` **allowedMentions?**: [`AllowedMentions`](/docs/reference/js/zaun-client/interfaces/allowedmentions/) other libraries's: lets the mentions the content shows notify, all of a kind (`parse`) or these ids only (`users`, `roles`). #### content? > `optional` **content?**: `string` #### embeds? > `optional` **embeds?**: ([`EmbedBuilder`](/docs/reference/js/zaun-client/classes/embedbuilder/) \| [`EmbedData`](/docs/reference/js/zaun-client/interfaces/embeddata/))[] #### files? > `optional` **files?**: ([`FileToSend`](/docs/reference/js/zaun-client/interfaces/filetosend/) \| `Blob`)[] #### mentions? > `optional` **mentions?**: [`MentionsInput`](/docs/reference/js/zaun-client/interfaces/mentionsinput/) Who it notifies (each once; ≤ 50 members, ≤ 20 roles). The content only shows mentions (`userMention`, `roleMention`); nothing in it notifies on its own. #### reply? > `optional` **reply?**: [`Message`](/docs/reference/js/zaun-client/classes/message/) \| `string` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/permissionflag/ --- # PermissionFlag > **PermissionFlag** = `"ViewChannel"` \| `"ManageChannels"` \| `"ManageRoles"` \| `"ManageCommunity"` \| `"ViewAuditLog"` \| `"CreateInvite"` \| `"ManageInvites"` \| `"KickMembers"` \| `"BanMembers"` \| `"TimeoutMembers"` \| `"ManageWebhooks"` \| `"ManageEmojis"` \| `"Administrator"` \| `"ChangeNickname"` \| `"ManageNicknames"` \| `"ApproveMembers"` \| `"SendMessages"` \| `"ReadMessageHistory"` \| `"ManageMessages"` \| `"AttachFiles"` \| `"EmbedLinks"` \| `"AddReactions"` \| `"MentionEveryone"` \| `"CreateThreads"` \| `"ManageThreads"` \| `"SendMessagesInThreads"` \| `"BypassSlowmode"` \| `"Connect"` \| `"Speak"` \| `"Stream"` \| `"Video"` \| `"MuteMembers"` \| `"DeafenMembers"` \| `"MoveMembers"` \| `"ManageReports"` \| `"ManageSafety"` \| `"UseApplicationCommands"` Defined in: [zaun/js/index.d.ts:61](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L61) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/permissionresolvable/ --- # PermissionResolvable > **PermissionResolvable** = `bigint` \| `string` \| [`Permissions`](/docs/reference/js/zaun-client/classes/permissions/) \| `PermissionResolvable`[] Defined in: [zaun/js/index.d.ts:70](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L70) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/type-aliases/picturesource/ --- # PictureSource > **PictureSource** = [`FileToSend`](/docs/reference/js/zaun-client/interfaces/filetosend/) \| `Blob` \| [`Attachment`](/docs/reference/js/zaun-client/classes/attachment/) \| `string` Defined in: [zaun/js/index.d.ts:487](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L487) An embed's picture: a file to upload with the message (PNG, JPEG, GIF or WebP), a `"attachment://name"` naming one of the message's `files`, or an attachment (an Attachment, or its id). Never a URL: nothing is ever fetched from a third party. --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/applicationcommandtype/ --- # ApplicationCommandType > `const` **ApplicationCommandType**: `object` Defined in: [zaun/js/index.d.ts:406](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L406) ## Type Declaration ### ChatInput > **ChatInput**: `1` ### Message > **Message**: `3` ### User > **User**: `2` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/buttonstyle/ --- # ButtonStyle > `const` **ButtonStyle**: `object` Defined in: [zaun/js/index.d.ts:402](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L402) ## Type Declaration ### Danger > **Danger**: `4` ### Link > **Link**: `5` ### Primary > **Primary**: `1` ### Secondary > **Secondary**: `2` ### Success > **Success**: `3` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/componenttype/ --- # ComponentType > `const` **ComponentType**: `Record`\<`string`, `number`\> Defined in: [zaun/js/index.d.ts:401](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L401) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/everyonemention/ --- # everyoneMention > `const` **everyoneMention**: `"@everyone"` Defined in: [zaun/js/index.d.ts:620](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L620) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/interactiontype/ --- # InteractionType > `const` **InteractionType**: `object` Defined in: [zaun/js/index.d.ts:405](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L405) ## Type Declaration ### ApplicationCommand > **ApplicationCommand**: `2` ### Autocomplete > **Autocomplete**: `4` ### MessageComponent > **MessageComponent**: `3` ### ModalSubmit > **ModalSubmit**: `5` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/mentionlimits/ --- # MentionLimits > `const` **MentionLimits**: `object` Defined in: [zaun/js/index.d.ts:624](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L624) ## Type Declaration ### members > `readonly` **members**: `50` ### roles > `readonly` **roles**: `20` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/messageflags/ --- # MessageFlags > `const` **MessageFlags**: `object` Defined in: [zaun/js/index.d.ts:404](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L404) ## Type Declaration ### Ephemeral > **Ephemeral**: `64` ### IsComponentsV2 > **IsComponentsV2**: `32768` ### Loading > **Loading**: `128` ### SuppressEmbeds > **SuppressEmbeds**: `4` ### SuppressNotifications > **SuppressNotifications**: `4096` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/optiontype/ --- # OptionType > `const` **OptionType**: `Record`\<`string`, `number`\> Defined in: [zaun/js/index.d.ts:407](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L407) --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/rawattachmentreader/ --- # RawAttachmentReader > **RawAttachmentReader**: `any` --- url: https://zaunchat.github.io/docs/reference/js/zaun-client/variables/textinputstyle/ --- # TextInputStyle > `const` **TextInputStyle**: `object` Defined in: [zaun/js/index.d.ts:403](https://github.com/zaunchat/zaun-client/blob/main/zaun/js/index.d.ts#L403) ## Type Declaration ### Paragraph > **Paragraph**: `2` ### Short > **Short**: `1` --- url: https://zaunchat.github.io/docs/reference/rust/ --- # Rust API > Generated reference for the zaun-client, zaun-bot and zaun-community-protocol crates. The Rust reference is generated from each crate's documentation on every deploy and every day: | Crate | What it is | Browse | |---|---|---| | `zaun-client` | the client library for apps and external bots | [pages](/docs/reference/rust/zaun-client/) · [rustdoc HTML](/docs/api/rust/zaun-client/zaun_client/index.html) | | `zaun-bot` | the SDK for hosted bots (built for `wasm32-wasip2`) | [pages](/docs/reference/rust/zaun-bot/) · [rustdoc HTML](/docs/api/rust/zaun-bot/zaun_bot/index.html) | | `zaun-community-protocol` | the protocol: ids, messages, commands, events, permissions, signatures | [pages](/docs/reference/rust/zaun-community-protocol/) · [rustdoc HTML](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/index.html) | - **Pages** are one per public struct, enum, trait, function and type, with signatures, docs, fields, variants and methods. They are searchable here and available as Markdown for AI tools. - **rustdoc HTML** is the full output of `cargo doc`, with source links and rustdoc's own search. > **Note** > > If the pages above are missing, this build ran without the generated reference (a local preview). > Run `npm run gen` to generate it. --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/ --- # zaun-bot 0.2.0 > API reference of the zaun_bot crate, generated from rustdoc. Generated from rustdoc for `zaun_bot` 0.2.0. [Browse the full rustdoc HTML](/docs/api/rust/zaun-bot/zaun_bot/index.html). # zaun-bot The Rust SDK for **Zaun bots**: WebAssembly components that run *inside* a community's own `zaun-host`, in a sandbox, with only the permissions and capabilities the owner granted. ```rust use zaun_bot::prelude::*; #[derive(Default)] struct Ping; impl Bot for Ping { fn commands(&mut self, _: &Config) -> Vec { vec![SlashCommand::new("ping", "Check that the bot is alive").build()] } fn on_command(&mut self, ctx: Context, cmd: CommandData) { if cmd.name == "ping" { let _ = ctx.reply("pong"); } } } export_bot!(Ping); ``` The data shapes follow the Zaun the protocol–the protocol, which follow Discord's interaction model. The WIT world in `wit/` is the source of truth. ## Constants | Item | Summary | |---|---| | [`mention::EVERYONE`](/docs/reference/rust/zaun-bot/constant-mention-everyone/) | The text that shows `@everyone`. | | [`mention::MAX_MEMBERS`](/docs/reference/rust/zaun-bot/constant-mention-max_members/) | Most members one message may mention (spec the protocol). | | [`mention::MAX_ROLES`](/docs/reference/rust/zaun-bot/constant-mention-max_roles/) | Most roles one message may mention (spec the protocol). | ## Enums | Item | Summary | |---|---| | [`presence::ActivityType`](/docs/reference/rust/zaun-bot/enum-presence-activitytype/) | "Playing {name}", "Streaming {name}", "Listening to {name}", "Watching {name}", "Competing in {name}", or free text (`custom`). | | [`audio::AudioFormat`](/docs/reference/rust/zaun-bot/enum-audio-audioformat/) | How the bot's audio is encoded. | | [`bindings::zaun::bot::types::ButtonStyle`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-buttonstyle/) | components Button styles 1-5; premium (6) is not supported. | | [`prelude::ChoiceValue`](/docs/reference/rust/zaun-bot/enum-prelude-choicevalue/) | | | [`bindings::zaun::bot::types::CommandEntry`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-commandentry/) | | | [`bindings::zaun::bot::types::CommandKind`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-commandkind/) | application commands Type 1, 2, 3. | | [`bindings::zaun::bot::types::Component`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-component/) | A top-level message component. Without `components-v2` only `action-row` is allowed. | | [`bindings::zaun::bot::types::ContainerChild`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-containerchild/) | | | [`bindings::zaun::bot::types::DefaultValueKind`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-defaultvaluekind/) | | | [`bindings::zaun::bot::types::EntityKind`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-entitykind/) | Types 5 (user), 6 (role), 7 (mentionable), 8 (channel). | | [`prelude::Event`](/docs/reference/rust/zaun-bot/enum-prelude-event/) | 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 ev | | [`bindings::zaun::bot::http::HttpError`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-http-httperror/) | | | [`bindings::zaun::bot::types::InteractionData`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-interactiondata/) | | | [`bindings::zaun::bot::types::LabelChild`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-labelchild/) | | | [`bindings::zaun::bot::log::Level`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-log-level/) | | | [`voice::LoopMode`](/docs/reference/rust/zaun-bot/enum-voice-loopmode/) | What happens when a track ends: go on (`off`), play it again (`track`), or put it at the end of the queue (`queue`). | | [`bindings::zaun::bot::types::ModalItem`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-modalitem/) | | | [`bindings::zaun::bot::types::OptionKind`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-optionkind/) | Option types 3-11 (1 and 2 are sub-commands and groups). | | [`bindings::zaun::bot::types::OptionValue`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-optionvalue/) | interactions | | [`voice::PlayerStatus`](/docs/reference/rust/zaun-bot/enum-voice-playerstatus/) | | | [`bindings::zaun::bot::types::Response`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-response/) | Callback types 4-9 (8, the autocomplete result, is the return value of `on-autocomplete`). | | [`bindings::zaun::bot::types::RowItem`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-rowitem/) | | | [`bindings::zaun::bot::types::SectionAccessory`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-sectionaccessory/) | | | [`Select`](/docs/reference/rust/zaun-bot/enum-select/) | Builds a select menu: string options or members, roles, mentionables or channels. | | [`bindings::zaun::bot::types::SeparatorSpacing`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-separatorspacing/) | | | [`bindings::zaun::bot::voice::Source`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-voice-source/) | Where a track's audio comes from. | | [`presence::Status`](/docs/reference/rust/zaun-bot/enum-presence-status/) | `invisible` looks offline to everyone. | | [`bindings::zaun::bot::types::TextInputStyle`](/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-textinputstyle/) | modals | | [`voice::VoiceEvent`](/docs/reference/rust/zaun-bot/enum-voice-voiceevent/) | What happened, for `on-voice-event`. | ## Functions | Item | Summary | |---|---| | [`bindings::zaun::bot::community::add_role`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-add_role/) | `member.roles.update`. | | [`bindings::zaun::bot::timers::after`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-timers-after/) | Fires once after `ms`. | | [`bindings::zaun::bot::audio::buffered_ms`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-buffered_ms/) | The audio written and not yet played, in ms (0 without a stream). | | [`bindings::zaun::bot::timers::cancel`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-timers-cancel/) | | | [`bindings::zaun::bot::audio::clear`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-clear/) | Drops everything buffered at once, keeping the stream open (to interrupt speech). | | [`bindings::zaun::bot::voice::clear_queue`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-clear_queue/) | Empties the queue; the current track keeps playing. | | [`presence::clear_status`](/docs/reference/rust/zaun-bot/function-presence-clear_status/) | Clears the custom status. | | [`bindings::zaun::bot::dms::close`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-dms-close/) | `dm.close`: hides it from the bot's list. | | [`bindings::zaun::bot::audio::close`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-close/) | Closes the stream: once the buffer has played (`drain`), or at once. The player resumes. Nothing happens without a stream. | | [`bindings::zaun::bot::messages::delete`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-delete/) | `message.delete`. | | [`bindings::zaun::bot::storage::delete`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-delete/) | | | [`bindings::zaun::bot::interactions::delete_original`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-delete_original/) | Deletes the original response. | | [`dispatch`](/docs/reference/rust/zaun-bot/function-dispatch/) | Calls the `Bot` handler for `event`. | | [`bindings::zaun::bot::messages::dm`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-dm/) | A direct message to member `member-id` (capability `dms`): opens the DM when needed, then sends. Returns the DM's channel id and the message id. | | [`bindings::zaun::bot::messages::edit`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-edit/) | `message.edit` of one of the bot's messages. | | [`bindings::zaun::bot::interactions::edit_original`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-edit_original/) | Edits the original response (ends a deferred "thinking" state). | | [`bindings::zaun::bot::voice::end_stream`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-end_stream/) | The `pushed` track ends once its buffered packets have played. | | [`bindings::zaun::bot::voice::enqueue`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-enqueue/) | Adds `track` to the queue (≤ 100); returns the queue's length. | | [`bindings::zaun::bot::timers::every`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-timers-every/) | Fires every `ms` (≥ 1000). | | [`bindings::zaun::bot::http::fetch`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-http-fetch/) | | | [`bindings::zaun::bot::interactions::followup`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-followup/) | A follow-up message, within 15 minutes; at most 10. | | [`bindings::zaun::bot::storage::get`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-get/) | | | [`bindings::zaun::bot::community::get_channel`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-get_channel/) | | | [`bindings::zaun::bot::community::get_member`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-get_member/) | Needs capability `members` for members the bot has not seen. | | [`bindings::zaun::bot::community::get_role`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-get_role/) | | | [`bindings::zaun::bot::messages::history`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-history/) | `message.history`: up to `limit` (1-100) messages before `before`. | | [`mention::is_id`](/docs/reference/rust/zaun-bot/function-mention-is_id/) | Whether `id` is a well-formed Zaun id: 16 bytes in unpadded base64url (22 characters, the last one of `A`, `Q`, `g`, `w`). | | [`bindings::zaun::bot::voice::join`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-join/) | Joins voice channel `channel` (leaving another one first). Returns once media can flow (at most about 10 s). `FORBIDDEN` without `voice`, `CONNECT` or `SPEAK`. | | [`bindings::zaun::bot::community::kick`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-kick/) | `member.kick`. | | [`bindings::zaun::bot::voice::leave`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-leave/) | Leaves; playback stops and the queue is cleared. | | [`bindings::zaun::bot::community::list_channels`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-list_channels/) | | | [`bindings::zaun::bot::storage::list_keys`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-list_keys/) | Keys starting with `prefix`, in order, after `after`, at most `limit` (≤ 1000). | | [`bindings::zaun::bot::community::list_members`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-list_members/) | | | [`bindings::zaun::bot::dms::list_open`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-dms-list_open/) | `dm.list`: the DMs the bot has open. | | [`bindings::zaun::bot::community::list_roles`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-list_roles/) | | | [`mention::member`](/docs/reference/rust/zaun-bot/function-mention-member/) | The text that shows a member mention: `<@id>` (discord.js `userMention`). | | [`bindings::zaun::bot::voice::move_`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-move_/) | Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. `NOT_FOUND` past the end. | | [`mention::none`](/docs/reference/rust/zaun-bot/function-mention-none/) | No mentions. | | [`bindings::zaun::bot::dms::open`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-dms-open/) | `dm.open`: the DM with `member-id`, created when there is none. | | [`bindings::zaun::bot::audio::open`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-open/) | Opens the stream in the bot's voice channel, pausing the player. `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take | | [`mention::parse`](/docs/reference/rust/zaun-bot/function-mention-parse/) | The mentions `content` shows: `<@id>` (and Discord's `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most `MAX_MEMBERS` members and `MAX_ROLES` r | | [`bindings::zaun::bot::voice::pause`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-pause/) | | | [`bindings::zaun::bot::voice::play`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-play/) | Plays `track` now, replacing the current one; the queue stays. | | [`bindings::zaun::bot::voice::push`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-push/) | Opus packets (2.5 to 120 ms each, ≤ 1000 bytes) for the current `pushed` track. Returns the audio buffered, in ms; `BUSY` past 3 s, so push about as fast as it plays. | | [`bindings::zaun::bot::messages::react`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-react/) | `reaction.add`. | | [`bindings::zaun::bot::voice::remove`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-remove/) | Removes the queued track at `index` (0 plays next); returns its title. `NOT_FOUND` past the end. | | [`bindings::zaun::bot::community::remove_role`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-remove_role/) | | | [`bindings::zaun::bot::interactions::respond`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-respond/) | The initial response, within 3 s (the runtime defers automatically at 2.5 s). Returns the message id when the response created a channel message. | | [`bindings::zaun::bot::voice::resume`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-resume/) | | | [`mention::role`](/docs/reference/rust/zaun-bot/function-mention-role/) | The text that shows a role mention: `<@&id>` (discord.js `roleMention`). | | [`bindings::zaun::bot::voice::seek`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-seek/) | Jumps to `ms` into the current track (past the end: the track ends). `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. | | [`bindings::zaun::bot::messages::send`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-send/) | `message.send`. Returns the new message id. | | [`presence::set`](/docs/reference/rust/zaun-bot/function-presence-set/) | Sets the bot's status and activity (`None`: no activity). | | [`bindings::zaun::bot::commands::set`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-commands-set/) | | | [`bindings::zaun::bot::storage::set`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-set/) | `QUOTA_EXCEEDED` when the grant is used up. | | [`bindings::zaun::bot::presence::set`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-presence-set/) | Sets the bot's status and activity (`signal.presence`). The host shows changes at most every 3 s: a later call within that time replaces an earlier one that has not gone out. The b | | [`bindings::zaun::bot::voice::set_loop`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-set_loop/) | Sets what happens when a track ends (`off` when the bot joins). | | [`presence::set_status`](/docs/reference/rust/zaun-bot/function-presence-set_status/) | Sets the custom status text and emoji, cleared by the host at `expires_at` (ms) if given. | | [`presence::set_status_text`](/docs/reference/rust/zaun-bot/function-presence-set_status_text/) | Sets the custom status text, kept until changed. | | [`bindings::zaun::bot::presence::set_status_text`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-presence-set_status_text/) | Sets the custom status text and emoji (`member.status.set`), kept until `expires-at` (or changed); `none` for both clears it. | | [`bindings::zaun::bot::voice::set_volume`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-set_volume/) | Sets the playback volume, 0-200 % (100 when the bot joins; `BAD_REQUEST` above 200). Changing it means decoding and re-encoding the Opus audio, so hosts without an Opus encoder ans | | [`bindings::zaun::bot::voice::shuffle`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-shuffle/) | Puts the queue in a random order (the current track keeps playing). | | [`bindings::zaun::bot::voice::skip`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-skip/) | Ends the current track; the next one starts. | | [`bindings::zaun::bot::voice::state`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-state/) | Where the bot is and what it plays. | | [`bindings::zaun::bot::voice::stop`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-stop/) | Ends the current track and clears the queue. | | [`text_choice`](/docs/reference/rust/zaun-bot/function-text_choice/) | A text `Choice` (autocomplete results and fixed choices). | | [`bindings::zaun::bot::community::timeout`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-timeout/) | `member.timeout`; `none` clears. | | [`bindings::zaun::bot::messages::unreact`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-unreact/) | `reaction.remove` of the bot's own reaction. | | [`bindings::zaun::bot::messages::upload`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-upload/) | Uploads a file for the bot's next message (capability `attachments`). Returns the attachment id to put in `message-body.attachments`. | | [`bindings::zaun::bot::log::write`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-log-write/) | | | [`bindings::zaun::bot::audio::write_opus`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-write_opus/) | Opus packets, for an `opus` stream. Returns the audio buffered, in ms; `BUSY` past 3 s. | | [`bindings::zaun::bot::audio::write_pcm`](/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-write_pcm/) | Interleaved samples, for a `pcm` stream; any count (the host frames them). Returns the audio buffered, in ms; `BUSY` past 3 s. | ## Macros | Item | Summary | |---|---| | [`export_bot`](/docs/reference/rust/zaun-bot/macro-export_bot/) | Exports a `Bot` type as the component's `zaun:bot/bot` implementation. | | [`log_info`](/docs/reference/rust/zaun-bot/macro-log_info/) | Writes an `info` line to the bot's log (`zaun-host bot logs`). | ## Structs | Item | Summary | |---|---| | [`bindings::zaun::bot::types::ActionRow`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-actionrow/) | Type 1: up to 5 buttons, or one select. | | [`ActionRow`](/docs/reference/rust/zaun-bot/struct-actionrow/) | Builds a types::ActionRow: up to 5 buttons, or one select. | | [`presence::Activity`](/docs/reference/rust/zaun-bot/struct-presence-activity/) | What the bot is doing: build one with `Activity::playing`, `Activity::listening`, … | | [`bindings::zaun::bot::types::Activity`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-activity/) | What a member (or the bot) is doing. | | [`prelude::ApplicationCommand`](/docs/reference/rust/zaun-bot/struct-prelude-applicationcommand/) | | | [`bindings::zaun::bot::types::Attachment`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-attachment/) | | | [`Audio`](/docs/reference/rust/zaun-bot/struct-audio/) | The bot's audio output stream. | | [`bindings::zaun::bot::types::Button`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-button/) | Type 2. | | [`Button`](/docs/reference/rust/zaun-bot/struct-button/) | Builds a `types::Button`. | | [`prelude::Channel`](/docs/reference/rust/zaun-bot/struct-prelude-channel/) | | | [`bindings::zaun::bot::types::Checkbox`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-checkbox/) | Type 23. | | [`bindings::zaun::bot::types::CheckboxGroup`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-checkboxgroup/) | Type 22: 1-10 options. | | [`prelude::Choice`](/docs/reference/rust/zaun-bot/struct-prelude-choice/) | | | [`bindings::zaun::bot::types::ChoiceOption`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-choiceoption/) | | | [`prelude::CommandData`](/docs/reference/rust/zaun-bot/struct-prelude-commanddata/) | | | [`bindings::zaun::bot::types::CommandOption`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-commandoption/) | | | [`CommandOptionBuilder`](/docs/reference/rust/zaun-bot/struct-commandoptionbuilder/) | Builds a `CommandOption`. | | [`bindings::zaun::bot::types::CommunityProfile`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-communityprofile/) | | | [`prelude::ComponentData`](/docs/reference/rust/zaun-bot/struct-prelude-componentdata/) | | | [`Config`](/docs/reference/rust/zaun-bot/struct-config/) | The bot's configuration: the keys its manifest declares in `config`, each with the value the owner set or else its default. Keys with neither are absent. Given to `Bot::on_start` a | | [`bindings::zaun::bot::types::Container`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-container/) | Type 17. | | [`Container`](/docs/reference/rust/zaun-bot/struct-container/) | Builds a Components V2 `types::Container`. | | [`Context`](/docs/reference/rust/zaun-bot/struct-context/) | The interaction being handled, without its data (handlers get the data separately). | | [`bindings::zaun::bot::types::DefaultValue`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-defaultvalue/) | | | [`bindings::zaun::bot::types::Embed`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embed/) | | | [`bindings::zaun::bot::types::EmbedAuthor`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embedauthor/) | embeds | | [`EmbedBuilder`](/docs/reference/rust/zaun-bot/struct-embedbuilder/) | Builds an `Embed`. Pictures are attachment ids of the same message. | | [`bindings::zaun::bot::types::EmbedField`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embedfield/) | | | [`bindings::zaun::bot::types::EmbedFooter`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embedfooter/) | | | [`bindings::zaun::bot::types::EntitySelect`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-entityselect/) | | | [`EventContext`](/docs/reference/rust/zaun-bot/struct-eventcontext/) | What an event handler can do: send, reply, react, delete and send direct messages. Every call is an ordinary command on the bot's member, checked by the host. | | [`bindings::zaun::bot::types::File`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-file/) | Type 13. | | [`bindings::zaun::bot::types::FileUpload`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-fileupload/) | Type 19. | | [`prelude::HostError`](/docs/reference/rust/zaun-bot/struct-prelude-hosterror/) | What the host refused, mirroring the protocol's error codes. | | [`bindings::zaun::bot::types::Interaction`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-interaction/) | | | [`bindings::zaun::bot::types::InteractionMetadata`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-interactionmetadata/) | | | [`bindings::zaun::bot::types::Label`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-label/) | Type 18. | | [`bindings::zaun::bot::types::Localized`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-localized/) | | | [`bindings::zaun::bot::types::MediaGallery`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-mediagallery/) | Type 12: 1-10 items. | | [`bindings::zaun::bot::types::MediaItem`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-mediaitem/) | | | [`prelude::Member`](/docs/reference/rust/zaun-bot/struct-prelude-member/) | community objects | | [`bindings::zaun::bot::types::MemberRoles`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-memberroles/) | | | [`bindings::zaun::bot::types::MemberTimeout`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-membertimeout/) | `until` is `none` when the timeout was cleared. | | [`prelude::Mentions`](/docs/reference/rust/zaun-bot/struct-prelude-mentions/) | | | [`prelude::Message`](/docs/reference/rust/zaun-bot/struct-prelude-message/) | | | [`bindings::zaun::bot::types::MessageBody`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messagebody/) | What a bot sends: `message.send`, responses, follow-ups and edits. | | [`bindings::zaun::bot::types::MessageDeleted`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messagedeleted/) | | | [`bindings::zaun::bot::types::MessageEvent`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messageevent/) | A message, and whether it is in a direct-message channel with the bot. | | [`bindings::zaun::bot::types::MessageFlags`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messageflags/) | messages Discord's values: 4, 64, 4096, 32768. `LOADING` is host-set only. | | [`bindings::zaun::bot::types::MessagesDeleted`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messagesdeleted/) | | | [`bindings::zaun::bot::types::Modal`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-modal/) | | | [`Modal`](/docs/reference/rust/zaun-bot/struct-modal/) | Builds a types::Modal: 1–5 labelled inputs and text blocks. | | [`prelude::ModalData`](/docs/reference/rust/zaun-bot/struct-prelude-modaldata/) | | | [`bindings::zaun::bot::types::ModalValue`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-modalvalue/) | | | [`audio::PcmFormat`](/docs/reference/rust/zaun-bot/struct-audio-pcmformat/) | PCM the host encodes to Opus. | | [`bindings::zaun::bot::types::Presence`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-presence/) | `status`: `online`, `idle`, `dnd` or `offline` (invisible members look offline). | | [`bindings::zaun::bot::types::RadioGroup`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-radiogroup/) | Type 21: 2-10 options. | | [`bindings::zaun::bot::types::RawEvent`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-rawevent/) | | | [`prelude::Reaction`](/docs/reference/rust/zaun-bot/struct-prelude-reaction/) | | | [`prelude::Ready`](/docs/reference/rust/zaun-bot/struct-prelude-ready/) | events The bot's own identity, once its connection is up. | | [`bindings::zaun::bot::types::ReceivedOption`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-receivedoption/) | One option the invoker filled in, with the sub-command path flattened onto the data. | | [`bindings::zaun::bot::types::RegisteredCommand`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-registeredcommand/) | | | [`bindings::zaun::bot::types::Registration`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-registration/) | What `init` returns. | | [`Reply`](/docs/reference/rust/zaun-bot/struct-reply/) | Builds a `MessageBody`. `Reply::from("text")` is the common case. | | [`bindings::zaun::bot::http::Request`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-http-request/) | | | [`bindings::zaun::bot::types::Resolved`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-resolved/) | | | [`bindings::zaun::bot::http::Response`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-http-response/) | | | [`prelude::Role`](/docs/reference/rust/zaun-bot/struct-prelude-role/) | | | [`bindings::zaun::bot::types::Section`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-section/) | Type 9: 1-3 text displays and an accessory. | | [`Section`](/docs/reference/rust/zaun-bot/struct-section/) | A Components V2 section: 1–3 text blocks with a button beside them. | | [`bindings::zaun::bot::types::SelectOption`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-selectoption/) | | | [`bindings::zaun::bot::types::Separator`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-separator/) | Type 14. | | [`SlashCommand`](/docs/reference/rust/zaun-bot/struct-slashcommand/) | Builds an ApplicationCommand: a slash command, or a user or message context command. | | [`audio::StreamOptions`](/docs/reference/rust/zaun-bot/struct-audio-streamoptions/) | | | [`bindings::zaun::bot::types::StringSelect`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-stringselect/) | Type 3. | | [`bindings::zaun::bot::types::SubCommand`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-subcommand/) | Type 1. | | [`SubCommand`](/docs/reference/rust/zaun-bot/struct-subcommand/) | Builds a sub-command. | | [`bindings::zaun::bot::types::SubCommandGroup`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-subcommandgroup/) | Type 2. | | [`SubCommandGroup`](/docs/reference/rust/zaun-bot/struct-subcommandgroup/) | Builds a group of sub-commands (`/name group sub`). | | [`bindings::zaun::bot::types::TextDisplay`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-textdisplay/) | Type 10. | | [`TextDisplay`](/docs/reference/rust/zaun-bot/struct-textdisplay/) | A Components V2 text block (markdown, ≤ 4 000 per message in all). | | [`bindings::zaun::bot::types::TextInput`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-textinput/) | Type 4. | | [`TextInput`](/docs/reference/rust/zaun-bot/struct-textinput/) | Builds a `types::TextInput` for a modal. | | [`bindings::zaun::bot::types::Thumbnail`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-thumbnail/) | Type 11: an image attachment of the same message. | | [`bindings::zaun::bot::voice::Track`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-voice-track/) | Something to play. | | [`bindings::zaun::bot::types::Typing`](/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-typing/) | | | [`Voice`](/docs/reference/rust/zaun-bot/struct-voice/) | The bot's voice: one stay at a time. | | [`voice::VoiceState`](/docs/reference/rust/zaun-bot/struct-voice-voicestate/) | | ## Traits | Item | Summary | |---|---| | [`Bot`](/docs/reference/rust/zaun-bot/trait-bot/) | A Zaun bot. Every handler has a no-op default; implement the ones you need. | | [`bindings::Guest`](/docs/reference/rust/zaun-bot/trait-bindings-guest/) | | | [`Options`](/docs/reference/rust/zaun-bot/trait-options/) | Reads option and modal values by name. | ## Type aliass | Item | Summary | |---|---| | [`bindings::zaun::bot::presence::Activity`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-presence-activity/) | | | [`bindings::zaun::bot::commands::ApplicationCommand`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-commands-applicationcommand/) | | | [`bindings::zaun::bot::dms::Channel`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-dms-channel/) | | | [`bindings::zaun::bot::community::Channel`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-channel/) | | | [`bindings::Choice`](/docs/reference/rust/zaun-bot/type-alias-bindings-choice/) | | | [`bindings::Event`](/docs/reference/rust/zaun-bot/type-alias-bindings-event/) | | | [`bindings::zaun::bot::messages::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-hosterror/) | | | [`bindings::zaun::bot::interactions::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-hosterror/) | | | [`bindings::zaun::bot::commands::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-commands-hosterror/) | | | [`bindings::zaun::bot::dms::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-dms-hosterror/) | | | [`bindings::zaun::bot::community::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-hosterror/) | | | [`bindings::zaun::bot::storage::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-storage-hosterror/) | | | [`bindings::zaun::bot::timers::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-timers-hosterror/) | | | [`bindings::zaun::bot::voice::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-voice-hosterror/) | | | [`bindings::zaun::bot::audio::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-audio-hosterror/) | | | [`bindings::zaun::bot::presence::HostError`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-presence-hosterror/) | | | [`bindings::zaun::bot::types::Id`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-types-id/) | A Zaun id: base64url without padding (22 characters for 16-byte ids). | | [`bindings::zaun::bot::messages::Id`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-id/) | | | [`bindings::zaun::bot::interactions::Id`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-id/) | | | [`bindings::zaun::bot::dms::Id`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-dms-id/) | | | [`bindings::zaun::bot::community::Id`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-id/) | | | [`bindings::zaun::bot::voice::Id`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-voice-id/) | | | [`bindings::Interaction`](/docs/reference/rust/zaun-bot/type-alias-bindings-interaction/) | | | [`bindings::zaun::bot::community::Member`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-member/) | | | [`bindings::zaun::bot::messages::Message`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-message/) | | | [`bindings::zaun::bot::messages::MessageBody`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-messagebody/) | | | [`bindings::zaun::bot::interactions::MessageBody`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-messagebody/) | | | [`bindings::zaun::bot::types::Permissions`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-types-permissions/) | A permission bitfield (permissions.md the protocol). | | [`bindings::zaun::bot::commands::RegisteredCommand`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-commands-registeredcommand/) | | | [`bindings::Registration`](/docs/reference/rust/zaun-bot/type-alias-bindings-registration/) | | | [`bindings::zaun::bot::interactions::Response`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-response/) | | | [`bindings::zaun::bot::community::Role`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-role/) | | | [`bindings::zaun::bot::types::Timestamp`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-types-timestamp/) | Milliseconds since the Unix epoch. | | [`bindings::zaun::bot::community::Timestamp`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-timestamp/) | | | [`bindings::zaun::bot::presence::Timestamp`](/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-presence-timestamp/) | | | [`bindings::VoiceEvent`](/docs/reference/rust/zaun-bot/type-alias-bindings-voiceevent/) | | --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/ --- # zaun-client 0.6.0 > API reference of the zaun_client crate, generated from rustdoc. Generated from rustdoc for `zaun_client` 0.6.0. [Browse the full rustdoc HTML](/docs/api/rust/zaun-client/zaun_client/index.html). A Zaun community client over SimpleX: join, post, moderate and cache communities. `Client` runs one SimpleX client and keeps a post-quantum connection per community to the community's host (`zaun-host`). It verifies the host, registers a member key, and keeps a local cache of each community (channels, roles, members) up to date from the host's events. In the spirit of discord.js, what it reports are objects that act for themselves: `Community`, `Channel`, `Message`, `Member`, `Role`, `Attachment`. `Client::command` sends any command the objects do not wrap. ```rust use zaun_client::{Client, Event}; let client = Client::builder("./bot").name("Ping bot").key("store passphrase").start()?; let community = client.join("zaun://join/…", "Ping bot")?; let general = community.channel_by_name("general").expect("a general channel"); general.send("hello")?; for event in client.events() { match event { Event::MessageCreate(message) if message.content() == "!ping" => { message.reply("pong")?; } Event::MemberAdd(member) => println!("welcome, {member}"), _ => {} } } ``` Messages carry rich embeds as discord.js's do: build one with `EmbedBuilder` and post it with `MessageOptions`. Its pictures are files uploaded as the message's attachments, never remote URLs, so no reader's client fetches anything from a third party. Voice channels join like discord.js's: `channel.join()?` gives a `VoiceSession`, and an `AudioPlayer` subscribed to it plays files for a music bot. The host is the authority: the cache and `Member::can` are a local view that lets an application hide what a member cannot do, and the host still decides. ## Constants | Item | Summary | |---|---| | [`mention::EVERYONE`](/docs/reference/rust/zaun-client/constant-mention-everyone/) | The text that shows `@everyone`. | | [`TEXT_BUDGET`](/docs/reference/rust/zaun-client/constant-text_budget/) | The largest frame text, in bytes as written inside the JSON string that carries it (`framing::escaped_len`: every `"` or `\` counts twice), that one message always carries, uncompr | | [`TYPING_SHOWN_MS`](/docs/reference/rust/zaun-client/constant-typing_shown_ms/) | How long one typing signal shows: the host repeats it at most every 3 s while typing goes on, so two missed repeats end it. | ## Enums | Item | Summary | |---|---| | [`AudioPlayerEvent`](/docs/reference/rust/zaun-client/enum-audioplayerevent/) | What a player tells the application. | | [`AudioPlayerStatus`](/docs/reference/rust/zaun-client/enum-audioplayerstatus/) | What a player is doing. | | [`ui::EntityKind`](/docs/reference/rust/zaun-client/enum-ui-entitykind/) | What an entity select offers. | | [`Error`](/docs/reference/rust/zaun-client/enum-error/) | A `zaun-client` failure. | | [`Event`](/docs/reference/rust/zaun-client/enum-event/) | One thing that happened. | | [`Picture`](/docs/reference/rust/zaun-client/enum-picture/) | Where an embed's picture (or a message's file) comes from. Pictures are never remote URLs: a file is uploaded as one of the message's attachments, so no reader's client ever fetche | | [`TypingNow`](/docs/reference/rust/zaun-client/enum-typingnow/) | Who else is typing in a channel, as the host last said. This client is never among them. | | [`VoiceEvent`](/docs/reference/rust/zaun-client/enum-voiceevent/) | What happens in a voice session. | ## Functions | Item | Summary | |---|---| | [`presence::activity`](/docs/reference/rust/zaun-client/function-presence-activity/) | An activity of `kind` named `name`, for `Client::set_presence`. Set `details`, `state`, `started_at`, `url` (streaming) or `emoji` (custom) on it as needed. | | [`files::guess_mime`](/docs/reference/rust/zaun-client/function-files-guess_mime/) | A media type from a file name's extension; `application/octet-stream` otherwise. | | [`registry::inspect_package`](/docs/reference/rust/zaun-client/function-registry-inspect_package/) | What a `.zbot` file says, whether its signature verifies and whether it passes the registry's package checks. | | [`registry::key_id`](/docs/reference/rust/zaun-client/function-registry-key_id/) | The id of a base64url public key: what a bot card's `source.registry_id` is compared with. | | [`presence::line`](/docs/reference/rust/zaun-client/function-presence-line/) | "Playing {name}", "Streaming {name}", "Listening to {name}", "Watching {name}", "Competing in {name}", or `{emoji} {name}` for a custom one. | | [`files::measure`](/docs/reference/rust/zaun-client/function-files-measure/) | The size and SHA3-256 of the file at `path`. | | [`mention::member`](/docs/reference/rust/zaun-client/function-mention-member/) | The text that shows a member mention, `<@id>` (discord.js `userMention`). It only shows where the mention is: the message's mentions list is what notifies. | | [`mention::parse`](/docs/reference/rust/zaun-client/function-mention-parse/) | The mentions `content` shows: `<@id>` (and Discord's `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most 50 members and 20 roles; malformed ids | | [`mention::role`](/docs/reference/rust/zaun-client/function-mention-role/) | The text that shows a role mention, `<@&id>` (discord.js `roleMention`). | | [`files::safe_name`](/docs/reference/rust/zaun-client/function-files-safe_name/) | A name for `name` that is safe as one path component: no separators, no control characters, no leading dots; `attachment` when nothing is left. | | [`registry::verify_catalog`](/docs/reference/rust/zaun-client/function-registry-verify_catalog/) | Verifies `catalog.json` bytes and the text of `catalog.json.sig` against the key of `pinned` (base64url public keys) that the catalog names, at Unix time `now` (seconds), after `se | | [`registry::verify_history`](/docs/reference/rust/zaun-client/function-registry-verify_history/) | Verifies the catalog as `verify_catalog` does (no stored serial), then `history/.json` against the hash the verified catalog lists for it. | ## Structs | Item | Summary | |---|---| | [`ui::ActionRow`](/docs/reference/rust/zaun-client/struct-ui-actionrow/) | A row of up to five buttons, or one select. | | [`Attachment`](/docs/reference/rust/zaun-client/struct-attachment/) | A file on a message. | | [`AudioPlayer`](/docs/reference/rust/zaun-client/struct-audioplayer/) | Plays `AudioResource`s, one at a time, into every subscribed voice session. | | [`AudioResource`](/docs/reference/rust/zaun-client/struct-audioresource/) | Something to play: Opus packets, from an Ogg Opus file or stream, from ffmpeg (any format it reads), or from the application. | | [`ui::Button`](/docs/reference/rust/zaun-client/struct-ui-button/) | A button: one that sends an interaction (`custom_id`), or a link the reader confirms. | | [`registry::CatalogCheck`](/docs/reference/rust/zaun-client/struct-registry-catalogcheck/) | `verify_catalog`'s answer: the registry's report and, when `ok`, the verified catalog. | | [`Channel`](/docs/reference/rust/zaun-client/struct-channel/) | A channel or category of a community. | | [`ui::Checkbox`](/docs/reference/rust/zaun-client/struct-ui-checkbox/) | One yes/no box (type 23); never required. | | [`ui::CheckboxGroup`](/docs/reference/rust/zaun-client/struct-ui-checkboxgroup/) | Several choices (type 22). | | [`Client`](/docs/reference/rust/zaun-client/struct-client/) | A Zaun client. Clones share one SimpleX client and one driver; methods may be called from any thread, and block until the host answers or the timeout passes. | | [`ClientBuilder`](/docs/reference/rust/zaun-client/struct-clientbuilder/) | Configures a `Client`. The directory holds the SimpleX store and `zaun/`, the community keys and state; give every client its own. | | [`ui::CommandBuilder`](/docs/reference/rust/zaun-client/struct-ui-commandbuilder/) | A slash, user or message command. | | [`Community`](/docs/reference/rust/zaun-client/struct-community/) | A community this client belongs to (or did: a handle outlives a leave). | | [`CommunityData`](/docs/reference/rust/zaun-client/struct-communitydata/) | A community as this client last heard of it. Cheap to clone; a clone does not update. | | [`ui::Container`](/docs/reference/rust/zaun-client/struct-ui-container/) | A box around other components (type 17). | | [`DmChannel`](/docs/reference/rust/zaun-client/struct-dmchannel/) | A DM channel: an ordinary channel object of kind `dm` with its two participants. | | [`EditMessage`](/docs/reference/rust/zaun-client/struct-editmessage/) | An edit of one of this member's messages. A plain `&str` replaces the text and leaves the embeds and mentions as they are. | | [`EmbedBuilder`](/docs/reference/rust/zaun-client/struct-embedbuilder/) | A rich embed, built with chained setters and sent with `MessageOptions::embed`: | | [`EphemeralReply`](/docs/reference/rust/zaun-client/struct-ephemeralreply/) | A bot's ephemeral reply (`EPHEMERAL`): only this member sees it, nothing stores it, and it lives as long as the interaction (15 minutes). Key it by its message's `message_id`. | | [`FfmpegOptions`](/docs/reference/rust/zaun-client/struct-ffmpegoptions/) | How `AudioResource::ffmpeg_file` and its siblings transcode. | | [`ui::File`](/docs/reference/rust/zaun-client/struct-ui-file/) | One attached file (type 13). | | [`ui::FileUpload`](/docs/reference/rust/zaun-client/struct-ui-fileupload/) | Files the member uploads (type 19). | | [`HandOff`](/docs/reference/rust/zaun-client/struct-handoff/) | What a hand-off signed and published: the new delegation and the descriptor naming it. | | [`registry::HistoryCheck`](/docs/reference/rust/zaun-client/struct-registry-historycheck/) | `verify_history`'s answer: the registry's report and, when `ok`, the verified history. | | [`Interaction`](/docs/reference/rust/zaun-client/struct-interaction/) | Someone used one of this bot's commands, components or modals. Answer within 3 s (`respond`, or `Response::defer` first); follow-ups and edits work for 15 minutes. | | [`InteractionFailure`](/docs/reference/rust/zaun-client/struct-interactionfailure/) | An interaction that got no answer (the bot timed out, failed or is not running). | | [`registry::KeyIdReport`](/docs/reference/rust/zaun-client/struct-registry-keyidreport/) | `key_id`'s answer. | | [`ui::MediaGallery`](/docs/reference/rust/zaun-client/struct-ui-mediagallery/) | Up to ten pictures (type 12). | | [`Member`](/docs/reference/rust/zaun-client/struct-member/) | A member of a community. | | [`Message`](/docs/reference/rust/zaun-client/struct-message/) | A message in a channel. | | [`MessageOptions`](/docs/reference/rust/zaun-client/struct-messageoptions/) | A message to post: text, embeds, files and the message it answers. A plain `&str` is one with text only, so `channel.send("hi")` still reads as it did. | | [`ui::Modal`](/docs/reference/rust/zaun-client/struct-ui-modal/) | A modal: up to five labelled inputs and texts. | | [`ModalOpen`](/docs/reference/rust/zaun-client/struct-modalopen/) | A bot asks this member to fill in a modal; submit it with `Channel::submit_modal` and `interaction` as the modal id. | | [`ui::OptionBuilder`](/docs/reference/rust/zaun-client/struct-ui-optionbuilder/) | An option of a slash command. | | [`PartialMessage`](/docs/reference/rust/zaun-client/struct-partialmessage/) | A message known only by its id, as an edit, a deletion or a reaction names it: the client keeps no message history, so its text and author are not at hand. It acts like a `Message` | | [`PendingMessage`](/docs/reference/rust/zaun-client/struct-pendingmessage/) | A post on its way (`Channel::send_pending`): what to show until the host answers. | | [`Presence`](/docs/reference/rust/zaun-client/struct-presence/) | A member's presence as everyone else sees it (`invisible` members look `Offline`). | | [`ui::RadioGroup`](/docs/reference/rust/zaun-client/struct-ui-radiogroup/) | One choice among options (type 21). | | [`Reaction`](/docs/reference/rust/zaun-client/struct-reaction/) | A reaction added or taken off. | | [`Response`](/docs/reference/rust/zaun-client/struct-response/) | What a bot answers an interaction with. Build one with the constructors. | | [`Role`](/docs/reference/rust/zaun-client/struct-role/) | A role of a community. | | [`ui::Section`](/docs/reference/rust/zaun-client/struct-ui-section/) | One to three texts with a button or thumbnail beside them (type 9). | | [`ui::Select`](/docs/reference/rust/zaun-client/struct-ui-select/) | A select menu. | | [`ui::Separator`](/docs/reference/rust/zaun-client/struct-ui-separator/) | A line or a gap (type 14). | | [`Suggestions`](/docs/reference/rust/zaun-client/struct-suggestions/) | A bot's suggestions for the option this member is typing. | | [`ui::TextDisplay`](/docs/reference/rust/zaun-client/struct-ui-textdisplay/) | Markdown text (type 10). | | [`ui::TextInput`](/docs/reference/rust/zaun-client/struct-ui-textinput/) | A text field. | | [`ui::Thumbnail`](/docs/reference/rust/zaun-client/struct-ui-thumbnail/) | A picture beside a section (type 11). | | [`TypingSeen`](/docs/reference/rust/zaun-client/struct-typingseen/) | A typing state and when it stops showing. | | [`VoiceLeave`](/docs/reference/rust/zaun-client/struct-voiceleave/) | Why someone left a voice channel. | | [`VoiceMute`](/docs/reference/rust/zaun-client/struct-voicemute/) | Someone's mute and deafen state in a voice channel. | | [`VoiceOptions`](/docs/reference/rust/zaun-client/struct-voiceoptions/) | How a voice session connects. | | [`VoiceSession`](/docs/reference/rust/zaun-client/struct-voicesession/) | One stay in a voice channel. Dropping it leaves the channel. | | [`VoiceState`](/docs/reference/rust/zaun-client/struct-voicestate/) | Someone's state in a voice channel. | ## Type aliass | Item | Summary | |---|---| | [`Result`](/docs/reference/rust/zaun-client/type-alias-result/) | `Result` with `Error`. | --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/ --- # zaun-community-protocol 0.4.1 > API reference of the zaun_community_protocol crate, generated from rustdoc. Generated from rustdoc for `zaun_community_protocol` 0.4.1. [Browse the full rustdoc HTML](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/index.html). Zaun community protocol (`docs/community-protocol/specification.md`). Pure data and functions: identifiers, canonical encoding, RFC 10073 composite post-quantum signatures, signed objects, permissions, envelopes, commands, events and limits. No I/O, no clock (time is always a parameter), no dependency on `simplex-client` (ADR-0001, ADR-0012). ## Constants | Item | Summary | |---|---| | [`limits::ACK_CHANNELS`](/docs/reference/rust/zaun-community-protocol/constant-limits-ack_channels/) | `sync.ack` channels. | | [`client::ACK_LINGER_MS`](/docs/reference/rust/zaun-community-protocol/constant-client-ack_linger_ms/) | How long a due `sync.ack` waits for a command to go with. A SimpleX connection sends one message at a time, so a command sent right after a lone ack would wait a relay round trip b | | [`limits::ACTIVITY_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-activity_max/) | Presence `activity`, maximum scalars. | | [`permissions::ALL`](/docs/reference/rust/zaun-community-protocol/constant-permissions-all/) | `ALL` means every known bit, never `u64::MAX` (permissions the protocol). | | [`limits::APP_CHOICE_TEXT`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_choice_text/) | Choice `name` and string `value`, scalars. | | [`limits::APP_COMMAND_DESCRIPTION`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_description/) | Command and option `description` (`CHAT_INPUT`), scalars. | | [`limits::APP_COMMAND_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_name/) | Command and option `name`, scalars. | | [`limits::APP_COMMAND_OPTIONS`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_options/) | Options per command or subcommand, and choices per option. | | [`limits::APP_COMMAND_TEXT_TOTAL`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_text_total/) | All names, descriptions, choice names and values of one command, scalars. | | [`limits::APP_COMMANDS`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_commands/) | Application commands per bot: `CHAT_INPUT`, `USER`, `MESSAGE`. | | [`signed::APP_ID_MAX`](/docs/reference/rust/zaun-community-protocol/constant-signed-app_id_max/) | Bytes of `app_id` (3–64). | | [`limits::APP_LOCALIZATIONS`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_localizations/) | Localized names per field. | | [`limits::APP_OPTION_LENGTH_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-app_option_length_max/) | String option `min_length` / `max_length` bound. | | [`limits::ATTACHMENT_MIME_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-attachment_mime_max/) | Attachment media type, bytes. | | [`limits::ATTACHMENT_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-attachment_name/) | Attachment file name, scalars. | | [`limits::ATTACHMENT_SIZE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-attachment_size_max/) | Largest attachment the protocol allows, in bytes (XFTP's 1 GiB); hosts set lower limits. | | [`limits::ATTACHMENTS_PER_MESSAGE`](/docs/reference/rust/zaun-community-protocol/constant-limits-attachments_per_message/) | Attachments per message. | | [`command::object::AUDIT_ACTIONS`](/docs/reference/rust/zaun-community-protocol/constant-command-object-audit_actions/) | Every audit action of the protocol, expanded from its `a.b\|c` notation. | | [`limits::AUTOCOMPLETE_CHOICES`](/docs/reference/rust/zaun-community-protocol/constant-limits-autocomplete_choices/) | Autocomplete choices. | | [`limits::BAN_DELETE_WINDOW_MAX_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-ban_delete_window_max_ms/) | Ban message-deletion window upper bound in milliseconds (7 days). | | [`crypto::voice::BASE_KEY_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-base_key_len/) | An SFrame base key: 32 bytes. | | [`limits::BOT_COMPONENT_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_component_max/) | The WebAssembly component inside a bot package, bytes. | | [`limits::BOT_CONFIG_KEYS`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_config_keys/) | Settings a bot may declare (`config`). | | [`limits::BOT_CONFIG_VALUE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_config_value_max/) | A setting's value or default, bytes. | | [`limits::BOT_DESCRIPTION_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_description_max/) | A bot's `description`, scalars. | | [`limits::BOT_HEADER_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_header_max/) | Bot package header, manifest and component sizes, bytes. | | [`limits::BOT_LOCAL_NETWORK`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_local_network/) | `local_network` addresses a bot may ask for. | | [`limits::BOT_MANIFEST_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_manifest_max/) | The manifest JSON inside a bot package, bytes. | | [`limits::BOT_NETWORK_HOSTS`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_network_hosts/) | Network hosts a bot may ask for. | | [`limits::BOT_STORAGE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bot_storage_max/) | A bot's key-value storage quota, bytes. | | [`limits::BOTS_PER_COMMUNITY`](/docs/reference/rust/zaun-community-protocol/constant-limits-bots_per_community/) | Bots per community. | | [`limits::BULK_DELETE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-bulk_delete_max/) | Most message ids in one `messages.bulk_deleted` event. | | [`limits::BUTTON_LABEL_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-button_label_max/) | Button `label`, scalars. | | [`limits::CAPABILITIES`](/docs/reference/rust/zaun-community-protocol/constant-limits-capabilities/) | `session.hello` capabilities: count and bytes each. | | [`command::attachment::CAPTION_PREFIX`](/docs/reference/rust/zaun-community-protocol/constant-command-attachment-caption_prefix/) | What every Zaun file transfer's caption starts with; the attachment id follows. | | [`limits::CHANNEL_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-channel_name/) | Channel name length. | | [`limits::CHANNEL_TOPIC_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-channel_topic_max/) | Channel topic, maximum scalars. | | [`limits::CHANNELS_PER_COMMUNITY`](/docs/reference/rust/zaun-community-protocol/constant-limits-channels_per_community/) | Channels per community, including categories. | | [`limits::CHECKBOX_OPTIONS`](/docs/reference/rust/zaun-community-protocol/constant-limits-checkbox_options/) | Checkbox group options. | | [`client::CLIENT_CAPABILITIES`](/docs/reference/rust/zaun-community-protocol/constant-client-client_capabilities/) | Capabilities this client offers in `session.hello`: fragment reassembly. | | [`signed::CLOCK_SKEW_MS`](/docs/reference/rust/zaun-community-protocol/constant-signed-clock_skew_ms/) | Clock-skew allowance on delegation validity windows (rule 4), in milliseconds. | | [`limits::COLOR_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-color_max/) | Largest role colour, `0xFFFFFF`. | | [`limits::COMMUNITY_DESCRIPTION_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-community_description_max/) | Community description, maximum scalars. | | [`limits::COMMUNITY_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-community_name/) | Community name length (scalars). | | [`limits::COMPONENT_CUSTOM_ID`](/docs/reference/rust/zaun-community-protocol/constant-limits-component_custom_id/) | Component `custom_id`, bytes. | | [`limits::COMPONENT_ROW_BUTTONS`](/docs/reference/rust/zaun-community-protocol/constant-limits-component_row_buttons/) | Buttons per action row. | | [`limits::COMPONENT_ROWS`](/docs/reference/rust/zaun-community-protocol/constant-limits-component_rows/) | Top-level action rows of a message without `IS_COMPONENTS_V2`. | | [`limits::COMPONENTS_TOTAL`](/docs/reference/rust/zaun-community-protocol/constant-limits-components_total/) | Components in one message, counting nested ones. | | [`framing::app_data::DATA_TAG`](/docs/reference/rust/zaun-community-protocol/constant-framing-app_data-data_tag/) | The content type of a frame message (`MsgContent` `type`). | | [`limits::DAY_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-day_ms/) | One day in milliseconds. | | [`client::DEFAULT_TEXT_BUDGET`](/docs/reference/rust/zaun-community-protocol/constant-client-default_text_budget/) | Default per-message text budget in UTF-8 bytes. The real value is fixed by the transport adapter from `simplex_client::limits`; this crate never depends on it. | | [`limits::DISPLAY_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-display_name/) | Member display name length. | | [`permissions::DM_GRANTS`](/docs/reference/rust/zaun-community-protocol/constant-permissions-dm_grants/) | What both participants of a `dm` channel may always do. | | [`permissions::DM_IF_GRANTED`](/docs/reference/rust/zaun-community-protocol/constant-permissions-dm_if_granted/) | What a participant may do in a `dm` channel only when its roles grant it in the community. | | [`limits::DM_OPENS_PER_MINUTE`](/docs/reference/rust/zaun-community-protocol/constant-limits-dm_opens_per_minute/) | New DMs one bot may open per minute. | | [`limits::DM_UNANSWERED_PER_HOUR`](/docs/reference/rust/zaun-community-protocol/constant-limits-dm_unanswered_per_hour/) | Messages a bot may write into a DM per hour while the member has never written in it. | | [`keys::ED25519_PK_LEN`](/docs/reference/rust/zaun-community-protocol/constant-keys-ed25519_pk_len/) | Ed25519 public key length. | | [`keys::ED25519_SIG_LEN`](/docs/reference/rust/zaun-community-protocol/constant-keys-ed25519_sig_len/) | Ed25519 signature length. | | [`limits::EMBED_AUTHOR_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_author_name/) | Embed `author.name`, scalars. | | [`limits::EMBED_DESCRIPTION`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_description/) | Embed `description`, scalars. | | [`limits::EMBED_FIELD_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_field_name/) | Embed field `name`, scalars. | | [`limits::EMBED_FIELD_VALUE`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_field_value/) | Embed field `value`, scalars. | | [`limits::EMBED_FIELDS`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_fields/) | Fields per embed. | | [`limits::EMBED_FOOTER_TEXT`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_footer_text/) | Embed `footer.text`, scalars. | | [`limits::EMBED_TEXT_TOTAL`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_text_total/) | The text of all of a message's embeds together (titles, descriptions, field names and values, author names, footer texts), scalars. | | [`limits::EMBED_TITLE`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_title/) | Embed `title`, scalars. | | [`limits::EMBED_URL_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-embed_url_max/) | Embed `url` and `author.url`, maximum bytes. | | [`limits::EMBEDS_PER_MESSAGE`](/docs/reference/rust/zaun-community-protocol/constant-limits-embeds_per_message/) | Embeds per message. | | [`limits::EMOJI_MAX_BYTES`](/docs/reference/rust/zaun-community-protocol/constant-limits-emoji_max_bytes/) | Emoji, maximum bytes. | | [`signed::ENTRY_NAME_MAX`](/docs/reference/rust/zaun-community-protocol/constant-signed-entry_name_max/) | Bytes per chunk name. | | [`command::object::flags::EPHEMERAL`](/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-ephemeral/) | Only the invoker sees it; never stored. | | [`client::EVENTS_BATCH_TYPE`](/docs/reference/rust/zaun-community-protocol/constant-client-events_batch_type/) | `type` of the coalesced event batch envelope. | | [`envelope::EVENTS_TYPE`](/docs/reference/rust/zaun-community-protocol/constant-envelope-events_type/) | The `type` of a batch envelope: a frame type, not an event type. | | [`permissions::EXPENSIVE_HISTORY_DEPTH`](/docs/reference/rust/zaun-community-protocol/constant-permissions-expensive_history_depth/) | `restrict_expensive`: a restricted member reads only the newest this-many sequences of a channel, `sequence > head − EXPENSIVE_HISTORY_DEPTH`. One full `message.history` page. | | [`permissions::EXPENSIVE_MEMBER_PAGE`](/docs/reference/rust/zaun-community-protocol/constant-permissions-expensive_member_page/) | `restrict_expensive`: the most members one `member.list` page returns to a restricted member, who gets only the first page. | | [`signed::EXPORT_FORMAT`](/docs/reference/rust/zaun-community-protocol/constant-signed-export_format/) | The bundle format this manifest describes. | | [`framing::app_data::FALLBACK_TEXT`](/docs/reference/rust/zaun-community-protocol/constant-framing-app_data-fallback_text/) | What an app that does not know `DATA_TAG` shows. Fixed: it never carries frame content. | | [`limits::FILE_UPLOAD_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-file_upload_max/) | Files in one file upload. | | [`signed::FORMAT_V1`](/docs/reference/rust/zaun-community-protocol/constant-signed-format_v1/) | The `format` byte of every v1 signed object. | | [`framing::FRAG_ID_CHARS`](/docs/reference/rust/zaun-community-protocol/constant-framing-frag_id_chars/) | Length of an encoded `FragId` (8 bytes, base64url without padding). | | [`framing::FRAGMENT_PREFIX`](/docs/reference/rust/zaun-community-protocol/constant-framing-fragment_prefix/) | Prefix of a fragment message. | | [`limits::FRAGMENT_TIMEOUT_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-fragment_timeout_ms/) | Milliseconds from the first to the last fragment before a reassembly is discarded. | | [`framing::app_data::FRAME_KEY`](/docs/reference/rust/zaun-community-protocol/constant-framing-app_data-frame_key/) | The data key holding the frame message text. | | [`crypto::voice::FRAMES_PER_KEY`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-frames_per_key/) | Frames one base key may seal before the sender must rekey (2^32: far beyond a session's length at 50 frames a second, and well inside AES-GCM's limits for distinct nonces). | | [`command::object::bot_events::GROUPS`](/docs/reference/rust/zaun-community-protocol/constant-command-object-bot_events-groups/) | The groups a manifest may name, with their event types. | | [`crypto::voice::HEADER_MAX`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-header_max/) | Longest header: config byte, 8-byte KID, 8-byte CTR. | | [`limits::ICE_FIELD_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-ice_field_max/) | Longest ICE server URL, username or credential, in bytes. | | [`limits::ICE_SERVERS_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-ice_servers_max/) | Most ICE servers a host lists in `voice.join`. | | [`limits::ICON_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-icon_max/) | Descriptor icon, maximum bytes (PNG or WebP). | | [`limits::IDEMPOTENCY_RETENTION_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-idempotency_retention_ms/) | Idempotency record retention lower bound in milliseconds. | | [`limits::IN_FLIGHT_DEFAULT`](/docs/reference/rust/zaun-community-protocol/constant-limits-in_flight_default/) | Default in-flight window in SMP messages per member. | | [`limits::IN_FLIGHT_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-in_flight_max/) | Highest configurable in-flight window (half the 128-message SMP queue stays free). | | [`limits::IN_FLIGHT_MIN`](/docs/reference/rust/zaun-community-protocol/constant-limits-in_flight_min/) | Lowest configurable in-flight window (the largest frame must fit). | | [`limits::INTERACTION_ANSWER_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-interaction_answer_ms/) | Interaction answer deadline, ms. | | [`limits::INTERACTION_FOLLOWUPS`](/docs/reference/rust/zaun-community-protocol/constant-limits-interaction_followups/) | Follow-ups per interaction. | | [`limits::INTERACTION_LIFETIME_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-interaction_lifetime_ms/) | Follow-ups, edits and modal submits are accepted this long after the interaction, ms. | | [`limits::INVITE_EXPIRY_MAX_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-invite_expiry_max_ms/) | Invite expiry upper bound in milliseconds (30 days). | | [`client::member::INVITE_LINK_PREFIX`](/docs/reference/rust/zaun-community-protocol/constant-client-member-invite_link_prefix/) | The link scheme and path. | | [`limits::INVITE_MAX_USES`](/docs/reference/rust/zaun-community-protocol/constant-limits-invite_max_uses/) | Invite `max_uses` upper bound (0 means unlimited). | | [`command::object::flags::IS_COMPONENTS_V2`](/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-is_components_v2/) | The message is laid out by components only. | | [`crypto::voice::KEM_CIPHERTEXT_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-kem_ciphertext_len/) | X-Wing ciphertext (HPKE `enc`) length. | | [`crypto::voice::KEM_PUBLIC_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-kem_public_len/) | X-Wing encapsulation (public) key length. | | [`crypto::voice::KEY_PACKAGE_BYTES_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-key_package_bytes_len/) | Canonical bytes of a key package (all fields are fixed width): 1 306 bytes. | | [`crypto::voice::KEY_PACKAGE_WIRE_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-key_package_wire_len/) | A key package on the wire: canonical bytes ‖ composite signature, 4 680 bytes. | | [`crypto::LABEL`](/docs/reference/rust/zaun-community-protocol/constant-crypto-label/) | RFC 10073 `Label` for `id-MLDSA65-Ed25519-SHA512` (ASCII, 30 bytes); the ML-DSA context. | | [`limits::LABEL_TEXT`](/docs/reference/rust/zaun-community-protocol/constant-limits-label_text/) | Label `label` and `description`, scalars. | | [`limits::LAST_N`](/docs/reference/rust/zaun-community-protocol/constant-limits-last_n/) | `last_n` history bounds. | | [`command::object::flags::LOADING`](/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-loading/) | A deferred reply still loading; set only by the host. | | [`permissions::LOCK_MASK`](/docs/reference/rust/zaun-community-protocol/constant-permissions-lock_mask/) | Bits the channel `locked` flag removes (step 7d). | | [`limits::LOCKDOWN_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-lockdown_ms/) | Lockdown duration bounds in milliseconds per `enable` (60 s – 7 days). | | [`signed::MANIFEST_ENTRIES_MAX`](/docs/reference/rust/zaun-community-protocol/constant-signed-manifest_entries_max/) | At most this many chunks. | | [`command::bot::MASKED`](/docs/reference/rust/zaun-community-protocol/constant-command-bot-masked/) | How a secret value is shown. | | [`limits::MAX_CANONICAL_FIELD`](/docs/reference/rust/zaun-community-protocol/constant-limits-max_canonical_field/) | Unlisted variable-length fields in canonical encodings. | | [`limits::MAX_COMMAND`](/docs/reference/rust/zaun-community-protocol/constant-limits-max_command/) | Maximum command envelope, except `community.create` and `community.descriptor.publish`. | | [`limits::MAX_FRAGMENTS`](/docs/reference/rust/zaun-community-protocol/constant-limits-max_fragments/) | Fragments per frame. | | [`limits::MAX_FRAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-max_frame/) | Maximum reassembled envelope in bytes. | | [`envelope::MAX_JSON_INTEGER`](/docs/reference/rust/zaun-community-protocol/constant-envelope-max_json_integer/) | Largest integer a JSON number may carry here (`2^53 − 1`, the protocol). | | [`limits::MAX_OPEN_REASSEMBLIES`](/docs/reference/rust/zaun-community-protocol/constant-limits-max_open_reassemblies/) | Open reassemblies per connection; a further one discards the oldest. | | [`crypto::voice::MAX_RECIPIENTS`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-max_recipients/) | Most recipients one sender-keys message names (a mesh of 32 participants). | | [`limits::MEDIA_DESCRIPTION_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-media_description_max/) | Media description, scalars. | | [`limits::MEDIA_GALLERY_ITEMS`](/docs/reference/rust/zaun-community-protocol/constant-limits-media_gallery_items/) | Media gallery items. | | [`limits::MENTION_MEMBERS`](/docs/reference/rust/zaun-community-protocol/constant-limits-mention_members/) | Member mentions per message. | | [`limits::MENTION_ROLES`](/docs/reference/rust/zaun-community-protocol/constant-limits-mention_roles/) | Role mentions per message. | | [`limits::MESSAGE_CONTENT`](/docs/reference/rust/zaun-community-protocol/constant-limits-message_content/) | Message content length. The content may be empty when the message has an attachment or an embed. | | [`limits::MESSAGE_JSON_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-message_json_max/) | A message's `content` and `embeds` together, as JSON bytes the host writes them (`message_json_len`), so that every message, message event and report fits a page. One `message.send | | [`framing::MIN_BUDGET`](/docs/reference/rust/zaun-community-protocol/constant-framing-min_budget/) | The smallest accepted per-message budget: a fragment header plus one character at its largest escaped (six bytes, `escaped_len`). | | [`keys::MLDSA65_PK_LEN`](/docs/reference/rust/zaun-community-protocol/constant-keys-mldsa65_pk_len/) | ML-DSA-65 public key length. | | [`keys::MLDSA65_SIG_LEN`](/docs/reference/rust/zaun-community-protocol/constant-keys-mldsa65_sig_len/) | ML-DSA-65 signature length. | | [`limits::MODAL_ITEMS`](/docs/reference/rust/zaun-community-protocol/constant-limits-modal_items/) | Top-level modal items. | | [`limits::MODAL_TITLE`](/docs/reference/rust/zaun-community-protocol/constant-limits-modal_title/) | Modal `title`, scalars. | | [`permissions::safety::NEWCOMER_FORBIDDEN`](/docs/reference/rust/zaun-community-protocol/constant-permissions-safety-newcomer_forbidden/) | Bits `newcomer_restrictions` must never contain: newcomers always see and read. | | [`limits::NEWCOMER_WINDOW_MAX_S`](/docs/reference/rust/zaun-community-protocol/constant-limits-newcomer_window_max_s/) | Largest lockdown `newcomer_window_s`: 30 days, in seconds. | | [`command::lockdown::NEWCOMER_WINDOW_MAX_S`](/docs/reference/rust/zaun-community-protocol/constant-command-lockdown-newcomer_window_max_s/) | Largest `newcomer_window_s`: 30 days. | | [`limits::OVERRIDES_PER_CHANNEL`](/docs/reference/rust/zaun-community-protocol/constant-limits-overrides_per_channel/) | Overrides per channel. | | [`signed::PACKAGE_FORMAT`](/docs/reference/rust/zaun-community-protocol/constant-signed-package_format/) | The package format this header describes. | | [`signed::PACKAGE_MAGIC`](/docs/reference/rust/zaun-community-protocol/constant-signed-package_magic/) | The file's first four bytes. | | [`signed::PACKAGE_VERSION`](/docs/reference/rust/zaun-community-protocol/constant-signed-package_version/) | The container version byte after the magic. | | [`limits::PAGE_BYTES`](/docs/reference/rust/zaun-community-protocol/constant-limits-page_bytes/) | The items of one paged response (`message.history` messages, `sync.events` events, `report.list` reports; for `sync.resume`, the whole body), as JSON bytes: below `MAX_FRAME` by en | | [`limits::PAGE_LARGE`](/docs/reference/rust/zaun-community-protocol/constant-limits-page_large/) | Page size: `member.list`, `sync.events`. | | [`limits::PAGE_SMALL`](/docs/reference/rust/zaun-community-protocol/constant-limits-page_small/) | Page size: `message.history`, `audit.list`, `invite.list`, `invite.uses`, `member.bans`, `membership.pending`, `report.list`. | | [`permissions::PENDING_ALLOWED`](/docs/reference/rust/zaun-community-protocol/constant-permissions-pending_allowed/) | Commands a `Pending` member may issue. `verification.*` (P2, reserved) is not listed. | | [`limits::PENDING_EXPIRY_MAX_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-pending_expiry_max_ms/) | Pending expiry upper bound in milliseconds (30 days); default 7 days. | | [`limits::PENDING_PER_COMMUNITY`](/docs/reference/rust/zaun-community-protocol/constant-limits-pending_per_community/) | Pending members per community. | | [`crypto::PREFIX`](/docs/reference/rust/zaun-community-protocol/constant-crypto-prefix/) | RFC 10073 `Prefix` (ASCII, 32 bytes). | | [`framing::PROTOCOL_PREFIX`](/docs/reference/rust/zaun-community-protocol/constant-framing-protocol_prefix/) | Prefix shared by every protocol message; text without it is not a protocol message. | | [`limits::PROTOCOL_VERSION`](/docs/reference/rust/zaun-community-protocol/constant-limits-protocol_version/) | Protocol version defined by this crate. | | [`keys::PUBLIC_KEY_LEN`](/docs/reference/rust/zaun-community-protocol/constant-keys-public_key_len/) | Encoded `PublicKey` length. | | [`limits::RADIO_OPTIONS`](/docs/reference/rust/zaun-community-protocol/constant-limits-radio_options/) | Radio group options. | | [`limits::REACTIONS_PER_MESSAGE`](/docs/reference/rust/zaun-community-protocol/constant-limits-reactions_per_message/) | Distinct reaction emoji per message. | | [`limits::REASON_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-reason_max/) | Moderation reason, maximum scalars. | | [`crypto::voice::RECIPIENT_ENTRY_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-recipient_entry_len/) | One recipient entry: member id ‖ voice session ‖ SHA3-256 of the wrapped key. | | [`crypto::voice::REPLAY_WINDOW`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-replay_window/) | Counters a receiver accepts behind the highest one seen (out-of-order delivery). | | [`limits::REPORT_DESCRIPTION_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-report_description_max/) | Report description, maximum scalars. | | [`limits::REPORT_EVIDENCE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-report_evidence_max/) | Report evidence, maximum messages. | | [`limits::REPORT_NOTE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-report_note_max/) | Report resolution `note`, maximum scalars. | | [`limits::REPORT_SNAPSHOT_BYTES`](/docs/reference/rust/zaun-community-protocol/constant-limits-report_snapshot_bytes/) | The evidence snapshots (content and embeds as JSON) one rendered report carries; the first snapshot always goes, and `evidence_next` names where the rest continue. | | [`limits::REQUEST_NOTE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-request_note_max/) | Membership request note, maximum scalars. | | [`command::RESERVED_COMMANDS`](/docs/reference/rust/zaun-community-protocol/constant-command-reserved_commands/) | The reserved governance commands of the protocol: answered with `UNSUPPORTED_FEATURE`. | | [`command::RESERVED_NAMESPACES`](/docs/reference/rust/zaun-community-protocol/constant-command-reserved_namespaces/) | Reserved `type` namespaces of the protocol (prefixes including the dot): answered with `UNSUPPORTED_COMMAND`; v1 clients ignore events in them. | | [`envelope::RESPONSE_TYPE`](/docs/reference/rust/zaun-community-protocol/constant-envelope-response_type/) | The `type` of every response envelope. | | [`limits::RESUME_CHANNELS`](/docs/reference/rust/zaun-community-protocol/constant-limits-resume_channels/) | `sync.resume`: channels per request. | | [`limits::RESUME_EVENTS_PER_STREAM`](/docs/reference/rust/zaun-community-protocol/constant-limits-resume_events_per_stream/) | `sync.resume`: events per stream. | | [`limits::ROLE_NAME`](/docs/reference/rust/zaun-community-protocol/constant-limits-role_name/) | Role name length. | | [`limits::ROLES_PER_COMMUNITY`](/docs/reference/rust/zaun-community-protocol/constant-limits-roles_per_community/) | Roles per community, including `@everyone`. | | [`limits::ROLES_PER_MEMBER`](/docs/reference/rust/zaun-community-protocol/constant-limits-roles_per_member/) | Roles per member. | | [`limits::ROTATIONS_PAGE`](/docs/reference/rust/zaun-community-protocol/constant-limits-rotations_page/) | Page size: `community.rotations`. | | [`crypto::SECRET_KEY_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-secret_key_len/) | Length of SecretKey: `mldsaSeed` (32) ‖ `edSK` (32). | | [`limits::SECTION_TEXTS`](/docs/reference/rust/zaun-community-protocol/constant-limits-section_texts/) | Section text displays. | | [`limits::SELECT_OPTION_TEXT`](/docs/reference/rust/zaun-community-protocol/constant-limits-select_option_text/) | Select option `label`, `value`, `description`, scalars. | | [`limits::SELECT_OPTIONS`](/docs/reference/rust/zaun-community-protocol/constant-limits-select_options/) | Select options. | | [`limits::SELECT_PLACEHOLDER_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-select_placeholder_max/) | Select `placeholder`, scalars. | | [`crypto::voice::SENDER_KEYS_BYTES_MAX`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sender_keys_bytes_max/) | Largest canonical sender-keys message: 2 090 bytes. | | [`crypto::voice::SENDER_KEYS_FIXED_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sender_keys_fixed_len/) | Canonical bytes of a sender-keys message without its recipients. | | [`crypto::voice::SENDER_KEYS_WIRE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sender_keys_wire_max/) | Largest sender-keys message on the wire: `u32` length ‖ bytes ‖ signature, 5 468 bytes. | | [`command::object::flags::SETTABLE`](/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-settable/) | What a sender may set. | | [`crypto::voice::SFRAME_CIPHER_SUITE`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sframe_cipher_suite/) | The SFrame cipher suite: `AES_256_GCM_SHA512_128`. | | [`crypto::voice::SFRAME_OVERHEAD_MAX`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sframe_overhead_max/) | Most bytes SFrame adds to a frame: the longest header and the tag. | | [`limits::SIGNAL_INTERVAL_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-signal_interval_ms/) | Minimum interval between signals per member per channel, in milliseconds. | | [`keys::SIGNATURE_LEN`](/docs/reference/rust/zaun-community-protocol/constant-keys-signature_len/) | Encoded `Signature` length. | | [`limits::SLOWMODE_MAX_S`](/docs/reference/rust/zaun-community-protocol/constant-limits-slowmode_max_s/) | Slowmode upper bound in seconds. | | [`limits::SNAPSHOT_PAGE`](/docs/reference/rust/zaun-community-protocol/constant-limits-snapshot_page/) | `sync.snapshot` page. | | [`crypto::voice::SUITE_V1`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-suite_v1/) | The voice suite of protocol version 1: X-Wing KEM, HPKE (HKDF-SHA256, AES-256-GCM), SFrame `AES_256_GCM_SHA512_128`. Unknown suites are rejected (ADR-0011 agility rules). | | [`signed::SUPPORTED_WORLDS`](/docs/reference/rust/zaun-community-protocol/constant-signed-supported_worlds/) | The `zaun:bot` worlds a host built from this crate runs; a package for any other is refused at install and update (it could never load). Kept equal to the bot runtime's list. | | [`command::object::flags::SUPPRESS_EMBEDS`](/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-suppress_embeds/) | Embeds are not shown. | | [`command::object::flags::SUPPRESS_NOTIFICATIONS`](/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-suppress_notifications/) | Mentions do not notify. | | [`permissions::SUSPENDED_ALLOWED`](/docs/reference/rust/zaun-community-protocol/constant-permissions-suspended_allowed/) | Commands a `Suspended` member may issue: the same as `Pending`. | | [`limits::SUSPENSION_MAX_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-suspension_max_ms/) | Suspension upper bound in milliseconds (90 days), or until restored. | | [`permissions::TABLE`](/docs/reference/rust/zaun-community-protocol/constant-permissions-table/) | Every command of the table with its requirement, in specification order. | | [`crypto::voice::TAG_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-tag_len/) | AES-256-GCM tag length (HPKE and SFrame). | | [`limits::TEXT_DISPLAY_TOTAL`](/docs/reference/rust/zaun-community-protocol/constant-limits-text_display_total/) | All text displays of one message or modal together, scalars. | | [`limits::TEXT_INPUT_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-text_input_max/) | Text input value and length bounds, scalars. | | [`limits::TEXT_INPUT_PLACEHOLDER_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-text_input_placeholder_max/) | Text input `placeholder`, scalars. | | [`permissions::TIMEOUT_KEEP`](/docs/reference/rust/zaun-community-protocol/constant-permissions-timeout_keep/) | Bits a timed-out member keeps (step 7a). | | [`limits::TIMEOUT_MAX_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-timeout_max_ms/) | Timeout upper bound in milliseconds (28 days). | | [`limits::TYPING_COUNT_CAP`](/docs/reference/rust/zaun-community-protocol/constant-limits-typing_count_cap/) | The largest `count` of an anonymous `signal.typing`: 3 means "three or more", so a larger channel never learns exactly how many are typing. | | [`permissions::UNBOUND_ALLOWED`](/docs/reference/rust/zaun-community-protocol/constant-permissions-unbound_allowed/) | Commands an unbound (negotiated) connection may send: `community.rotations` too, naming the community in the envelope's `community_id` (the chain is public and signed; a client nee | | [`limits::UNBOUND_DEADLINE_MS`](/docs/reference/rust/zaun-community-protocol/constant-limits-unbound_deadline_ms/) | Unbound connection deadline (default) in milliseconds. | | [`permissions::UNBOUND_ONLY`](/docs/reference/rust/zaun-community-protocol/constant-permissions-unbound_only/) | Commands that only make sense unbound; a bound connection gets `CONFLICT`. | | [`signed::VERSION_MAX`](/docs/reference/rust/zaun-community-protocol/constant-signed-version_max/) | Bytes of `version`. | | [`limits::VOICE_KEY_PACKAGE_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-voice_key_package_max/) | Largest `key_package` of `voice.join`, decoded bytes (opaque to the host; the media layer's packages are 4 680 bytes). | | [`limits::VOICE_MESH_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-voice_mesh_max/) | The most participants a voice channel can have on any host (`mesh_max` ≤ this). Every participant's key package is in the `voice.join` response, which must fit in `MAX_FRAME` (9 ba | | [`limits::VOICE_SENDER_KEYS_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-voice_sender_keys_max/) | Largest `sender_keys` of `voice.keys`, decoded bytes: the sender's signed message for one epoch, the same for every recipient (the media layer's are at most 5 468 bytes). | | [`limits::VOICE_SIGNAL_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-voice_signal_max/) | Largest `data` of `voice.signal` (WebRTC SDP or ICE), decoded bytes. | | [`limits::VOICE_USER_LIMIT`](/docs/reference/rust/zaun-community-protocol/constant-limits-voice_user_limit/) | `user_limit` of a voice channel. | | [`limits::VOICE_WRAPPED_KEY_MAX`](/docs/reference/rust/zaun-community-protocol/constant-limits-voice_wrapped_key_max/) | Largest `wrapped` key of one `voice.keys` entry, decoded bytes (the media layer's are 1 168 bytes). | | [`permissions::WAITING_MASK`](/docs/reference/rust/zaun-community-protocol/constant-permissions-waiting_mask/) | Bits the admission policy's waiting period withholds: posting, reacting and creating invitations. | | [`framing::WHOLE_PREFIX`](/docs/reference/rust/zaun-community-protocol/constant-framing-whole_prefix/) | Prefix of a whole-envelope message. | | [`signed::WORLD_MAX`](/docs/reference/rust/zaun-community-protocol/constant-signed-world_max/) | Bytes of `world`. | | [`crypto::voice::WRAPPED_KEY_LEN`](/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-wrapped_key_len/) | A wrapped sender key: `enc ‖ AES-256-GCM(base key) ‖ tag`, 1 168 bytes. | ## Enums | Item | Summary | |---|---| | [`permissions::Access`](/docs/reference/rust/zaun-community-protocol/enum-permissions-access/) | Who may send the command at all, before any bit is checked. | | [`command::object::ActivityType`](/docs/reference/rust/zaun-community-protocol/enum-command-object-activitytype/) | What the member is doing. | | [`signed::AdmissionMode`](/docs/reference/rust/zaun-community-protocol/enum-signed-admissionmode/) | `AdmissionSummary.mode`. | | [`command::object::AdmissionVia`](/docs/reference/rust/zaun-community-protocol/enum-command-object-admissionvia/) | `admission.via`. SPEC: a plain string (`"invite" \| "request"`), not `{t}`. | | [`command::object::Availability`](/docs/reference/rust/zaun-community-protocol/enum-command-object-availability/) | `availability`. SPEC: a plain string, as written in the spec. | | [`envelope::BatchError`](/docs/reference/rust/zaun-community-protocol/enum-envelope-batcherror/) | A batch that breaks the rules of the protocol Indices count from 0 in `body.events`. | | [`command::BodyError`](/docs/reference/rust/zaun-community-protocol/enum-command-bodyerror/) | A body that cannot be accepted. Each variant maps to one error code of the protocol; the envelope layer adds `request_id`, the message text and the extra fields. | | [`command::object::BotKind`](/docs/reference/rust/zaun-community-protocol/enum-command-object-botkind/) | `kind` of a bot. | | [`command::object::BotState`](/docs/reference/rust/zaun-community-protocol/enum-command-object-botstate/) | `state` of an installed bot. | | [`client::BuildError`](/docs/reference/rust/zaun-community-protocol/enum-client-builderror/) | An owner or member object (descriptor, delegation, registration, body) could not be built. | | [`command::object::ButtonStyle`](/docs/reference/rust/zaun-community-protocol/enum-command-object-buttonstyle/) | Button `style`: 1 primary, 2 secondary, 3 success, 4 danger, 5 link. | | [`model::ChannelKind`](/docs/reference/rust/zaun-community-protocol/enum-model-channelkind/) | The kind of a channel (permissions the protocol, the protocol). | | [`command::object::ChoiceValue`](/docs/reference/rust/zaun-community-protocol/enum-command-object-choicevalue/) | A choice `value`: a string or a number. | | [`client::ClientError`](/docs/reference/rust/zaun-community-protocol/enum-client-clienterror/) | A command could not be prepared or the session refuses to send it. | | [`client::ClientEvent`](/docs/reference/rust/zaun-community-protocol/enum-client-clientevent/) | One outcome for the application. | | [`command::Command`](/docs/reference/rust/zaun-community-protocol/enum-command-command/) | A decoded command body: one variant per command of the protocol | | [`command::object::CommandType`](/docs/reference/rust/zaun-community-protocol/enum-command-object-commandtype/) | `type` of a command: 1 `CHAT_INPUT` (a slash command), 2 `USER`, 3 `MESSAGE` (context menus). | | [`command::object::Component`](/docs/reference/rust/zaun-community-protocol/enum-command-object-component/) | One component. The variant is the wire `type` number. | | [`permissions::ConflictReason`](/docs/reference/rust/zaun-community-protocol/enum-permissions-conflictreason/) | Why a state transition does not apply (`CONFLICT`). | | [`crypto::Context`](/docs/reference/rust/zaun-community-protocol/enum-crypto-context/) | An RFC 10073 `ctx` value of this protocol. The verifier always supplies the context of the object type it expects; it is never read from the input. | | [`crypto::ContextStatus`](/docs/reference/rust/zaun-community-protocol/enum-crypto-contextstatus/) | Whether a context is part of v1 conformance. | | [`command::interaction::CreateData`](/docs/reference/rust/zaun-community-protocol/enum-command-interaction-createdata/) | `interaction.create` data, by type. | | [`encoding::DecodeError`](/docs/reference/rust/zaun-community-protocol/enum-encoding-decodeerror/) | The input is not a canonical encoding. | | [`command::object::DefaultValueKind`](/docs/reference/rust/zaun-community-protocol/enum-command-object-defaultvaluekind/) | `default_values` entry kind of an entity select. | | [`permissions::DenialReason`](/docs/reference/rust/zaun-community-protocol/enum-permissions-denialreason/) | Why a permission check failed, when a specific rule caused it (permissions the protocol). | | [`framing::DiscardReason`](/docs/reference/rust/zaun-community-protocol/enum-framing-discardreason/) | Why a reassembly (or a fragment that would start one) was discarded. A discard produces no response; the sender's retry repairs it. | | [`signed::Discovery`](/docs/reference/rust/zaun-community-protocol/enum-signed-discovery/) | `discovery` (field 17). | | [`model::DistributionMode`](/docs/reference/rust/zaun-community-protocol/enum-model-distributionmode/) | How accepted channel-stream events travel (ADR-0009, the protocol, Appendix A). | | [`encoding::EncodeError`](/docs/reference/rust/zaun-community-protocol/enum-encoding-encodeerror/) | A value cannot be encoded canonically: it would not decode. | | [`framing::EncodeError`](/docs/reference/rust/zaun-community-protocol/enum-framing-encodeerror/) | Why an envelope cannot be framed. | | [`event::EphemeralOp`](/docs/reference/rust/zaun-community-protocol/enum-event-ephemeralop/) | `op` of `interaction.message`. | | [`error_code::ErrorCode`](/docs/reference/rust/zaun-community-protocol/enum-error_code-errorcode/) | A response error code. Clients branch on this, never on the message text. | | [`event::Event`](/docs/reference/rust/zaun-community-protocol/enum-event-event/) | A decoded event body: one variant per event of the the protocol catalogue. | | [`envelope::EventError`](/docs/reference/rust/zaun-community-protocol/enum-envelope-eventerror/) | An event envelope that breaks the rules of the protocol | | [`client::ExpectedHost`](/docs/reference/rust/zaun-community-protocol/enum-client-expectedhost/) | The host the client expects to reach. The welcome's host key must match. | | [`event::FailReason`](/docs/reference/rust/zaun-community-protocol/enum-event-failreason/) | Why an interaction failed. | | [`permissions::GateDenial`](/docs/reference/rust/zaun-community-protocol/enum-permissions-gatedenial/) | Why the gate refused a command. | | [`model::HistoryAccess`](/docs/reference/rust/zaun-community-protocol/enum-model-historyaccess/) | How much channel history a member may read (ADR-0014, the protocol). Stamped on each message at send time. | | [`command::object::IcePolicy`](/docs/reference/rust/zaun-community-protocol/enum-command-object-icepolicy/) | Which ICE candidates clients may use. | | [`envelope::IdempotencyKey`](/docs/reference/rust/zaun-community-protocol/enum-envelope-idempotencykey/) | The key an idempotency record is stored under. `C` is the host's opaque connection id, used only for unbound connections. | | [`framing::Inbound`](/docs/reference/rust/zaun-community-protocol/enum-framing-inbound/) | What an inbound transport text is. | | [`command::object::InteractionData`](/docs/reference/rust/zaun-community-protocol/enum-command-object-interactiondata/) | `data` of an interaction, by type. | | [`command::object::InteractionType`](/docs/reference/rust/zaun-community-protocol/enum-command-object-interactiontype/) | `type` of an interaction (Discord's numbers; `PING` is not used). | | [`permissions::Invalid`](/docs/reference/rust/zaun-community-protocol/enum-permissions-invalid/) | A malformed request (`BAD_REQUEST`). | | [`permissions::invites::InviteCreation`](/docs/reference/rust/zaun-community-protocol/enum-permissions-invites-invitecreation/) | The admission policy's `invite_creation` rule. | | [`command::object::InviteCreation`](/docs/reference/rust/zaun-community-protocol/enum-command-object-invitecreation/) | `invite_creation`. | | [`keys::KeyEncodingError`](/docs/reference/rust/zaun-community-protocol/enum-keys-keyencodingerror/) | The encoding is not a known suite or has the wrong length. | | [`client::member::LinkError`](/docs/reference/rust/zaun-community-protocol/enum-client-member-linkerror/) | A link that is not a valid invitation. Carries no part of the input. | | [`command::object::LockdownView`](/docs/reference/rust/zaun-community-protocol/enum-command-object-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_SAF | | [`model::MembershipState`](/docs/reference/rust/zaun-community-protocol/enum-model-membershipstate/) | A member's lifecycle state. Independent of roles. | | [`command::signal::NoResponse`](/docs/reference/rust/zaun-community-protocol/enum-command-signal-noresponse/) | A signal has no response. Uninhabited. | | [`command::object::OptionType`](/docs/reference/rust/zaun-community-protocol/enum-command-object-optiontype/) | `type` of an option (Discord's numbers 1–11). | | [`command::object::OptionValueKind`](/docs/reference/rust/zaun-community-protocol/enum-command-object-optionvaluekind/) | An option value as the invoker gave it: a string, number, boolean or id. | | [`command::object::Outcome`](/docs/reference/rust/zaun-community-protocol/enum-command-object-outcome/) | `outcome`. | | [`envelope::Outcome`](/docs/reference/rust/zaun-community-protocol/enum-envelope-outcome/) | The result carried by a response. | | [`permissions::overrides::OverrideSubject`](/docs/reference/rust/zaun-community-protocol/enum-permissions-overrides-overridesubject/) | The target of an override as the hierarchy sees it. | | [`permissions::OverrideTarget`](/docs/reference/rust/zaun-community-protocol/enum-permissions-overridetarget/) | Whom an override applies to (permissions the protocol). | | [`command::object::OverrideTarget`](/docs/reference/rust/zaun-community-protocol/enum-command-object-overridetarget/) | The subject of an override: `{"t":"role","c":RoleId}` or `{"t":"member","c":MemberId}`. | | [`permissions::overrides::OverrideWrite`](/docs/reference/rust/zaun-community-protocol/enum-permissions-overrides-overridewrite/) | What the host does with a validated override. | | [`signed::PackageError`](/docs/reference/rust/zaun-community-protocol/enum-signed-packageerror/) | A `.zbot` file that does not verify. | | [`event::Parsed`](/docs/reference/rust/zaun-community-protocol/enum-event-parsed/) | The result of decoding an event: known, or an unknown `type` that the client ignores while still advancing the stream's cursor by its `sequence`. Events in reserved namespaces are | | [`json::Patch`](/docs/reference/rust/zaun-community-protocol/enum-json-patch/) | A field that distinguishes "absent" from "null" in update commands (`channel.update` with `"topic": null` clears the topic; no `topic` leaves it). | | [`command::object::PolicyLevel`](/docs/reference/rust/zaun-community-protocol/enum-command-object-policylevel/) | `level`. | | [`command::object::PolicyView`](/docs/reference/rust/zaun-community-protocol/enum-command-object-policyview/) | The full policy or the public summary, by the viewer's permissions (`admission.policy.updated` body, the protocol). The full form is tried first. | | [`command::signal::PresenceStatus`](/docs/reference/rust/zaun-community-protocol/enum-command-signal-presencestatus/) | Presence status, in the the protocol tagged form. A client sends `online`, `idle`, `dnd` or `invisible` (`offline` from a client means `invisible`); others only ever see `online`, | | [`client::ProtocolError`](/docs/reference/rust/zaun-community-protocol/enum-client-protocolerror/) | Input ignored safely. | | [`signed::Purpose`](/docs/reference/rust/zaun-community-protocol/enum-signed-purpose/) | Why a member key is registered (field 2). Other values are reserved and rejected. | | [`framing::Pushed`](/docs/reference/rust/zaun-community-protocol/enum-framing-pushed/) | The result of pushing one fragment. | | [`envelope::RateCategory`](/docs/reference/rust/zaun-community-protocol/enum-envelope-ratecategory/) | `RATE_LIMITED` category. | | [`envelope::RateScope`](/docs/reference/rust/zaun-community-protocol/enum-envelope-ratescope/) | `RATE_LIMITED` scope. | | [`envelope::Reason`](/docs/reference/rust/zaun-community-protocol/enum-envelope-reason/) | `FORBIDDEN` and `CONFLICT` reasons. | | [`permissions::Refusal`](/docs/reference/rust/zaun-community-protocol/enum-permissions-refusal/) | Every way a pure check can refuse a command. | | [`signed::RegistrationError`](/docs/reference/rust/zaun-community-protocol/enum-signed-registrationerror/) | A `MemberKeyRegistration` is not acceptable to the host. | | [`event::RemovalReason`](/docs/reference/rust/zaun-community-protocol/enum-event-removalreason/) | `reason: {t: "kicked" \| "banned" \| "left" \| "rejected" \| "expired"}`. | | [`envelope::Replay`](/docs/reference/rust/zaun-community-protocol/enum-envelope-replay/) | What to do with a command whose key matches a stored record. | | [`command::object::ReportCategory`](/docs/reference/rust/zaun-community-protocol/enum-command-object-reportcategory/) | `category`. | | [`command::object::ReportStatus`](/docs/reference/rust/zaun-community-protocol/enum-command-object-reportstatus/) | `status`: a plain string, exactly `"open"\|"reviewing"\|"resolved"`. | | [`command::object::ReportTarget`](/docs/reference/rust/zaun-community-protocol/enum-command-object-reporttarget/) | `target: {t: "member"\|"message", c}`. | | [`command::interaction::ResponseData`](/docs/reference/rust/zaun-community-protocol/enum-command-interaction-responsedata/) | Response data, by type. | | [`command::interaction::ResponseType`](/docs/reference/rust/zaun-community-protocol/enum-command-interaction-responsetype/) | Interaction response types (Discord's callback numbers). | | [`command::object::Restriction`](/docs/reference/rust/zaun-community-protocol/enum-command-object-restriction/) | One lockdown restriction. | | [`signed::RotationError`](/docs/reference/rust/zaun-community-protocol/enum-signed-rotationerror/) | The rotation chain does not verify. `index` is 1-based. | | [`permissions::Scope`](/docs/reference/rust/zaun-community-protocol/enum-permissions-scope/) | Where the required bits are evaluated. | | [`signed::SessionProofError`](/docs/reference/rust/zaun-community-protocol/enum-signed-sessionprooferror/) | A `HostSessionProof` is not acceptable to the client. | | [`client::SessionState`](/docs/reference/rust/zaun-community-protocol/enum-client-sessionstate/) | Where the session is in its lifecycle. | | [`signed::SignedError`](/docs/reference/rust/zaun-community-protocol/enum-signed-signederror/) | Signing, verifying, encoding or decoding one signed object failed. | | [`crypto::SignError`](/docs/reference/rust/zaun-community-protocol/enum-crypto-signerror/) | Signing failed. | | [`command::sync::SnapshotItem`](/docs/reference/rust/zaun-community-protocol/enum-command-sync-snapshotitem/) | One snapshot item; the variant follows the requested part. | | [`command::sync::SnapshotPart`](/docs/reference/rust/zaun-community-protocol/enum-command-sync-snapshotpart/) | `part`. SPEC: a plain string, as in the the protocol request. | | [`command::object::Stream`](/docs/reference/rust/zaun-community-protocol/enum-command-object-stream/) | An event stream. SPEC: a plain string, as in the the protocol `stream` field and the the protocol example (`"stream": "channel"`), not `{t}`. | | [`envelope::Stream`](/docs/reference/rust/zaun-community-protocol/enum-envelope-stream/) | An event stream; also the `stream` of `RESYNC_REQUIRED`. | | [`keys::Suite`](/docs/reference/rust/zaun-community-protocol/enum-keys-suite/) | A signature suite. `0x00` and `0x02`–`0xFF` are rejected. | | [`command::object::TextInputStyle`](/docs/reference/rust/zaun-community-protocol/enum-command-object-textinputstyle/) | Text input `style`: 1 short, 2 paragraph. | | [`permissions::Top`](/docs/reference/rust/zaun-community-protocol/enum-permissions-top/) | A member's top position. The owner is above every role. | | [`command::TypeClass`](/docs/reference/rust/zaun-community-protocol/enum-command-typeclass/) | What a command `type` string is to a v1 host. | | [`model::TypingMode`](/docs/reference/rust/zaun-community-protocol/enum-model-typingmode/) | Who sees that someone is typing in a channel (`typing`, the protocol). A plain JSON string, as the specification writes it. | | [`command::object::UploadFailure`](/docs/reference/rust/zaun-community-protocol/enum-command-object-uploadfailure/) | `failure` of an upload: why the host does not hold it. | | [`signed::ValidityError`](/docs/reference/rust/zaun-community-protocol/enum-signed-validityerror/) | A (descriptor, delegation) pair is not valid. | | [`signed::VerificationLevel`](/docs/reference/rust/zaun-community-protocol/enum-signed-verificationlevel/) | `AdmissionSummary.level`: verification level None … Highest (`governance.md`). | | [`crypto::VerifyError`](/docs/reference/rust/zaun-community-protocol/enum-crypto-verifyerror/) | Verification failed. Callers map every variant to `INVALID_SIGNATURE`; the variants exist for tests and diagnostics only. | | [`event::VisibilityReason`](/docs/reference/rust/zaun-community-protocol/enum-event-visibilityreason/) | A visibility change. SPEC: a plain string (`"access_gained"`), as written. | | [`crypto::voice::VoiceError`](/docs/reference/rust/zaun-community-protocol/enum-crypto-voice-voiceerror/) | A voice key or frame operation failed. | | [`event::VoiceLeftReason`](/docs/reference/rust/zaun-community-protocol/enum-event-voiceleftreason/) | Why a participant left a voice channel. | | [`client::WelcomeError`](/docs/reference/rust/zaun-community-protocol/enum-client-welcomeerror/) | Why a `session.welcome` was rejected. | ## Functions | Item | Summary | |---|---| | [`permissions::act_on`](/docs/reference/rust/zaun-community-protocol/function-permissions-act_on/) | H1 then H2, with H2 skipped when the actor targets themself and `self_ok` is set. | | [`permissions::safety::admission_policy_update`](/docs/reference/rust/zaun-community-protocol/function-permissions-safety-admission_policy_update/) | `admission.policy.update` of `newcomer_restrictions`: valid, and H3 on the bits added or removed (`old XOR new ⊆ cp`; only the owner exempt, see `h3_owner_only`). | | [`permissions::overrides::adopt_parent`](/docs/reference/rust/zaun-community-protocol/function-permissions-overrides-adopt_parent/) | Setting `sync_with_parent = true`: checked as an override edit from the channel's own overrides to the parent's, for every target in either. `subject` maps a target to its hierarch | | [`permissions::all_in`](/docs/reference/rust/zaun-community-protocol/function-permissions-all_in/) | The grants of an owner or administrator in a channel. | | [`command::object::bot_events::allowed`](/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-allowed/) | Whether the capabilities allow events of `kind`: member events need `members`, presence needs `presence`, DM events need `dms`; everything else is visible to any member anyway. | | [`permissions::applicable`](/docs/reference/rust/zaun-community-protocol/function-permissions-applicable/) | The channel bits that apply to a channel kind. | | [`permissions::members::approve`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-approve/) | `membership.approve`. A `Pending` target has no roles, so no H2; but the approver must be able to assign every default role applied at approval. Ending a `Probation` early needs H1 | | [`permissions::base`](/docs/reference/rust/zaun-community-protocol/function-permissions-base/) | `base(m)` for a non-owner (steps 1–2): `@everyone` OR the member's roles; `ALL` with `ADMINISTRATOR`; otherwise masked by `KNOWN`. | | [`permissions::roles::can_assign`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-can_assign/) | Whether `actor` could assign `role` right now: the check behind invitation default roles and approval (permissions the protocol, the protocol). `cp` must hold `MANAGE_ROLES` unless | | [`permissions::roles::can_grant`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-can_grant/) | Hierarchy over a role being granted, without `MANAGE_ROLES`: not `@everyone`, H4, and its known bits held (H3). Used by `membership.approve`. | | [`command::attachment::caption`](/docs/reference/rust/zaun-community-protocol/function-command-attachment-caption/) | The caption of the SimpleX file that carries attachment `id`, either way. | | [`permissions::channel_grants`](/docs/reference/rust/zaun-community-protocol/function-permissions-channel_grants/) | `grants(m, ch)` (steps 3–6) for a non-administrator whose base is `base`. | | [`command::object::check_commands`](/docs/reference/rust/zaun-community-protocol/function-command-object-check_commands/) | Every command's rules, the per-type counts and unique names; at most 8 000 scalars of text per command. | | [`command::object::check_embeds`](/docs/reference/rust/zaun-community-protocol/function-command-object-check_embeds/) | The state-free rules of a message's embeds: at most 10, each valid and showing something, at most 6 000 scalars of text in all. With `attachments`, every picture an embed shows mus | | [`command::object::check_message_components`](/docs/reference/rust/zaun-community-protocol/function-command-object-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 `id`s and `custom_id`s. | | [`command::object::check_modal`](/docs/reference/rust/zaun-community-protocol/function-command-object-check_modal/) | A modal (`MODAL` response): `custom_id`, `title` 1–45 and 1–5 labels or text displays. | | [`command::object::check_pictures`](/docs/reference/rust/zaun-community-protocol/function-command-object-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 | | [`envelope::check_version`](/docs/reference/rust/zaun-community-protocol/function-envelope-check_version/) | Checks an inbound envelope's `v` against the connection's negotiated version. | | [`command::bot::chosen`](/docs/reference/rust/zaun-community-protocol/function-command-bot-chosen/) | Full grants from a choice and the manifest's request. | | [`signed::claimed_genesis`](/docs/reference/rust/zaun-community-protocol/function-signed-claimed_genesis/) | The **claimed** genesis key: the first rotation's `old_root`, or the descriptor's `root_public_key` when the chain is empty. | | [`command::classify`](/docs/reference/rust/zaun-community-protocol/function-command-classify/) | Classifies a command `type`. Exact, case-sensitive matching. | | [`framing::classify`](/docs/reference/rust/zaun-community-protocol/function-framing-classify/) | Classifies one inbound text message. The `zaun:1f:` prefix is tested before `zaun:1:` (they differ at the 7th byte, so the order is only for clarity). | | [`envelope::command_limit`](/docs/reference/rust/zaun-community-protocol/function-envelope-command_limit/) | The size limit of a command envelope of type `kind`: `MAX_COMMAND`, except `community.create` and `community.descriptor.publish`, which may use the whole `max_frame`. | | [`permissions::commands`](/docs/reference/rust/zaun-community-protocol/function-permissions-commands/) | Every command name of the table. | | [`permissions::community_dependencies`](/docs/reference/rust/zaun-community-protocol/function-permissions-community_dependencies/) | Implicit dependencies at community level: no attachment, embed or mass mention without `SEND_MESSAGES`, no voice bit without `CONNECT`. There is no `VIEW_CHANNEL` gate here: whethe | | [`crypto::community_id`](/docs/reference/rust/zaun-community-protocol/function-crypto-community_id/) | `CommunityId = SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root key)`, over the 1 985-byte encoding including the suite byte. Always the **genesis** key. | | [`signed::compare_versions`](/docs/reference/rust/zaun-community-protocol/function-signed-compare_versions/) | Semantic Versioning precedence of two versions; `None` when either is invalid. An update must be `Ordering::Greater` than the installed version. | | [`command::object::component_attachments`](/docs/reference/rust/zaun-community-protocol/function-command-object-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. | | [`command::object::config_key_ok`](/docs/reference/rust/zaun-community-protocol/function-command-object-config_key_ok/) | A `config` key: `a-za-z0-9_{0,63}`. | | [`crypto::content_hash`](/docs/reference/rust/zaun-community-protocol/function-crypto-content_hash/) | `SHA3-256(bytes)`: how signed objects are identified, deduplicated and chained (never by signature bytes, the protocol), for example a `delegation_hash`. | | [`client::owner::create_body`](/docs/reference/rust/zaun-community-protocol/function-client-owner-create_body/) | The `community.create` body: the genesis pair, the owner's member key and its registration (purpose 1) for the host's current `host_challenge` (from the welcome). | | [`framing::app_data::data`](/docs/reference/rust/zaun-community-protocol/function-framing-app_data-data/) | The application data that carries the frame message `frame`. | | [`b64::decode`](/docs/reference/rust/zaun-community-protocol/function-b64-decode/) | Decodes canonical base64url without padding. | | [`b64::decode_array`](/docs/reference/rust/zaun-community-protocol/function-b64-decode_array/) | Decodes exactly `N` bytes. | | [`client::decode_response`](/docs/reference/rust/zaun-community-protocol/function-client-decode_response/) | Decodes a successful response body as the response type of command `B`. | | [`client::owner::delegate`](/docs/reference/rust/zaun-community-protocol/function-client-owner-delegate/) | Signs a delegation of every v1 scope to `host`, valid from `now_ms`. | | [`permissions::dependencies`](/docs/reference/rust/zaun-community-protocol/function-permissions-dependencies/) | Implicit dependencies (step 6) at channel level: no channel bit without `VIEW_CHANNEL`, then `community_dependencies`. | | [`crypto::voice::derive_key_salt`](/docs/reference/rust/zaun-community-protocol/function-crypto-voice-derive_key_salt/) | RFC 9605 the protocol `derive_key_salt` for suite `0x0005`. | | [`b64::bytes::deserialize`](/docs/reference/rust/zaun-community-protocol/function-b64-bytes-deserialize/) | Deserializes strict base64url. | | [`json::u64_decimal::deserialize`](/docs/reference/rust/zaun-community-protocol/function-json-u64_decimal-deserialize/) | Deserializes a canonical decimal string. | | [`b64::encode`](/docs/reference/rust/zaun-community-protocol/function-b64-encode/) | Encodes `bytes` as base64url without padding. | | [`framing::encode`](/docs/reference/rust/zaun-community-protocol/function-framing-encode/) | Frames the compact envelope JSON `json`. | | [`b64::encoded_len`](/docs/reference/rust/zaun-community-protocol/function-b64-encoded_len/) | The length of the unpadded encoding of `n` bytes. | | [`framing::escaped_len`](/docs/reference/rust/zaun-community-protocol/function-framing-escaped_len/) | The bytes `text` takes written inside a JSON string, as a frame message travels in its application data: `"` and `\` take two, the control characters JSON writes as `\b`, `\t`, `\n | | [`ids::fill_random`](/docs/reference/rust/zaun-community-protocol/function-ids-fill_random/) | Fills `buf` from the operating system CSPRNG. | | [`command::object::find_interactive`](/docs/reference/rust/zaun-community-protocol/function-command-object-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. | | [`framing::app_data::frame`](/docs/reference/rust/zaun-community-protocol/function-framing-app_data-frame/) | The frame message text in application data of content type `tag`, or `None` when it is not a Zaun frame. Keys other than `FRAME_KEY` are ignored, for later additions. | | [`encoding::from_bytes`](/docs/reference/rust/zaun-community-protocol/function-encoding-from_bytes/) | Decodes a top-level value, rejecting trailing bytes. | | [`permissions::gate`](/docs/reference/rust/zaun-community-protocol/function-permissions-gate/) | The gate for a connection bound to a member in `state`. `Probation` and `Active` pass every bound command, which is then subject to its permissions. | | [`permissions::gate_unbound`](/docs/reference/rust/zaun-community-protocol/function-permissions-gate_unbound/) | The gate for an unbound connection. | | [`client::member::generate_member_key`](/docs/reference/rust/zaun-community-protocol/function-client-member-generate_member_key/) | Generates a fresh member key. Use one per community. | | [`client::owner::generate_root_key`](/docs/reference/rust/zaun-community-protocol/function-client-owner-generate_root_key/) | Generates a fresh root key: the community's identity. Store it sealed; it cannot be recovered (ADR-0011). | | [`client::owner::genesis`](/docs/reference/rust/zaun-community-protocol/function-client-owner-genesis/) | Builds and signs the genesis pair: delegation epoch 1 to `host` (no expiry, ADR-0005), descriptor revision 1 naming it, with `owner_member_key` as the owner binding. | | [`command::object::bot_events::group_of`](/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-group_of/) | The group an event type belongs to, if any. | | [`permissions::h1`](/docs/reference/rust/zaun-community-protocol/function-permissions-h1/) | H1: nobody acts on the owner, except the owner on themself. | | [`permissions::h2`](/docs/reference/rust/zaun-community-protocol/function-permissions-h2/) | H2: acting on another member requires `top(T) < top(A)`; equal positions block and `ADMINISTRATOR` does not lift it. The owner passes. | | [`permissions::h3`](/docs/reference/rust/zaun-community-protocol/function-permissions-h3/) | H3: every changed bit must be held (`changed ⊆ held`, `held` being `cp` or `chp`). | | [`permissions::h3_owner_only`](/docs/reference/rust/zaun-community-protocol/function-permissions-h3_owner_only/) | H3 where only the owner is exempt: restriction masks (`newcomer_restrictions`, a lockdown's mask), for which permissions.md the protocol says "owner exempt" and the specification i | | [`permissions::h4`](/docs/reference/rust/zaun-community-protocol/function-permissions-h4/) | H4: a role is manageable only strictly below the actor's top; the owner is exempt. | | [`crypto::host_id`](/docs/reference/rust/zaun-community-protocol/function-crypto-host_id/) | `HostId = SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key)`. | | [`command::object::host_pattern_ok`](/docs/reference/rust/zaun-community-protocol/function-command-object-host_pattern_ok/) | A DNS name, optionally with one leading `*.` label: letters, digits and `-`, at least two labels, ≤ 253 bytes, lower case. | | [`permissions::invites::invite_create`](/docs/reference/rust/zaun-community-protocol/function-permissions-invites-invite_create/) | `invite.create` beyond `CREATE_INVITE` itself (checked by the table in the right scope): the `invite_creation` rule, default roles the actor could assign, stricter-only admission o | | [`envelope::is_mutating`](/docs/reference/rust/zaun-community-protocol/function-envelope-is_mutating/) | Whether a command `type` is mutating, hence idempotent and recorded: every command except `session.hello`, `*.get`, `*.list`, `message.history`, `audit.list`, `member.bans`, `membe | | [`envelope::is_recorded`](/docs/reference/rust/zaun-community-protocol/function-envelope-is_recorded/) | Whether `response` is stored in the idempotency record; see `ResponseEnvelope::is_recorded`. | | [`json::is_zero_u32`](/docs/reference/rust/zaun-community-protocol/function-json-is_zero_u32/) | `skip_serializing_if` for a `u32` that is absent when 0 (message `flags`, the protocol). | | [`permissions::members::kick_or_ban`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-kick_or_ban/) | `member.kick` and `member.ban`: not self (use `community.leave`); H1; H2. | | [`crypto::voice::kid_for`](/docs/reference/rust/zaun-community-protocol/function-crypto-voice-kid_for/) | The KID of a sender's epoch: the first 3 bytes of `SHA3-256("zaun/v1/voice-kid" ‖ session)` above the 32-bit epoch. | | [`command::object::bot_events::known`](/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-known/) | Whether `name` is something a manifest's `events` may list. | | [`command::object::local_address_ok`](/docs/reference/rust/zaun-community-protocol/function-command-object-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. | | [`permissions::safety::lockdown_disable`](/docs/reference/rust/zaun-community-protocol/function-permissions-safety-lockdown_disable/) | `moderation.lockdown.disable`: `top(A) ≥` the enabling actor's recorded top (owner exempt), so a lower moderator cannot lift a higher one's lockdown, and H3 on the bits the lockdow | | [`permissions::safety::lockdown_enable`](/docs/reference/rust/zaun-community-protocol/function-permissions-safety-lockdown_enable/) | `moderation.lockdown.enable` (also renewal and replacement): duration within 60 s – 7 days and H3 on the new lockdown's mask (only the owner exempt). Enabling while one is active r | | [`command::max_envelope`](/docs/reference/rust/zaun-community-protocol/function-command-max_envelope/) | The largest command envelope for `type_` in bytes: `max_frame` for `community.create` and `community.descriptor.publish`, else 65 536. | | [`permissions::roles::member_role_change`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-member_role_change/) | `member.roles.update` for one role `role` on `target`: H1; H2 unless self; H4 on the role; when assigning, `role.permissions ⊆ cp` (H3). `@everyone` is never listed. | | [`command::object::message_json_len`](/docs/reference/rust/zaun-community-protocol/function-command-object-message_json_len/) | The bytes of a message's `content` and `embeds` as JSON, counted against `MESSAGE_JSON_MAX`. | | [`command::object::message_json_len_with`](/docs/reference/rust/zaun-community-protocol/function-command-object-message_json_len_with/) | `message_json_len` plus the message's components, which count against the same `MESSAGE_JSON_MAX`. | | [`crypto::message_prime`](/docs/reference/rust/zaun-community-protocol/function-crypto-message_prime/) | `M' = Prefix ‖ Label ‖ len(ctx) u8 ‖ ctx ‖ SHA-512(M)`, or `None` when `ctx` exceeds 255 bytes. | | [`command::object::modal_inputs`](/docs/reference/rust/zaun-community-protocol/function-command-object-modal_inputs/) | The input components of a modal (everything inside its labels), in order. | | [`permissions::members::moderate_content`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-moderate_content/) | Deleting another member's message or removing their reaction: H1 only, no H2. | | [`client::member::moved`](/docs/reference/rust/zaun-community-protocol/function-client-member-moved/) | Checks a `community.descriptor_updated` event against the client's stored state and says whether the community moved to another host. `chain` is the rotation chain the client holds | | [`envelope::negotiate`](/docs/reference/rust/zaun-community-protocol/function-envelope-negotiate/) | Chooses the highest version in both ranges (`session.hello`, the protocol). | | [`client::owner::next_revision`](/docs/reference/rust/zaun-community-protocol/function-client-owner-next_revision/) | A copy of `current` with the next revision and `issued_at = now_ms`, for the owner to edit and pass to `publish_body`. | | [`permissions::members::nickname`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-nickname/) | `member.update` of a nickname: one's own needs only `CHANGE_NICKNAME` (table); another's needs H1 and H2. | | [`permissions::no_new_unknown`](/docs/reference/rust/zaun-community-protocol/function-permissions-no_new_unknown/) | the protocol: a command may not set an unknown bit that `old` did not already hold. | | [`permissions::overrides::override_edit`](/docs/reference/rust/zaun-community-protocol/function-permissions-overrides-override_edit/) | One override edit in `channel.permissions.update` (or `channel.create` with initial overrides). `chp` is the actor's effective permissions in that channel; `old`/`new` are `(allow, | | [`json::u64_decimal::parse`](/docs/reference/rust/zaun-community-protocol/function-json-u64_decimal-parse/) | Parses a canonical decimal. | | [`command::attachment::parse_caption`](/docs/reference/rust/zaun-community-protocol/function-command-attachment-parse_caption/) | The attachment a caption names, when it is a Zaun caption. | | [`envelope::parse_command`](/docs/reference/rust/zaun-community-protocol/function-envelope-parse_command/) | Parses a whole or reassembled command envelope `text`. | | [`signed::parse_package`](/docs/reference/rust/zaun-community-protocol/function-signed-parse_package/) | Splits a `.zbot` file into its parts, checking every limit and that nothing trails. | | [`client::owner::publish_body`](/docs/reference/rust/zaun-community-protocol/function-client-owner-publish_body/) | Signs `descriptor` with `root` (its current root key) and builds the `community.descriptor.publish` body. A given `delegation` is referenced by the descriptor (epoch and hash) and | | [`crypto::publisher_id`](/docs/reference/rust/zaun-community-protocol/function-crypto-publisher_id/) | `PublisherId = SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher key)`. | | [`client::member::reauth_body`](/docs/reference/rust/zaun-community-protocol/function-client-member-reauth_body/) | The `migration.reauth` body: a `MemberReauth` signed with the member's existing key. Send it with `target.community_id` as the envelope `community_id`. | | [`client::member::redeem_body`](/docs/reference/rust/zaun-community-protocol/function-client-member-redeem_body/) | The `invite.redeem` body: the link's secret, the member key and its registration (purpose 2) for the link's community and host. Send it with the link's community as the envelope `c | | [`permissions::invites::redeemable_roles`](/docs/reference/rust/zaun-community-protocol/function-permissions-invites-redeemable_roles/) | At redemption, the default roles the issuer could still assign now; the rest are dropped, never granted (permissions the protocol, the protocol). A deleted role is simply absent fr | | [`client::member::registration`](/docs/reference/rust/zaun-community-protocol/function-client-member-registration/) | Signs a `MemberKeyRegistration` with the member key itself. | | [`permissions::members::reject`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-reject/) | `membership.reject`: the target is `Pending`. | | [`envelope::replay`](/docs/reference/rust/zaun-community-protocol/function-envelope-replay/) | Compares a retried command with the stored record for its key. | | [`client::member::request_body`](/docs/reference/rust/zaun-community-protocol/function-client-member-request_body/) | The `membership.request` body with a purpose-3 registration. Send it with `target.community_id` as the envelope `community_id`. | | [`permissions::required`](/docs/reference/rust/zaun-community-protocol/function-permissions-required/) | The requirement of a command by wire name; `None` for a name the table does not know (the engine answers `UNSUPPORTED_COMMAND`). | | [`client::owner::resign_delegation`](/docs/reference/rust/zaun-community-protocol/function-client-owner-resign_delegation/) | Re-signs an existing delegation under a new root key. The bytes, hence the `delegation_hash` and epoch, are unchanged. | | [`permissions::members::restore`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-restore/) | `membership.restore`: not self; H1; H2; the target is `Suspended`. | | [`permissions::roles::role_create`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_create/) | `role.create`: H3 on the new role's bits. Returns the new role's position; the engine shifts every role at or above it up by one. | | [`permissions::roles::role_delete`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_delete/) | `role.delete`: not `@everyone`; H4. | | [`permissions::roles::role_reorder`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_reorder/) | `role.reorder`: `roles` is the community's role table, `moves` the request's `(role_id, new_position)` pairs. Every role whose position changes must be below the actor before and a | | [`permissions::roles::role_update`](/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_update/) | `role.update`: H4 on the role, H3 on `old XOR new`. `@everyone` may change only its permissions (`other_fields` is true when the body changes anything else). | | [`client::owner::rotate_root`](/docs/reference/rust/zaun-community-protocol/function-client-owner-rotate_root/) | Signs the rotation from the current root `old` to `new`: `rotation_seq` follows the descriptor's latest rotation, and both keys sign. | | [`client::owner::rotated_revision`](/docs/reference/rust/zaun-community-protocol/function-client-owner-rotated_revision/) | The next revision after `rotation`: the new root key and `rotations = rotation`. Sign it with the **new** key via `publish_body`, together with resign_delegation: the delegation is | | [`b64::bytes::serialize`](/docs/reference/rust/zaun-community-protocol/function-b64-bytes-serialize/) | Serializes as base64url. | | [`json::u64_decimal::serialize`](/docs/reference/rust/zaun-community-protocol/function-json-u64_decimal-serialize/) | Serializes as a decimal string. | | [`crypto::sign`](/docs/reference/rust/zaun-community-protocol/function-crypto-sign/) | Signs `message` (the canonical bytes `B`) with context `ctx`, hedged: ML-DSA draws 32 fresh bytes from the OS CSPRNG (FIPS 204 Algorithm 2 with the context prefix built here). | | [`crypto::sign_deterministic`](/docs/reference/rust/zaun-community-protocol/function-crypto-sign_deterministic/) | Deterministic signing (FIPS 204 deterministic variant). **Golden test vectors only**; real signatures use `sign`. | | [`permissions::members::suspend`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-suspend/) | `membership.suspend`: not self; H1; H2; the target is `Probation` or `Active`. | | [`limits::text_within`](/docs/reference/rust/zaun-community-protocol/function-limits-text_within/) | Whether `text` has between `min` and `max` Unicode scalar values and at most 4× `max` bytes. | | [`permissions::members::timeout`](/docs/reference/rust/zaun-community-protocol/function-permissions-members-timeout/) | `member.timeout` (set or clear): H1; H2; never the owner; never a target holding `ADMINISTRATOR`; `until ≤ now + 28 days`. | | [`encoding::to_bytes`](/docs/reference/rust/zaun-community-protocol/function-encoding-to_bytes/) | Encodes a top-level value. | | [`signed::valid_app_id`](/docs/reference/rust/zaun-community-protocol/function-signed-valid_app_id/) | Lowercase reverse-DNS: `a-z0-9-+(\.a-z0-9-+)+`, 3–64 bytes. | | [`signed::valid_version`](/docs/reference/rust/zaun-community-protocol/function-signed-valid_version/) | Semantic Versioning 2.0.0 without build metadata, ≤ 64 bytes. | | [`signed::valid_world`](/docs/reference/rust/zaun-community-protocol/function-signed-valid_world/) | `zaun:bot/bot@`, ≤ 64 bytes. | | [`signed::validate_descriptor`](/docs/reference/rust/zaun-community-protocol/function-signed-validate_descriptor/) | Rule 1 and the descriptor parts of rule 5: `chain` is the full rotation chain from the genesis key (`community.rotations`), `accepted` the verifier's stored state, if any. | | [`permissions::safety::validate_newcomer_restrictions`](/docs/reference/rust/zaun-community-protocol/function-permissions-safety-validate_newcomer_restrictions/) | Validates a new `newcomer_restrictions` mask: no `VIEW_CHANNEL` or `READ_MESSAGE_HISTORY`, no newly set unknown bit. | | [`permissions::overrides::validate_override`](/docs/reference/rust/zaun-community-protocol/function-permissions-overrides-validate_override/) | Validates a new override value against the stored one (`old`, if any): `allow & deny == 0`; no known bit outside `CHANNEL_SCOPED`; no unknown bit that `old` did not already hold. U | | [`signed::validate_pair`](/docs/reference/rust/zaun-community-protocol/function-signed-validate_pair/) | Whether a (descriptor, delegation) pair is valid at `now_ms`. `chain` is the full rotation chain from the genesis key; `accepted` is the verifier's stored state for the community, | | [`crypto::verify`](/docs/reference/rust/zaun-community-protocol/function-crypto-verify/) | Verifies `sig` over `message` with context `ctx` against `pk`. | | [`signed::verify_chain`](/docs/reference/rust/zaun-community-protocol/function-signed-verify_chain/) | Verifies a rotation chain from the genesis key: `genesis` must derive `community_id`; for rotation `i` (1-based, list order) `sig_old` verifies under `Kᵢ₋₁` **before** decoding, th | | [`signed::verify_package`](/docs/reference/rust/zaun-community-protocol/function-signed-verify_package/) | Verifies the signature under the header's publisher key (`min_suite` 1) before anything else, then both hashes and the manifest's `app_id` and `version`. An all-zero signature is a | | [`crypto::verify_raw`](/docs/reference/rust/zaun-community-protocol/function-crypto-verify_raw/) | RFC 10073 `id-MLDSA65-Ed25519-SHA512` verification over raw components (no suite byte): `pk = mldsaPK ‖ edPK` (1 984 B), `sig = mldsaSig ‖ edSig` (3 373 B), any `ctx` ≤ 255 B. Both | | [`command::object::bot_events::wants`](/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-wants/) | Whether a bot subscribed to `events` (and holding `caps`) gets events of `kind`. | | [`permissions::with_dependants`](/docs/reference/rust/zaun-community-protocol/function-permissions-with_dependants/) | Every bit that `dependencies` would also drop once `mask` is removed: used to attribute a lost dependant to the restriction that removed its prerequisite. | | [`signed::write_package`](/docs/reference/rust/zaun-community-protocol/function-signed-write_package/) | Writes a `.zbot` file from a signed header and its parts. The caller computed the header's hashes from these exact `manifest` and `component` bytes. | | [`signed::write_unsigned_package`](/docs/reference/rust/zaun-community-protocol/function-signed-write_unsigned_package/) | Writes an unsigned development `.zbot` file (all-zero signature, the protocol). | ## Structs | Item | Summary | |---|---| | [`signed::AcceptedState`](/docs/reference/rust/zaun-community-protocol/struct-signed-acceptedstate/) | What a verifier stores per community for anti-rollback (rule 5). | | [`command::sync::Ack`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-ack/) | `sync.ack`: the highest contiguous sequence applied per stream. Not idempotency-recorded; lower values are ignored by the host. | | [`command::object::ActionRow`](/docs/reference/rust/zaun-community-protocol/struct-command-object-actionrow/) | Type 1. | | [`permissions::ActiveLockdown`](/docs/reference/rust/zaun-community-protocol/struct-permissions-activelockdown/) | The lockdown currently in force, as lockdown management sees it. | | [`command::object::Activity`](/docs/reference/rust/zaun-community-protocol/struct-command-object-activity/) | An activity. | | [`command::object::Admission`](/docs/reference/rust/zaun-community-protocol/struct-command-object-admission/) | How a member was admitted. | | [`command::object::AdmissionOverrides`](/docs/reference/rust/zaun-community-protocol/struct-command-object-admissionoverrides/) | `invite.create.admission_overrides`: stricter-only admission settings. | | [`command::object::AdmissionPolicy`](/docs/reference/rust/zaun-community-protocol/struct-command-object-admissionpolicy/) | The full admission policy. Visible to `MANAGE_SAFETY` holders. | | [`signed::AdmissionSummary`](/docs/reference/rust/zaun-community-protocol/struct-signed-admissionsummary/) | `AdmissionSummary = mode u8 ‖ level u8`: the owner's public claim; the host's policy is authoritative for enforcement. | | [`command::invite::Admitted`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-admitted/) | `invite.redeem` and `membership.request` response. | | [`command::object::ApplicationCommand`](/docs/reference/rust/zaun-community-protocol/struct-command-object-applicationcommand/) | An application command. | | [`command::membership::Approve`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-approve/) | `membership.approve`. | | [`command::object::Attachment`](/docs/reference/rust/zaun-community-protocol/struct-command-object-attachment/) | An attachment record: what a message carries, and what `attachment.download` and `attachment.updated` answer. | | [`ids::AttachmentId`](/docs/reference/rust/zaun-community-protocol/struct-ids-attachmentid/) | An attachment. | | [`command::object::AuditChange`](/docs/reference/rust/zaun-community-protocol/struct-command-object-auditchange/) | `changes: {field, old, new}`. SPEC: value types are never given; raw JSON. | | [`command::object::AuditEntry`](/docs/reference/rust/zaun-community-protocol/struct-command-object-auditentry/) | An audit entry. | | [`ids::AuditId`](/docs/reference/rust/zaun-community-protocol/struct-ids-auditid/) | An audit-log entry. | | [`command::object::AuditTarget`](/docs/reference/rust/zaun-community-protocol/struct-command-object-audittarget/) | `target: {t, c}` of an audit entry. | | [`b64::B64Error`](/docs/reference/rust/zaun-community-protocol/struct-b64-b64error/) | The input is not canonical base64url without padding. | | [`command::object::Ban`](/docs/reference/rust/zaun-community-protocol/struct-command-object-ban/) | One entry of `member.bans`. | | [`ids::BanId`](/docs/reference/rust/zaun-community-protocol/struct-ids-banid/) | A ban record. | | [`command::member::BanMember`](/docs/reference/rust/zaun-community-protocol/struct-command-member-banmember/) | `member.ban`. | | [`command::member::Banned`](/docs/reference/rust/zaun-community-protocol/struct-command-member-banned/) | `member.ban` response. | | [`command::member::BanPage`](/docs/reference/rust/zaun-community-protocol/struct-command-member-banpage/) | `member.bans` response. | | [`command::member::Bans`](/docs/reference/rust/zaun-community-protocol/struct-command-member-bans/) | `member.bans`. | | [`command::object::Binding`](/docs/reference/rust/zaun-community-protocol/struct-command-object-binding/) | `session.welcome.binding`. | | [`envelope::BodyHash`](/docs/reference/rust/zaun-community-protocol/struct-envelope-bodyhash/) | SHA3-256 of a command's `body` JSON text **exactly as received**: reformatting the same JSON gives a different hash, which is why retries must resend byte-identical bodies. | | [`command::object::BotCard`](/docs/reference/rust/zaun-community-protocol/struct-command-object-botcard/) | The public description of an installed bot, visible to every member. | | [`ids::BotId`](/docs/reference/rust/zaun-community-protocol/struct-ids-botid/) | An installed bot. | | [`signed::BotPackage`](/docs/reference/rust/zaun-community-protocol/struct-signed-botpackage/) | The signed header of a bot package, signed by the publisher key inside it. | | [`event::BotRemoved`](/docs/reference/rust/zaun-community-protocol/struct-event-botremoved/) | `bot.removed`: `{bot_id, member_id}`. | | [`command::bot::Bots`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-bots/) | `bot.list` response. | | [`command::object::Button`](/docs/reference/rust/zaun-community-protocol/struct-command-object-button/) | Type 2. | | [`command::object::Capabilities`](/docs/reference/rust/zaun-community-protocol/struct-command-object-capabilities/) | What a bot may do beyond its permission bits. Every field defaults to "no". | | [`signed::ChainHead`](/docs/reference/rust/zaun-community-protocol/struct-signed-chainhead/) | Every root key of a verified chain, `K₀` (genesis) to `Kₙ` (current). Only `super::verify_chain` creates one. | | [`ids::Challenge`](/docs/reference/rust/zaun-community-protocol/struct-ids-challenge/) | A host-issued challenge that a signed proof must echo. | | [`permissions::Channel`](/docs/reference/rust/zaun-community-protocol/struct-permissions-channel/) | The channel context of a channel-level resolution. | | [`command::object::Channel`](/docs/reference/rust/zaun-community-protocol/struct-command-object-channel/) | A channel or category as members see it. | | [`command::object::ChannelAfter`](/docs/reference/rust/zaun-community-protocol/struct-command-object-channelafter/) | `{channel_id, after}` (`sync.resume`, the protocol). | | [`event::ChannelCreated`](/docs/reference/rust/zaun-community-protocol/struct-event-channelcreated/) | `channel.created`: the channel object plus `reason?: "access_gained"`. | | [`command::object::ChannelCursor`](/docs/reference/rust/zaun-community-protocol/struct-command-object-channelcursor/) | `{channel_id, seq}` (`sync.ack`, the protocol). | | [`event::ChannelDeleted`](/docs/reference/rust/zaun-community-protocol/struct-event-channeldeleted/) | `channel.deleted`: `{channel_id, reason?: "access_lost"}`. | | [`command::sync::ChannelEvents`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-channelevents/) | One channel of `sync.resume.channels`. | | [`command::object::ChannelFloor`](/docs/reference/rust/zaun-community-protocol/struct-command-object-channelfloor/) | `{channel_id, floor}` (`sync.resume.floors`, the protocol). | | [`command::object::ChannelHead`](/docs/reference/rust/zaun-community-protocol/struct-command-object-channelhead/) | `{channel_id, head_seq, floor}` (`sync.resume.new`, the protocol). | | [`ids::ChannelId`](/docs/reference/rust/zaun-community-protocol/struct-ids-channelid/) | A channel or category. | | [`command::object::ChannelPosition`](/docs/reference/rust/zaun-community-protocol/struct-command-object-channelposition/) | One entry of `channel.reorder` and `channel.reordered`. | | [`command::dm::Channels`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-channels/) | `dm.list` response: the actor's open DMs. | | [`event::ChannelsReordered`](/docs/reference/rust/zaun-community-protocol/struct-event-channelsreordered/) | `channel.reordered`: `positions` (only channels the member can see). | | [`command::object::Checkbox`](/docs/reference/rust/zaun-community-protocol/struct-command-object-checkbox/) | Type 23. Never required; use a one-option checkbox group for that. | | [`command::object::CheckboxGroup`](/docs/reference/rust/zaun-community-protocol/struct-command-object-checkboxgroup/) | Type 22. | | [`command::object::Choice`](/docs/reference/rust/zaun-community-protocol/struct-command-object-choice/) | A predefined choice of an option, or an autocomplete result. | | [`command::dm::Close`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-close/) | `dm.close`: hides the DM for the actor. | | [`envelope::CommandEnvelope`](/docs/reference/rust/zaun-community-protocol/struct-envelope-commandenvelope/) | `{ "v", "type", "request_id", "community_id", "channel_id"?, "body" }`. | | [`ids::CommandId`](/docs/reference/rust/zaun-community-protocol/struct-ids-commandid/) | An application command of a bot. | | [`command::object::CommandOption`](/docs/reference/rust/zaun-community-protocol/struct-command-object-commandoption/) | An option of a command or subcommand. | | [`command::app::Commands`](/docs/reference/rust/zaun-community-protocol/struct-command-app-commands/) | Response of both: commands with ids (and `bot_id` in `command.list`). | | [`event::CommandsUpdated`](/docs/reference/rust/zaun-community-protocol/struct-event-commandsupdated/) | `command.updated`: one bot's whole command list (`[]` while disabled or removed). | | [`signed::CommunityDescriptor`](/docs/reference/rust/zaun-community-protocol/struct-signed-communitydescriptor/) | The community's public, owner-signed statement. Signed by the current root key. | | [`ids::CommunityId`](/docs/reference/rust/zaun-community-protocol/struct-ids-communityid/) | `SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root public key)`. | | [`command::object::CommunityProfile`](/docs/reference/rust/zaun-community-protocol/struct-command-object-communityprofile/) | The host-managed community profile. | | [`command::sync::CommunitySnapshot`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-communitysnapshot/) | The single item of `part: "community"`. | | [`command::object::ConfigKey`](/docs/reference/rust/zaun-community-protocol/struct-command-object-configkey/) | One setting a bot declares in its manifest's `config` table; the owner sets its value. | | [`command::bot::Configure`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-configure/) | `bot.configure`: the owner sets or clears values of the settings the bot's manifest declares. With neither, it only reads them. | | [`command::bot::Configured`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-configured/) | `bot.configure` response: the values the owner set, secrets shown as `"••••"`. | | [`command::object::Container`](/docs/reference/rust/zaun-community-protocol/struct-command-object-container/) | Type 17. | | [`permissions::Context`](/docs/reference/rust/zaun-community-protocol/struct-permissions-context/) | Community-wide inputs shared by every resolution in one request. | | [`command::channel::Create`](/docs/reference/rust/zaun-community-protocol/struct-command-channel-create/) | `channel.create`. | | [`command::community::Create`](/docs/reference/rust/zaun-community-protocol/struct-command-community-create/) | `community.create`. The envelope's `community_id` names the target. | | [`command::interaction::Create`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-create/) | `interaction.create`. | | [`command::invite::Create`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-create/) | `invite.create`. | | [`command::report::Create`](/docs/reference/rust/zaun-community-protocol/struct-command-report-create/) | `report.create`. | | [`command::role::Create`](/docs/reference/rust/zaun-community-protocol/struct-command-role-create/) | `role.create`. | | [`command::community::Created`](/docs/reference/rust/zaun-community-protocol/struct-command-community-created/) | `community.create` response. | | [`command::interaction::Created`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-created/) | `interaction.create` response. | | [`command::invite::Created`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-created/) | `invite.create` response. `link` embeds the secret and is shown once. | | [`command::report::Created`](/docs/reference/rust/zaun-community-protocol/struct-command-report-created/) | `report.create` response. | | [`client::Cursor`](/docs/reference/rust/zaun-community-protocol/struct-client-cursor/) | One stream's position: the highest contiguous sequence applied, and events held aside. | | [`command::object::Cursors`](/docs/reference/rust/zaun-community-protocol/struct-command-object-cursors/) | The cursors a binding command returns (`community.create`, `invite.redeem`, `membership.request`). | | [`client::CursorTable`](/docs/reference/rust/zaun-community-protocol/struct-client-cursortable/) | The member cursor and one cursor per channel. | | [`command::object::DefaultValue`](/docs/reference/rust/zaun-community-protocol/struct-command-object-defaultvalue/) | A preselected entity of a user, role, mentionable or channel select. | | [`signed::DelegationRef`](/docs/reference/rust/zaun-community-protocol/struct-signed-delegationref/) | `DelegationRef = epoch u64 ‖ delegation_hash bytes32`, where `delegation_hash` is `SHA3-256` of the delegation's canonical bytes (not its signature). | | [`command::channel::Delete`](/docs/reference/rust/zaun-community-protocol/struct-command-channel-delete/) | `channel.delete`. | | [`command::message::Delete`](/docs/reference/rust/zaun-community-protocol/struct-command-message-delete/) | `message.delete`. | | [`command::role::Delete`](/docs/reference/rust/zaun-community-protocol/struct-command-role-delete/) | `role.delete`. | | [`permissions::Denial`](/docs/reference/rust/zaun-community-protocol/struct-permissions-denial/) | A failed permission or hierarchy check. | | [`client::owner::DescriptorContent`](/docs/reference/rust/zaun-community-protocol/struct-client-owner-descriptorcontent/) | The owner-editable, public fields of a descriptor. | | [`ids::DescriptorHash`](/docs/reference/rust/zaun-community-protocol/struct-ids-descriptorhash/) | `SHA3-256` of a signed descriptor's bytes. The descriptor names its delegation's hash, so this identifies the descriptor/delegation pair. | | [`command::community::DescriptorPublish`](/docs/reference/rust/zaun-community-protocol/struct-command-community-descriptorpublish/) | `community.descriptor.publish`. Owner only; larger envelope limit. | | [`event::DescriptorUpdated`](/docs/reference/rust/zaun-community-protocol/struct-event-descriptorupdated/) | `community.descriptor_updated`: signed `descriptor` and `delegation`. | | [`command::bot::Disable`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-disable/) | `bot.disable`. | | [`command::lockdown::Disable`](/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-disable/) | `moderation.lockdown.disable` (`{}`). | | [`event::DmClosed`](/docs/reference/rust/zaun-community-protocol/struct-event-dmclosed/) | `dm.closed`: to the closer's own stream. | | [`command::attachment::Download`](/docs/reference/rust/zaun-community-protocol/struct-command-attachment-download/) | `attachment.download`: asks the host to send an attachment's file. | | [`command::message::Edit`](/docs/reference/rust/zaun-community-protocol/struct-command-message-edit/) | `message.edit`. Author only. | | [`command::object::Embed`](/docs/reference/rust/zaun-community-protocol/struct-command-object-embed/) | An embed. 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 | | [`command::object::EmbedAuthor`](/docs/reference/rust/zaun-community-protocol/struct-command-object-embedauthor/) | `author: {name, url?, icon?}` of an embed. | | [`command::object::EmbedField`](/docs/reference/rust/zaun-community-protocol/struct-command-object-embedfield/) | `fields: {name, value, inline}` of an embed. | | [`command::object::EmbedFooter`](/docs/reference/rust/zaun-community-protocol/struct-command-object-embedfooter/) | `footer: {text, icon?}` of an embed. | | [`command::object::Empty`](/docs/reference/rust/zaun-community-protocol/struct-command-object-empty/) | An empty body or response, `{}`. Unknown fields are ignored. | | [`command::bot::Enable`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-enable/) | `bot.enable` (distinct type so the command table can name it). | | [`command::lockdown::Enable`](/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-enable/) | `moderation.lockdown.enable`; responds with the full `Lockdown`. | | [`framing::EncodedFrame`](/docs/reference/rust/zaun-community-protocol/struct-framing-encodedframe/) | The transport messages of one frame, in sending order. | | [`command::object::EntitySelect`](/docs/reference/rust/zaun-community-protocol/struct-command-object-entityselect/) | Types 5–8. | | [`envelope::ErrorBody`](/docs/reference/rust/zaun-community-protocol/struct-envelope-errorbody/) | An error object: `code`, `message`, and the code's extra fields placed next to `code`. Build it with the constructors (one per `ErrorCode`, see `errors.rs`); they use fixed message | | [`envelope::ErrorExtras`](/docs/reference/rust/zaun-community-protocol/struct-envelope-errorextras/) | The extra fields of the protocol Each applies to the codes named on it. | | [`envelope::EventEnvelope`](/docs/reference/rust/zaun-community-protocol/struct-envelope-eventenvelope/) | `{ "v", "type", "community_id", "channel_id"?, "stream", "sequence"?, "timestamp", "actor_id", "body" }`. Deserialisation validates with `EventEnvelope::validate`. | | [`command::sync::Events`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-events/) | `sync.events`. | | [`envelope::EventsBatch`](/docs/reference/rust/zaun-community-protocol/struct-envelope-eventsbatch/) | A validated `events` batch. Its events are processed in order, exactly as individual events; the batch itself has no stream, sequence or timestamp. | | [`command::sync::EventsPage`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-eventspage/) | `sync.events` response, also the `member` part of `sync.resume`. | | [`command::object::Evidence`](/docs/reference/rust/zaun-community-protocol/struct-command-object-evidence/) | One evidence item. | | [`signed::ExportManifest`](/docs/reference/rust/zaun-community-protocol/struct-signed-exportmanifest/) | Signed by the exporting host's key (and, in a later version, the root key when the owner exports). The key is inside the bytes: an importer trusts it only once it matches a host de | | [`command::object::FileComponent`](/docs/reference/rust/zaun-community-protocol/struct-command-object-filecomponent/) | Type 13. | | [`command::object::FileUpload`](/docs/reference/rust/zaun-community-protocol/struct-command-object-fileupload/) | Type 19. | | [`command::interaction::Followup`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-followup/) | `interaction.followup` and `interaction.original.edit`. | | [`framing::FragId`](/docs/reference/rust/zaun-community-protocol/struct-framing-fragid/) | A fragment id: 8 random bytes, unique per sender per connection among open reassemblies. | | [`framing::Fragment`](/docs/reference/rust/zaun-community-protocol/struct-framing-fragment/) | One fragment message, borrowing its chunk from the received text. | | [`crypto::voice::FrameOpener`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-frameopener/) | Opens one sender's frames for one KID, rejecting replays. | | [`crypto::voice::FrameSealer`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-framesealer/) | Seals this participant's frames under one base key and KID. The counter starts at zero and never repeats; after `FRAMES_PER_KEY` frames it refuses and the sender rekeys. | | [`client::Gap`](/docs/reference/rust/zaun-community-protocol/struct-client-gap/) | A detected gap in a sequenced stream. | | [`client::owner::Genesis`](/docs/reference/rust/zaun-community-protocol/struct-client-owner-genesis/) | A signed genesis descriptor (revision 1) and the delegation it references (epoch 1). | | [`command::community::Get`](/docs/reference/rust/zaun-community-protocol/struct-command-community-get/) | `community.get` (`{}`). | | [`command::lockdown::Get`](/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-get/) | `moderation.lockdown.get` (`{}`). | | [`command::member::Get`](/docs/reference/rust/zaun-community-protocol/struct-command-member-get/) | `member.get`. | | [`command::report::Get`](/docs/reference/rust/zaun-community-protocol/struct-command-report-get/) | `report.get`. | | [`command::lockdown::GetResponse`](/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-getresponse/) | `moderation.lockdown.get` response: `{ "lockdown": object \| null }`, the full form for `MANAGE_SAFETY` holders, otherwise the public form; `null` when none is active. | | [`command::bot::Grant`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-grant/) | `bot.grant`: the new effective grants, replacing the old. | | [`command::bot::GrantChoice`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-grantchoice/) | Optional grant choices of `bot.install`: absent means everything the manifest asks for, within the operator's ceiling. | | [`command::object::Grants`](/docs/reference/rust/zaun-community-protocol/struct-command-object-grants/) | A bot's grants: permission bits (its managed role) and capabilities. | | [`crypto::voice::GroupKeys`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-groupkeys/) | A participant's key state for one voice session. | | [`crypto::voice::Header`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-header/) | An SFrame header (RFC 9605 the protocol). | | [`command::session::Hello`](/docs/reference/rust/zaun-community-protocol/struct-command-session-hello/) | `session.hello`. | | [`command::message::History`](/docs/reference/rust/zaun-community-protocol/struct-command-message-history/) | `message.history`. | | [`command::message::HistoryPage`](/docs/reference/rust/zaun-community-protocol/struct-command-message-historypage/) | `message.history` response. | | [`command::session::HostAttachments`](/docs/reference/rust/zaun-community-protocol/struct-command-session-hostattachments/) | `session.welcome.attachments`. | | [`signed::HostDelegation`](/docs/reference/rust/zaun-community-protocol/struct-signed-hostdelegation/) | The root key's authorisation of one host to operate the community. | | [`ids::HostId`](/docs/reference/rust/zaun-community-protocol/struct-ids-hostid/) | `SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key)`. | | [`client::owner::HostInfo`](/docs/reference/rust/zaun-community-protocol/struct-client-owner-hostinfo/) | What an owner needs about a host to delegate to it. | | [`signed::HostSessionProof`](/docs/reference/rust/zaun-community-protocol/struct-signed-hostsessionproof/) | The host's proof of key possession in `session.welcome`. Signed by the host key. | | [`command::object::IceServer`](/docs/reference/rust/zaun-community-protocol/struct-command-object-iceserver/) | One ICE server, in the shape of WebRTC's `RTCIceServer`. | | [`command::community::Icon`](/docs/reference/rust/zaun-community-protocol/struct-command-community-icon/) | `community.icon.get` response; the client checks `SHA3-256(icon)` against the descriptor. | | [`command::community::IconGet`](/docs/reference/rust/zaun-community-protocol/struct-command-community-iconget/) | `community.icon.get` (`{}`). | | [`command::community::Info`](/docs/reference/rust/zaun-community-protocol/struct-command-community-info/) | `community.get` response. | | [`command::bot::Install`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-install/) | `bot.install`. | | [`command::object::Interaction`](/docs/reference/rust/zaun-community-protocol/struct-command-object-interaction/) | An interaction as delivered to its bot (`interaction.created`). | | [`event::InteractionAutocomplete`](/docs/reference/rust/zaun-community-protocol/struct-event-interactionautocomplete/) | `interaction.autocomplete`: suggestions, to the invoker only. | | [`event::InteractionFailed`](/docs/reference/rust/zaun-community-protocol/struct-event-interactionfailed/) | `interaction.failed`, to the invoker only. | | [`ids::InteractionId`](/docs/reference/rust/zaun-community-protocol/struct-ids-interactionid/) | An interaction: one use of a command, component or modal. | | [`event::InteractionMessage`](/docs/reference/rust/zaun-community-protocol/struct-event-interactionmessage/) | `interaction.message`: an ephemeral message, to the invoker only. | | [`command::object::InteractionMetadata`](/docs/reference/rust/zaun-community-protocol/struct-command-object-interactionmetadata/) | `interaction_metadata` of a message that answers an interaction. | | [`event::InteractionModal`](/docs/reference/rust/zaun-community-protocol/struct-event-interactionmodal/) | `interaction.modal`: open a modal, to the invoker only. | | [`ids::InviteId`](/docs/reference/rust/zaun-community-protocol/struct-ids-inviteid/) | An invitation (public handle; the secret is `InviteSecret`). | | [`command::object::InviteLink`](/docs/reference/rust/zaun-community-protocol/struct-command-object-invitelink/) | A `zaun://join/…` link. It embeds the `crate::ids::InviteSecret`, so `Debug` is redacted; the text is reachable only through `InviteLink::expose`. | | [`client::member::InvitePayload`](/docs/reference/rust/zaun-community-protocol/struct-client-member-invitepayload/) | The canonical `InvitePayload`. Unsigned: after connecting, the welcome must show a descriptor deriving `community_id`, a delegation naming `host_id`, and a host proof — which `Invi | | [`permissions::invites::InviteRequest`](/docs/reference/rust/zaun-community-protocol/struct-permissions-invites-inviterequest/) | The parts of an `invite.create` body the checks need. | | [`ids::InviteSecret`](/docs/reference/rust/zaun-community-protocol/struct-ids-invitesecret/) | An invitation secret: 32 random bytes, shown once. Never logged: `Debug` is redacted and it has no `Display`. Zeroized on drop. | | [`command::object::InviteSummary`](/docs/reference/rust/zaun-community-protocol/struct-command-object-invitesummary/) | One entry of `invite.list`. Never carries the secret. | | [`command::object::InviteUse`](/docs/reference/rust/zaun-community-protocol/struct-command-object-inviteuse/) | One entry of `invite.uses`. | | [`command::voice::Join`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-join/) | `voice.join`: enter a voice channel (leaving any other one). | | [`command::voice::Joined`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-joined/) | The `voice.join` response. | | [`command::object::JoinRate`](/docs/reference/rust/zaun-community-protocol/struct-command-object-joinrate/) | `join_rate: {per_hour}`. | | [`command::voice::KeyFor`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-keyfor/) | One entry of `voice.keys`. | | [`crypto::voice::KeyPackage`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-keypackage/) | A participant's voice key for one session in one voice channel. | | [`command::voice::Keys`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-keys/) | `voice.keys`: the sender's media key for `epoch`, wrapped for each other participant. A whole mesh always fits in one command, so an epoch is never split. | | [`command::member::Kick`](/docs/reference/rust/zaun-community-protocol/struct-command-member-kick/) | `member.kick`. | | [`command::object::Label`](/docs/reference/rust/zaun-community-protocol/struct-command-object-label/) | Type 18. | | [`command::community::Leave`](/docs/reference/rust/zaun-community-protocol/struct-command-community-leave/) | `community.leave` (`{}`). The owner cannot leave (engine: `CONFLICT`). | | [`command::voice::Leave`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-leave/) | `voice.leave`: leave the voice channel the member is in. | | [`command::app::List`](/docs/reference/rust/zaun-community-protocol/struct-command-app-list/) | `command.list`. | | [`command::audit::List`](/docs/reference/rust/zaun-community-protocol/struct-command-audit-list/) | `audit.list`. | | [`command::bot::List`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-list/) | `bot.list`. | | [`command::dm::List`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-list/) | `dm.list`. | | [`command::invite::List`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-list/) | `invite.list`. | | [`command::member::List`](/docs/reference/rust/zaun-community-protocol/struct-command-member-list/) | `member.list`. | | [`command::presence::List`](/docs/reference/rust/zaun-community-protocol/struct-command-presence-list/) | `presence.list`: the presences of the community's connected, visible members. | | [`command::report::List`](/docs/reference/rust/zaun-community-protocol/struct-command-report-list/) | `report.list`. | | [`permissions::Lockdown`](/docs/reference/rust/zaun-community-protocol/struct-permissions-lockdown/) | The community's lockdown row. | | [`command::object::Lockdown`](/docs/reference/rust/zaun-community-protocol/struct-command-object-lockdown/) | The full lockdown record, for `MANAGE_SAFETY` holders: `{ lockdown_id, restrictions, forced_slowmode_s?, newcomer_window_s?, expires_at, reason?, actor_id }`. | | [`ids::LockdownId`](/docs/reference/rust/zaun-community-protocol/struct-ids-lockdownid/) | An emergency lockdown. | | [`command::object::LockdownPublic`](/docs/reference/rust/zaun-community-protocol/struct-command-object-lockdownpublic/) | The public form, for members without `MANAGE_SAFETY`: `{active, restrictions_affecting_you, expires_at}`. With no active lockdown (disabled or expired) it is `{active: false, restr | | [`permissions::LockdownRestrictions`](/docs/reference/rust/zaun-community-protocol/struct-permissions-lockdownrestrictions/) | The restrictions a lockdown names. | | [`command::object::Manifest`](/docs/reference/rust/zaun-community-protocol/struct-command-object-manifest/) | The manifest inside a bot package. | | [`signed::ManifestEntry`](/docs/reference/rust/zaun-community-protocol/struct-signed-manifestentry/) | One chunk: what it is, its length and its `SHA3-256`. | | [`command::object::ManifestLimits`](/docs/reference/rust/zaun-community-protocol/struct-command-object-manifestlimits/) | Resource limits a manifest asks for; the host may lower them. | | [`command::object::MediaGallery`](/docs/reference/rust/zaun-community-protocol/struct-command-object-mediagallery/) | Type 12. | | [`command::object::MediaItem`](/docs/reference/rust/zaun-community-protocol/struct-command-object-mediaitem/) | One picture of a media gallery. | | [`command::object::Member`](/docs/reference/rust/zaun-community-protocol/struct-command-object-member/) | A member as visible to the viewer. Optional fields depend on the viewer's permissions; the host filters them. | | [`ids::MemberId`](/docs/reference/rust/zaun-community-protocol/struct-ids-memberid/) | A community-scoped member identity, host-assigned. | | [`signed::MemberKeyRegistration`](/docs/reference/rust/zaun-community-protocol/struct-signed-memberkeyregistration/) | Proves that the client holds the private key of the member key it registers. Signed by that key. | | [`event::MemberLeft`](/docs/reference/rust/zaun-community-protocol/struct-event-memberleft/) | `member.left`: `{member_id}`. | | [`signed::MemberReauth`](/docs/reference/rust/zaun-community-protocol/struct-signed-memberreauth/) | Signed by the member key. Binds the challenge to the community, the new host and the delegation epoch it operates under, so a proof made for one host or epoch is useless at another | | [`event::MemberRemoved`](/docs/reference/rust/zaun-community-protocol/struct-event-memberremoved/) | `member.removed`: `{reason}`, to the subject only; then the session ends. | | [`event::MemberRolesUpdated`](/docs/reference/rust/zaun-community-protocol/struct-event-memberrolesupdated/) | `member.roles_updated`: `{member_id, role_ids}`. | | [`event::MembershipUpdated`](/docs/reference/rust/zaun-community-protocol/struct-event-membershipupdated/) | `membership.updated`: `{member_id, state, until?}`. | | [`event::MemberTimedOut`](/docs/reference/rust/zaun-community-protocol/struct-event-membertimedout/) | `member.timed_out`: `{member_id, until}`. | | [`command::object::Mentions`](/docs/reference/rust/zaun-community-protocol/struct-command-object-mentions/) | `mentions: {everyone, members, roles}`. | | [`command::object::Message`](/docs/reference/rust/zaun-community-protocol/struct-command-object-message/) | A stored message as returned by `message.history`. | | [`command::object::MessageBody`](/docs/reference/rust/zaun-community-protocol/struct-command-object-messagebody/) | Content, embeds, components, attachments, mentions and flags of a bot's message. | | [`event::MessageCreated`](/docs/reference/rust/zaun-community-protocol/struct-event-messagecreated/) | `message.created`. | | [`event::MessageDeleted`](/docs/reference/rust/zaun-community-protocol/struct-event-messagedeleted/) | `message.deleted`: `{message_id}`. | | [`ids::MessageId`](/docs/reference/rust/zaun-community-protocol/struct-ids-messageid/) | A message. | | [`event::MessagesBulkDeleted`](/docs/reference/rust/zaun-community-protocol/struct-event-messagesbulkdeleted/) | `messages.bulk_deleted`: `{message_ids}` (≤ 1 000). | | [`event::MessageUpdated`](/docs/reference/rust/zaun-community-protocol/struct-event-messageupdated/) | `message.updated`: `{message_id, content, embeds?, components?, flags?, mentions?, edited_at}`. | | [`command::voice::Moderate`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-moderate/) | `voice.moderate`: server mute or deafen, move or disconnect another member. | | [`client::member::Moved`](/docs/reference/rust/zaun-community-protocol/struct-client-member-moved/) | A verified move: the new pair (store its state) and how to reach the new host. | | [`command::object::NewProfile`](/docs/reference/rust/zaun-community-protocol/struct-command-object-newprofile/) | `profile: {display_name}` of a joining or creating member. | | [`ids::Nonce`](/docs/reference/rust/zaun-community-protocol/struct-ids-nonce/) | A single-use value in signed objects. | | [`command::object::Opaque`](/docs/reference/rust/zaun-community-protocol/struct-command-object-opaque/) | Opaque bytes, base64url on the wire (key packages, wrapped keys, signalling data). | | [`command::dm::Open`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-open/) | `dm.open`: the DM with `member_id`, created when there is none (idempotent per pair). | | [`command::object::OptionValue`](/docs/reference/rust/zaun-community-protocol/struct-command-object-optionvalue/) | One option of an invoked command. | | [`command::interaction::OriginalDelete`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-originaldelete/) | `interaction.original.delete`. | | [`command::interaction::OriginalEdit`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-originaledit/) | `interaction.original.edit`: absent fields stay unchanged. | | [`permissions::Override`](/docs/reference/rust/zaun-community-protocol/struct-permissions-override/) | A permission override on one channel or category (permissions the protocol). | | [`command::object::Override`](/docs/reference/rust/zaun-community-protocol/struct-command-object-override/) | A permission override on a channel or category (permissions the protocol). | | [`crypto::voice::PackageExpectation`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-packageexpectation/) | What a receiver expects of a peer's key package. | | [`command::audit::Page`](/docs/reference/rust/zaun-community-protocol/struct-command-audit-page/) | `audit.list` response. | | [`command::invite::Page`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-page/) | `invite.list` response. | | [`command::member::Page`](/docs/reference/rust/zaun-community-protocol/struct-command-member-page/) | `member.list` response. | | [`command::report::Page`](/docs/reference/rust/zaun-community-protocol/struct-command-report-page/) | `report.list` response: `reports`, `next?`. | | [`command::sync::PageCursor`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-pagecursor/) | A snapshot page cursor: a 16-byte role or channel id. | | [`signed::ParsedPackage`](/docs/reference/rust/zaun-community-protocol/struct-signed-parsedpackage/) | The parts of a `.zbot` file, not yet verified. | | [`permissions::Party`](/docs/reference/rust/zaun-community-protocol/struct-permissions-party/) | An actor or target member as the hierarchy sees it. Build it with `Resolver::party`. | | [`command::membership::Pending`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-pending/) | `membership.pending`. | | [`command::membership::PendingPage`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-pendingpage/) | `membership.pending` response. | | [`bits::Permissions`](/docs/reference/rust/zaun-community-protocol/struct-bits-permissions/) | A permission set. JSON: a canonical decimal string. SQLite: `i64` by bit-cast. | | [`command::channel::PermissionsUpdate`](/docs/reference/rust/zaun-community-protocol/struct-command-channel-permissionsupdate/) | `channel.permissions.update`. | | [`command::membership::PolicyGet`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyget/) | `admission.policy.get` (`{}`). | | [`command::membership::PolicyResponse`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyresponse/) | `admission.policy.get` response: `policy` (full, `MANAGE_SAFETY`) or `summary`. | | [`command::object::PolicySummary`](/docs/reference/rust/zaun-community-protocol/struct-command-object-policysummary/) | The public summary: `{level, requires_approval, invite_creation, open}`. Hosts MUST send `open`. | | [`command::membership::PolicyUpdate`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyupdate/) | `admission.policy.update`: any policy field. Every field is non-nullable. | | [`command::membership::PolicyUpdated`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyupdated/) | `admission.policy.update` response. | | [`command::signal::Presence`](/docs/reference/rust/zaun-community-protocol/struct-command-signal-presence/) | `signal.presence`: `{ status?, activity?, viewing? }`, at least one of `status` and `viewing`. | | [`command::presence::Presences`](/docs/reference/rust/zaun-community-protocol/struct-command-presence-presences/) | `presence.list` response: one entry per member not `offline` (members missing from the list are offline). | | [`event::PresenceSignal`](/docs/reference/rust/zaun-community-protocol/struct-event-presencesignal/) | `signal.presence` live event. | | [`command::community::ProfileResponse`](/docs/reference/rust/zaun-community-protocol/struct-command-community-profileresponse/) | `community.update` response. | | [`keys::PublicKey`](/docs/reference/rust/zaun-community-protocol/struct-keys-publickey/) | A composite public key, 1 985 bytes. | | [`command::community::Published`](/docs/reference/rust/zaun-community-protocol/struct-command-community-published/) | `community.descriptor.publish` response. | | [`ids::PublisherId`](/docs/reference/rust/zaun-community-protocol/struct-ids-publisherid/) | `SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher public key)`. | | [`command::object::RadioGroup`](/docs/reference/rust/zaun-community-protocol/struct-command-object-radiogroup/) | Type 21. | | [`command::message::ReactionAdd`](/docs/reference/rust/zaun-community-protocol/struct-command-message-reactionadd/) | `reaction.add`. | | [`event::ReactionChanged`](/docs/reference/rust/zaun-community-protocol/struct-event-reactionchanged/) | `reaction.added` and `reaction.removed`: `{message_id, emoji, member_id}`. | | [`command::object::ReactionCount`](/docs/reference/rust/zaun-community-protocol/struct-command-object-reactioncount/) | `reactions: {emoji, count, me}`. | | [`command::message::ReactionRemove`](/docs/reference/rust/zaun-community-protocol/struct-command-message-reactionremove/) | `reaction.remove`. | | [`encoding::Reader`](/docs/reference/rust/zaun-community-protocol/struct-encoding-reader/) | Reads canonical encodings from a byte slice. Lengths and counts are checked against the field's limit and the remaining input before anything is allocated. | | [`framing::Reassembler`](/docs/reference/rust/zaun-community-protocol/struct-framing-reassembler/) | Per-connection reassembly state machine. | | [`command::migration::Reauth`](/docs/reference/rust/zaun-community-protocol/struct-command-migration-reauth/) | `migration.reauth`: on an unbound connection to the host that took the community over, a member proves its existing member key and the connection binds to the same `MemberId`. Resp | | [`signed::ReauthExpectation`](/docs/reference/rust/zaun-community-protocol/struct-signed-reauthexpectation/) | What the host expects of a reauthentication: the envelope's community, this host, the epoch it operates under and the connection's current challenge. | | [`client::member::ReauthTarget`](/docs/reference/rust/zaun-community-protocol/struct-client-member-reauthtarget/) | Where a member re-authenticates: the community, the new host, the delegation epoch its verified welcome proved, and that welcome's challenge. | | [`client::ReceivedEvent`](/docs/reference/rust/zaun-community-protocol/struct-client-receivedevent/) | A received event: the envelope (sequence, timestamp, actor) and its decoded body. | | [`crypto::voice::RecipientEntry`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-recipiententry/) | One recipient of a sender's epoch key. | | [`command::invite::Redeem`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-redeem/) | `invite.redeem`. Unbound; the envelope's `community_id` names the target. | | [`command::bot::Register`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-register/) | `bot.register`: mark an existing member as an external bot. | | [`signed::RegistrationExpectation`](/docs/reference/rust/zaun-community-protocol/struct-signed-registrationexpectation/) | What the host expects of a registration: the command's fields and the connection's current challenge. | | [`client::member::RegistrationTarget`](/docs/reference/rust/zaun-community-protocol/struct-client-member-registrationtarget/) | Where a registration is made: the community, the host and the welcome's challenge. | | [`command::membership::Reject`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-reject/) | `membership.reject`. | | [`envelope::Rejection`](/docs/reference/rust/zaun-community-protocol/struct-envelope-rejection/) | A command the host rejects before dispatch; send `Rejection::into_response` back. | | [`crypto::voice::Rekey`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-rekey/) | What a rekey sends: one signed sender-keys message for everyone and one wrapped key each. | | [`crypto::voice::RekeyTarget`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-rekeytarget/) | One recipient's share of a `Rekey`. | | [`command::bot::Remove`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-remove/) | `bot.remove`. | | [`command::channel::Reorder`](/docs/reference/rust/zaun-community-protocol/struct-command-channel-reorder/) | `channel.reorder`. | | [`command::role::Reorder`](/docs/reference/rust/zaun-community-protocol/struct-command-role-reorder/) | `role.reorder`. | | [`command::interaction::Replied`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-replied/) | `interaction.respond` and `interaction.followup` response. | | [`command::object::Report`](/docs/reference/rust/zaun-community-protocol/struct-command-object-report/) | A report. Only for `MANAGE_REPORTS` holders and, without other reporters' data, the reporter. | | [`ids::ReportId`](/docs/reference/rust/zaun-community-protocol/struct-ids-reportid/) | A member report. | | [`command::membership::Request`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-request/) | `membership.request`. Unbound; responds with `super::invite::Admitted`. The target community is the envelope's `community_id`, as for `invite.redeem`. | | [`ids::RequestId`](/docs/reference/rust/zaun-community-protocol/struct-ids-requestid/) | Correlates a command with its response; client-assigned. | | [`permissions::Requirement`](/docs/reference/rust/zaun-community-protocol/struct-permissions-requirement/) | What a command requires (permissions the protocol, the protocol). | | [`command::object::Resolution`](/docs/reference/rust/zaun-community-protocol/struct-command-object-resolution/) | `resolution: {outcome, note?, actor_id, at}`. | | [`command::report::Resolve`](/docs/reference/rust/zaun-community-protocol/struct-command-report-resolve/) | `report.resolve`: `note?` is ≤ 512 scalars. | | [`permissions::Resolved`](/docs/reference/rust/zaun-community-protocol/struct-permissions-resolved/) | One resolved permission set (`cp` or `chp`). | | [`command::object::Resolved`](/docs/reference/rust/zaun-community-protocol/struct-command-object-resolved/) | Objects an interaction refers to, resolved by the host. | | [`permissions::Resolver`](/docs/reference/rust/zaun-community-protocol/struct-permissions-resolver/) | Per-member state computed once; then `Resolver::community` and `Resolver::channel` are cheap enough to call for every channel of a snapshot. | | [`command::interaction::Respond`](/docs/reference/rust/zaun-community-protocol/struct-command-interaction-respond/) | `interaction.respond`. | | [`client::Response`](/docs/reference/rust/zaun-community-protocol/struct-client-response/) | A final response. `Debug` hides the body, which may embed a secret (an invitation link). | | [`envelope::ResponseEnvelope`](/docs/reference/rust/zaun-community-protocol/struct-envelope-responseenvelope/) | `{ "v", "type": "response", "request_id", "ok", "body" \| "error" }`. | | [`command::membership::Restore`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-restore/) | `membership.restore`. | | [`command::sync::Resume`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-resume/) | `sync.resume`. | | [`command::sync::Resumed`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-resumed/) | `sync.resume` response. | | [`command::object::Resync`](/docs/reference/rust/zaun-community-protocol/struct-command-object-resync/) | `{stream, channel_id?}` of `sync.resume.resync` and `RESYNC_REQUIRED`. | | [`command::object::Retention`](/docs/reference/rust/zaun-community-protocol/struct-command-object-retention/) | Message retention of a channel. | | [`client::RetryPolicy`](/docs/reference/rust/zaun-community-protocol/struct-client-retrypolicy/) | Exponential backoff: `initial_ms`, then ×`factor`, capped at `cap_ms`; give up once `give_up_ms` have passed since the first send. | | [`command::report::Review`](/docs/reference/rust/zaun-community-protocol/struct-command-report-review/) | `report.review`: `open` → `reviewing`. | | [`command::invite::Revoke`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-revoke/) | `invite.revoke`. | | [`ids::RngError`](/docs/reference/rust/zaun-community-protocol/struct-ids-rngerror/) | The operating system's CSPRNG failed. | | [`permissions::Role`](/docs/reference/rust/zaun-community-protocol/struct-permissions-role/) | A role as the resolver sees it (permissions the protocol). | | [`command::object::Role`](/docs/reference/rust/zaun-community-protocol/struct-command-object-role/) | A role. Visible to every member. | | [`event::RoleDeleted`](/docs/reference/rust/zaun-community-protocol/struct-event-roledeleted/) | `role.deleted`: `{role_id}`. | | [`ids::RoleId`](/docs/reference/rust/zaun-community-protocol/struct-ids-roleid/) | A role. `RoleId::EVERYONE` is the reserved all-zero id. | | [`command::object::RolePosition`](/docs/reference/rust/zaun-community-protocol/struct-command-object-roleposition/) | One entry of `role.reorder` and `role.reordered`. | | [`event::RolesReordered`](/docs/reference/rust/zaun-community-protocol/struct-event-rolesreordered/) | `role.reordered`: `positions`. SPEC: the `role.reorder` entry is reused. | | [`command::member::RolesUpdate`](/docs/reference/rust/zaun-community-protocol/struct-command-member-rolesupdate/) | `member.roles.update`. | | [`signed::RootRotation`](/docs/reference/rust/zaun-community-protocol/struct-signed-rootrotation/) | The replacement of the community's root key, signed by the old **and** the new key. | | [`command::community::RotationPage`](/docs/reference/rust/zaun-community-protocol/struct-command-community-rotationpage/) | `community.rotations` response. | | [`command::community::Rotations`](/docs/reference/rust/zaun-community-protocol/struct-command-community-rotations/) | `community.rotations`. | | [`signed::Scopes`](/docs/reference/rust/zaun-community-protocol/struct-signed-scopes/) | Delegation scopes (field 6). Unknown bits are kept for re-encoding, are ignored and grant nothing. | | [`crypto::SecretKey`](/docs/reference/rust/zaun-community-protocol/struct-crypto-secretkey/) | A suite-1 composite private key: `mldsaSeed` (FIPS 204 ξ, 32 B) ‖ `edSK` (32 B). | | [`command::object::Section`](/docs/reference/rust/zaun-community-protocol/struct-command-object-section/) | Type 9. | | [`command::object::SelectOption`](/docs/reference/rust/zaun-community-protocol/struct-command-object-selectoption/) | One option of a string select, radio group or checkbox group. | | [`command::message::Send`](/docs/reference/rust/zaun-community-protocol/struct-command-message-send/) | `message.send`. | | [`crypto::voice::SenderKey`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-senderkey/) | An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped. | | [`crypto::voice::SenderKeys`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-senderkeys/) | The signed statement of one sender's epoch (see the module table). | | [`crypto::voice::SenderKeysExpectation`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-senderkeysexpectation/) | What a recipient expects of a sender-keys message. | | [`command::message::Sent`](/docs/reference/rust/zaun-community-protocol/struct-command-message-sent/) | `message.send` response. | | [`command::object::Separator`](/docs/reference/rust/zaun-community-protocol/struct-command-object-separator/) | Type 14. | | [`command::message::Sequenced`](/docs/reference/rust/zaun-community-protocol/struct-command-message-sequenced/) | `message.edit` and `message.delete` response: the event's `channel_seq`. | | [`client::Session`](/docs/reference/rust/zaun-community-protocol/struct-client-session/) | A sans-IO client session. See the module documentation. | | [`client::SessionConfig`](/docs/reference/rust/zaun-community-protocol/struct-client-sessionconfig/) | Everything a `super::Session` needs besides the transport. | | [`command::app::Set`](/docs/reference/rust/zaun-community-protocol/struct-command-app-set/) | `command.set`: a bot replaces its whole command list. | | [`command::dm::Settings`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-settings/) | The member's settings (`member.settings.get` / `.update` response). | | [`command::dm::SettingsGet`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-settingsget/) | `member.settings.get`. | | [`command::dm::SettingsUpdate`](/docs/reference/rust/zaun-community-protocol/struct-command-dm-settingsupdate/) | `member.settings.update`: absent fields stay. | | [`crypto::Sha3Hasher`](/docs/reference/rust/zaun-community-protocol/struct-crypto-sha3hasher/) | An incremental `content_hash`, for attachment files read in pieces. | | [`command::voice::Signal`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-signal/) | `voice.signal`: WebRTC signalling for one other participant of the same channel. | | [`keys::Signature`](/docs/reference/rust/zaun-community-protocol/struct-keys-signature/) | A composite signature, 3 374 bytes. | | [`signed::Signed`](/docs/reference/rust/zaun-community-protocol/struct-signed-signed/) | A signed object whose signature has been made or verified, with its exact bytes. | | [`json::SignedJson`](/docs/reference/rust/zaun-community-protocol/struct-json-signedjson/) | A signed object as it travels in JSON: the canonical bytes `B` and the composite signature, both base64url. Receivers verify `sig` over `bytes` with the context of the object type | | [`crypto::voice::SignedKeyPackage`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-signedkeypackage/) | A key package whose signature was made here or verified. | | [`signed::SignedRootRotation`](/docs/reference/rust/zaun-community-protocol/struct-signed-signedrootrotation/) | A rotation with both signatures, unverified (verify with `super::verify_chain`). | | [`command::object::SignedRotation`](/docs/reference/rust/zaun-community-protocol/struct-command-object-signedrotation/) | A `SignedRootRotation` in JSON: `{bytes, sig_old, sig_new}`, all base64url. Kept undecoded, like `crate::json::SignedJson`; the `signed` module verifies it. | | [`crypto::voice::SignedSenderKeys`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-signedsenderkeys/) | A sender-keys message whose signature was made here or verified. | | [`command::sync::Snapshot`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-snapshot/) | `sync.snapshot`. | | [`command::sync::SnapshotPage`](/docs/reference/rust/zaun-community-protocol/struct-command-sync-snapshotpage/) | `sync.snapshot` response. | | [`command::presence::StatusSet`](/docs/reference/rust/zaun-community-protocol/struct-command-presence-statusset/) | `member.status.set`: replaces the actor's custom status. A body with neither `text` nor `emoji` clears it. | | [`permissions::Steps`](/docs/reference/rust/zaun-community-protocol/struct-permissions-steps/) | The masks each step 7 restriction removed, in application order. | | [`command::object::StringSelect`](/docs/reference/rust/zaun-community-protocol/struct-command-object-stringselect/) | Type 3. | | [`permissions::Subject`](/docs/reference/rust/zaun-community-protocol/struct-permissions-subject/) | The member whose permissions are resolved. | | [`command::object::SubmittedInput`](/docs/reference/rust/zaun-community-protocol/struct-command-object-submittedinput/) | One submitted modal input. | | [`command::membership::Suspend`](/docs/reference/rust/zaun-community-protocol/struct-command-membership-suspend/) | `membership.suspend`. `until` is absolute; the 90-day bound is checked by `Command::validate_at`. | | [`command::bot::Target`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-target/) | `bot.enable`, `bot.disable`, `bot.get`. | | [`command::object::TextDisplay`](/docs/reference/rust/zaun-community-protocol/struct-command-object-textdisplay/) | Type 10. | | [`command::object::TextInput`](/docs/reference/rust/zaun-community-protocol/struct-command-object-textinput/) | Type 4. | | [`command::object::Thumbnail`](/docs/reference/rust/zaun-community-protocol/struct-command-object-thumbnail/) | Type 11. | | [`command::member::Timeout`](/docs/reference/rust/zaun-community-protocol/struct-command-member-timeout/) | `member.timeout`. `until` is absolute; the 28-day bound needs the host clock, so it is checked by `Command::validate_at`. | | [`command::signal::Typing`](/docs/reference/rust/zaun-community-protocol/struct-command-signal-typing/) | `signal.typing { channel_id }`. | | [`event::TypingSignal`](/docs/reference/rust/zaun-community-protocol/struct-event-typingsignal/) | `signal.typing` live event: `{channel_id, member_ids}` in a `named` channel, `{channel_id, count}` in an `anonymous` one (who is typing is never sent there). | | [`command::member::Unban`](/docs/reference/rust/zaun-community-protocol/struct-command-member-unban/) | `member.unban`. | | [`command::bot::Update`](/docs/reference/rust/zaun-community-protocol/struct-command-bot-update/) | `bot.update`. | | [`command::channel::Update`](/docs/reference/rust/zaun-community-protocol/struct-command-channel-update/) | `channel.update`: any of the fields; `null` clears only `topic` and `parent_id`. | | [`command::community::Update`](/docs/reference/rust/zaun-community-protocol/struct-command-community-update/) | `community.update`: host-managed profile fields only. | | [`command::member::Update`](/docs/reference/rust/zaun-community-protocol/struct-command-member-update/) | `member.update`: a display-name change. | | [`command::role::Update`](/docs/reference/rust/zaun-community-protocol/struct-command-role-update/) | `role.update`: any of the `role.create` fields. | | [`command::voice::Update`](/docs/reference/rust/zaun-community-protocol/struct-command-voice-update/) | `voice.update`: the member's own mute and deafen. | | [`command::attachment::Upload`](/docs/reference/rust/zaun-community-protocol/struct-command-attachment-upload/) | `attachment.upload`: declares a file the member is about to send. | | [`command::attachment::Uploading`](/docs/reference/rust/zaun-community-protocol/struct-command-attachment-uploading/) | `attachment.upload` response. | | [`command::invite::UsePage`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-usepage/) | `invite.uses` response. | | [`command::invite::Uses`](/docs/reference/rust/zaun-community-protocol/struct-command-invite-uses/) | `invite.uses`. Page size 1–100. | | [`signed::ValidDescriptor`](/docs/reference/rust/zaun-community-protocol/struct-signed-validdescriptor/) | A descriptor that passed rule 1 and the descriptor parts of rule 5. | | [`signed::ValidPair`](/docs/reference/rust/zaun-community-protocol/struct-signed-validpair/) | A (descriptor, delegation) pair valid at the time it was checked, with the state to store. Only `validate_pair` creates one. | | [`signed::VerifiedPackage`](/docs/reference/rust/zaun-community-protocol/struct-signed-verifiedpackage/) | A package whose signature (unless unsigned was allowed), hashes and manifest ids were checked. | | [`client::VerifiedWelcome`](/docs/reference/rust/zaun-community-protocol/struct-client-verifiedwelcome/) | A welcome that passed every check. Everything in it comes from verified signed objects or was compared with them. | | [`envelope::VersionRange`](/docs/reference/rust/zaun-community-protocol/struct-envelope-versionrange/) | An inclusive protocol version range (`session.hello.versions`, `UNSUPPORTED_VERSION`). | | [`command::session::Versions`](/docs/reference/rust/zaun-community-protocol/struct-command-session-versions/) | `{min, max}` protocol versions. | | [`crypto::voice::VoiceIdentity`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-voiceidentity/) | A voice session's X-Wing key pair. The secret is the 32-byte X-Wing seed, zeroized on drop and never printed. It lives only as long as the voice session; it is never stored. | | [`event::VoiceJoined`](/docs/reference/rust/zaun-community-protocol/struct-event-voicejoined/) | `voice.joined`: a member entered a voice channel. Its `key_package` is present only for the channel's other participants. | | [`event::VoiceKeys`](/docs/reference/rust/zaun-community-protocol/struct-event-voicekeys/) | `voice.keys`: another participant's media key for `epoch`: its signed sender-keys message and the key wrapped for this participant only (never another's). | | [`event::VoiceLeft`](/docs/reference/rust/zaun-community-protocol/struct-event-voiceleft/) | `voice.left`: a member left a voice channel. The member itself receives it too. | | [`command::object::VoiceParticipant`](/docs/reference/rust/zaun-community-protocol/struct-command-object-voiceparticipant/) | One member in a voice channel. | | [`crypto::voice::VoicePublicKey`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-voicepublickey/) | An X-Wing encapsulation key (ML-KEM-768 ‖ X25519, 1 216 bytes), validated on parse. | | [`ids::VoiceSessionId`](/docs/reference/rust/zaun-community-protocol/struct-ids-voicesessionid/) | One stay of a member in a voice channel, host-assigned at `voice.join`. | | [`crypto::voice::VoiceSessionId`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-voicesessionid/) | One participation in a voice channel. A member draws a fresh one on every join, so KIDs and epochs never repeat across joins. | | [`event::VoiceSignal`](/docs/reference/rust/zaun-community-protocol/struct-event-voicesignal/) | `voice.signal`: WebRTC signalling from another participant, to this one only. | | [`event::VoiceUpdated`](/docs/reference/rust/zaun-community-protocol/struct-event-voiceupdated/) | `voice.updated`: a participant's mute, deafen or `can_speak` changed. | | [`command::session::Welcome`](/docs/reference/rust/zaun-community-protocol/struct-command-session-welcome/) | `session.welcome`. | | [`crypto::voice::WrapContext`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-wrapcontext/) | Who wraps, for which channel and epoch: bound into the HPKE `info`. | | [`crypto::voice::WrappedKey`](/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-wrappedkey/) | A base key wrapped to one recipient: X-Wing `enc` ‖ AES-256-GCM ciphertext ‖ tag. | | [`encoding::Writer`](/docs/reference/rust/zaun-community-protocol/struct-encoding-writer/) | Appends canonical encodings to a buffer. Variable fields take their limit and fail above it, mirroring `super::Reader`. | ## Traits | Item | Summary | |---|---| | [`command::Body`](/docs/reference/rust/zaun-community-protocol/trait-command-body/) | A command body type: its wire name and response body type. | | [`command::BodyVisitor`](/docs/reference/rust/zaun-community-protocol/trait-command-bodyvisitor/) | Something done with a command body of a type known only at run time (`Command::visit`). | | [`encoding::Decode`](/docs/reference/rust/zaun-community-protocol/trait-encoding-decode/) | A type with a canonical decoding. | | [`encoding::Encode`](/docs/reference/rust/zaun-community-protocol/trait-encoding-encode/) | A type with a canonical encoding (fixed-size or self-limiting). | | [`signed::SignedObject`](/docs/reference/rust/zaun-community-protocol/trait-signed-signedobject/) | A signed object type: its canonical encoding (format byte first) and its context. | | [`command::Validate`](/docs/reference/rust/zaun-community-protocol/trait-command-validate/) | State-free checks of one body. | --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/constant-mention-everyone/ --- # Constant mention::EVERYONE > The text that shows `@everyone`. `zaun_bot::mention::EVERYONE` · Constant ```rust pub const EVERYONE: &str = "@everyone"; ``` The text that shows `@everyone`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/constant.EVERYONE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/constant-mention-max_members/ --- # Constant mention::MAX_MEMBERS > Most members one message may mention (spec the protocol). `zaun_bot::mention::MAX_MEMBERS` · Constant ```rust pub const MAX_MEMBERS: usize = 50; ``` Most members one message may mention (spec the protocol). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/constant.MAX_MEMBERS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/constant-mention-max_roles/ --- # Constant mention::MAX_ROLES > Most roles one message may mention (spec the protocol). `zaun_bot::mention::MAX_ROLES` · Constant ```rust pub const MAX_ROLES: usize = 20; ``` Most roles one message may mention (spec the protocol). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/constant.MAX_ROLES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-audio-audioformat/ --- # Enum audio::AudioFormat > How the bot's audio is encoded. `zaun_bot::audio::AudioFormat` · Enum ```rust pub enum AudioFormat { … } ``` How the bot's audio is encoded. ## Variants ### `Opus` Opus packets (2.5-120 ms each, at most 1000 bytes), sent as they are. ### `Pcm(PcmFormat)` Signed 16-bit PCM, encoded to Opus by the host: `UNSUPPORTED` on hosts without an Opus encoder. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/enum.AudioFormat.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-http-httperror/ --- # Enum bindings::zaun::bot::http::HttpError > Enum HttpError in zaun_bot. `zaun_bot::bindings::zaun::bot::http::HttpError` · Enum ```rust pub enum HttpError { … } ``` ## Variants ### `NotGranted(String)` The host (or `host:port`) is not in the bot's `network` or `local_network` grant, or not in the operator's ceiling. ### `RefusedAddress` The name resolved to a loopback, private, link-local or reserved address, and the address is not a `local_network` grant. ### `InvalidUrl` Malformed, or not `https://` (`http://` only for `local_network` addresses). ### `Timeout` ### `TooLarge` ### `Transport(String)` ## Trait implementations `Clone`, `Debug`, `Display`, `Error` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/http/enum.HttpError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-log-level/ --- # Enum bindings::zaun::bot::log::Level > Enum Level in zaun_bot. `zaun_bot::bindings::zaun::bot::log::Level` · Enum ```rust pub enum Level { … } ``` ## Variants ### `Trace` ### `Debug` ### `Info` ### `Warn` ### `Error` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/log/enum.Level.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-buttonstyle/ --- # Enum bindings::zaun::bot::types::ButtonStyle > components Button styles 1-5; premium (6) is not supported. `zaun_bot::bindings::zaun::bot::types::ButtonStyle` · Enum ```rust pub enum ButtonStyle { … } ``` ---- components ----------------------------------------------------------- Button styles 1-5; premium (6) is not supported. ## Variants ### `Primary` ### `Secondary` ### `Success` ### `Danger` ### `Link` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.ButtonStyle.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-commandentry/ --- # Enum bindings::zaun::bot::types::CommandEntry > Enum CommandEntry in zaun_bot. `zaun_bot::bindings::zaun::bot::types::CommandEntry` · Enum ```rust pub enum CommandEntry { … } ``` ## Variants ### `ValueOption(CommandOption)` ### `SubCommand(SubCommand)` ### `Group(SubCommandGroup)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.CommandEntry.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-commandkind/ --- # Enum bindings::zaun::bot::types::CommandKind > application commands Type 1, 2, 3. `zaun_bot::bindings::zaun::bot::types::CommandKind` · Enum ```rust pub enum CommandKind { … } ``` ---- application commands ------------------------------------------------- Type 1, 2, 3. ## Variants ### `ChatInput` ### `User` ### `Message` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.CommandKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-component/ --- # Enum bindings::zaun::bot::types::Component > A top-level message component. Without `components-v2` only `action-row` is allowed. `zaun_bot::bindings::zaun::bot::types::Component` · Enum ```rust pub enum Component { … } ``` A top-level message component. Without `components-v2` only `action-row` is allowed. ## Variants ### `ActionRow(ActionRow)` ### `TextDisplay(TextDisplay)` ### `Section(Section)` ### `MediaGallery(MediaGallery)` ### `File(File)` ### `Separator(Separator)` ### `Container(Container)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.Component.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-containerchild/ --- # Enum bindings::zaun::bot::types::ContainerChild > Enum ContainerChild in zaun_bot. `zaun_bot::bindings::zaun::bot::types::ContainerChild` · Enum ```rust pub enum ContainerChild { … } ``` ## Variants ### `ActionRow(ActionRow)` ### `TextDisplay(TextDisplay)` ### `Section(Section)` ### `MediaGallery(MediaGallery)` ### `File(File)` ### `Separator(Separator)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.ContainerChild.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-defaultvaluekind/ --- # Enum bindings::zaun::bot::types::DefaultValueKind > Enum DefaultValueKind in zaun_bot. `zaun_bot::bindings::zaun::bot::types::DefaultValueKind` · Enum ```rust pub enum DefaultValueKind { … } ``` ## Variants ### `User` ### `Role` ### `Channel` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.DefaultValueKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-entitykind/ --- # Enum bindings::zaun::bot::types::EntityKind > Types 5 (user), 6 (role), 7 (mentionable), 8 (channel). `zaun_bot::bindings::zaun::bot::types::EntityKind` · Enum ```rust pub enum EntityKind { … } ``` Types 5 (user), 6 (role), 7 (mentionable), 8 (channel). ## Variants ### `User` ### `Role` ### `Mentionable` ### `Channel` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.EntityKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-interactiondata/ --- # Enum bindings::zaun::bot::types::InteractionData > Enum InteractionData in zaun_bot. `zaun_bot::bindings::zaun::bot::types::InteractionData` · Enum ```rust pub enum InteractionData { … } ``` ## Variants ### `Command(CommandData)` ### `Component(ComponentData)` ### `Autocomplete(CommandData)` ### `ModalSubmit(ModalData)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.InteractionData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-labelchild/ --- # Enum bindings::zaun::bot::types::LabelChild > Enum LabelChild in zaun_bot. `zaun_bot::bindings::zaun::bot::types::LabelChild` · Enum ```rust pub enum LabelChild { … } ``` ## Variants ### `TextInput(TextInput)` ### `StringSelect(StringSelect)` ### `EntitySelect(EntitySelect)` ### `FileUpload(FileUpload)` ### `RadioGroup(RadioGroup)` ### `CheckboxGroup(CheckboxGroup)` ### `Checkbox(Checkbox)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.LabelChild.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-modalitem/ --- # Enum bindings::zaun::bot::types::ModalItem > Enum ModalItem in zaun_bot. `zaun_bot::bindings::zaun::bot::types::ModalItem` · Enum ```rust pub enum ModalItem { … } ``` ## Variants ### `Label(Label)` ### `TextDisplay(TextDisplay)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.ModalItem.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-optionkind/ --- # Enum bindings::zaun::bot::types::OptionKind > Option types 3-11 (1 and 2 are sub-commands and groups). `zaun_bot::bindings::zaun::bot::types::OptionKind` · Enum ```rust pub enum OptionKind { … } ``` Option types 3-11 (1 and 2 are sub-commands and groups). ## Variants ### `String` ### `Integer` ### `Boolean` ### `User` ### `Channel` ### `Role` ### `Mentionable` ### `Number` ### `Attachment` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.OptionKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-optionvalue/ --- # Enum bindings::zaun::bot::types::OptionValue > interactions `zaun_bot::bindings::zaun::bot::types::OptionValue` · Enum ```rust pub enum OptionValue { … } ``` ---- interactions --------------------------------------------------------- ## Variants ### `Text(String)` ### `Integer(i64)` ### `Boolean(bool)` ### `Number(f64)` ### `Id(Id)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.OptionValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-response/ --- # Enum bindings::zaun::bot::types::Response > Callback types 4-9 (8, the autocomplete result, is the return value of `on-autocomplete`). `zaun_bot::bindings::zaun::bot::types::Response` · Enum ```rust pub enum Response { … } ``` Callback types 4-9 (8, the autocomplete result, is the return value of `on-autocomplete`). ## Variants ### `Message(MessageBody)` 4: `CHANNEL_MESSAGE_WITH_SOURCE`. ### `DeferredMessage(bool)` 5: `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`; `true` = ephemeral. ### `DeferredUpdate` 6: `DEFERRED_UPDATE_MESSAGE`. ### `UpdateMessage(MessageBody)` 7: `UPDATE_MESSAGE`. ### `Modal(Modal)` 9: `MODAL`. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.Response.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-rowitem/ --- # Enum bindings::zaun::bot::types::RowItem > Enum RowItem in zaun_bot. `zaun_bot::bindings::zaun::bot::types::RowItem` · Enum ```rust pub enum RowItem { … } ``` ## Variants ### `Button(Button)` ### `StringSelect(StringSelect)` ### `EntitySelect(EntitySelect)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.RowItem.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-sectionaccessory/ --- # Enum bindings::zaun::bot::types::SectionAccessory > Enum SectionAccessory in zaun_bot. `zaun_bot::bindings::zaun::bot::types::SectionAccessory` · Enum ```rust pub enum SectionAccessory { … } ``` ## Variants ### `Button(Button)` ### `Thumbnail(Thumbnail)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.SectionAccessory.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-separatorspacing/ --- # Enum bindings::zaun::bot::types::SeparatorSpacing > Enum SeparatorSpacing in zaun_bot. `zaun_bot::bindings::zaun::bot::types::SeparatorSpacing` · Enum ```rust pub enum SeparatorSpacing { … } ``` ## Variants ### `Small` ### `Large` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.SeparatorSpacing.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-types-textinputstyle/ --- # Enum bindings::zaun::bot::types::TextInputStyle > modals `zaun_bot::bindings::zaun::bot::types::TextInputStyle` · Enum ```rust pub enum TextInputStyle { … } ``` ---- modals --------------------------------------------------------------- ## Variants ### `Short` ### `Paragraph` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.TextInputStyle.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-bindings-zaun-bot-voice-source/ --- # Enum bindings::zaun::bot::voice::Source > Where a track's audio comes from. `zaun_bot::bindings::zaun::bot::voice::Source` · Enum ```rust pub enum Source { … } ``` Where a track's audio comes from. ## Variants ### `Url(String)` An `https://` Ogg Opus or WebM Opus file or stream (WebM where the host demuxes it; elsewhere a `track-error`), fetched by the host under the bot's `network` grant (the server learns the host's address) and played as it arrives. `http://` and `https://` URLs to a `local_network` address are fetched the same way, without leaving the host's machine or network. ### `Ogg(Vec)` Ogg Opus bytes the bot already holds (≤ 16 MiB). ### `Pushed` Opus packets the bot pushes with `push`, until `end-stream`. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/enum.Source.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-prelude-choicevalue/ --- # Enum prelude::ChoiceValue > Enum ChoiceValue in zaun_bot. `zaun_bot::prelude::ChoiceValue` · Enum ```rust pub enum ChoiceValue { … } ``` ## Variants ### `Text(String)` ### `Integer(i64)` ### `Number(f64)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.ChoiceValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-prelude-event/ --- # Enum prelude::Event > 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 ev `zaun_bot::prelude::Event` · Enum ```rust pub enum Event { … } ``` 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. ## Variants ### `Ready(Ready)` Always delivered first, once the bot's connection is up. ### `MessageCreated(MessageEvent)` ### `MessageUpdated(MessageEvent)` ### `MessageDeleted(MessageDeleted)` ### `MessagesBulkDeleted(MessagesDeleted)` ### `ReactionAdded(Reaction)` ### `ReactionRemoved(Reaction)` ### `MemberJoined(Member)` Group `members` (capability `members`). ### `MemberUpdated(Member)` ### `MemberLeft(Id)` ### `MemberRemoved(String)` The bot itself was removed; `reason` is `kicked`, `banned`, ... ### `MemberRolesUpdated(MemberRoles)` ### `MemberTimedOut(MemberTimeout)` ### `ChannelCreated(Channel)` ### `ChannelUpdated(Channel)` ### `ChannelDeleted(Id)` ### `RoleCreated(Role)` ### `RoleUpdated(Role)` ### `RoleDeleted(Id)` ### `TypingStarted(Typing)` ### `PresenceUpdated(Presence)` Group `presence` (capability `presence`). ### `CommunityUpdated(CommunityProfile)` ### `CommandUpdated(Id)` A bot's command list changed; the bot's id. ### `DmCreated(Channel)` Group `dms` (capability `dms`): a DM with the bot was opened, or the bot closed one. ### `DmClosed(Id)` ### `Other(RawEvent)` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.Event.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-presence-activitytype/ --- # Enum presence::ActivityType > "Playing {name}", "Streaming {name}", "Listening to {name}", "Watching {name}", "Competing in {name}", or free text (`custom`). `zaun_bot::presence::ActivityType` · Enum ```rust pub enum ActivityType { … } ``` "Playing {name}", "Streaming {name}", "Listening to {name}", "Watching {name}", "Competing in {name}", or free text (`custom`). ## Variants ### `Playing` ### `Streaming` ### `Listening` ### `Watching` ### `Competing` ### `Custom` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/enum.ActivityType.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-presence-status/ --- # Enum presence::Status > `invisible` looks offline to everyone. `zaun_bot::presence::Status` · Enum ```rust pub enum Status { … } ``` `invisible` looks offline to everyone. ## Variants ### `Online` ### `Idle` ### `Dnd` ### `Invisible` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/presence/enum.Status.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-select/ --- # Enum Select > Builds a select menu: string options or members, roles, mentionables or channels. `zaun_bot::Select` · Enum ```rust pub enum Select { … } ``` Builds a select menu: string options or members, roles, mentionables or channels. ## Variants ### `Strings(StringSelect)` Type 3. ### `Entities(EntitySelect)` Types 5–8. ## Methods ### `strings` ```rust pub fn strings>(custom_id: impl Into, options: &[(&str, &str)]) -> Self ``` A string select with these `(label, value)` options (≤ 25). ### `entities` ```rust pub fn entities>(kind: EntityKind, custom_id: impl Into) -> Self ``` A member, role, mentionable or channel select. ### `placeholder` ```rust pub fn placeholder>(self, text: impl Into) -> Self ``` Placeholder text (≤ 150). ### `range` ```rust pub fn range(self, min: u8, max: u8) -> Self ``` How many values may be picked (0–25). ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/select/enum.Select.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-voice-loopmode/ --- # Enum voice::LoopMode > What happens when a track ends: go on (`off`), play it again (`track`), or put it at the end of the queue (`queue`). `zaun_bot::voice::LoopMode` · Enum ```rust pub enum LoopMode { … } ``` What happens when a track ends: go on (`off`), play it again (`track`), or put it at the end of the queue (`queue`). ## Variants ### `Off` ### `Track` ### `Queue` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/enum.LoopMode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-voice-playerstatus/ --- # Enum voice::PlayerStatus > Enum PlayerStatus in zaun_bot. `zaun_bot::voice::PlayerStatus` · Enum ```rust pub enum PlayerStatus { … } ``` ## Variants ### `Idle` ### `Playing` ### `Paused` ### `AutoPaused` ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/enum.PlayerStatus.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/enum-voice-voiceevent/ --- # Enum voice::VoiceEvent > What happened, for `on-voice-event`. `zaun_bot::voice::VoiceEvent` · Enum ```rust pub enum VoiceEvent { … } ``` What happened, for `on-voice-event`. ## Variants ### `TrackStart(Option)` A track started (its title). ### `TrackEnd(Option)` A track ended: played out, skipped, stopped or failed. ### `TrackError(String)` A track could not be read (the text names no URL). ### `MemberJoined(Id)` A member joined the bot's voice channel. ### `MemberLeft(Id)` A member left it. ### `Ended(Option)` The bot's stay ended (left, moved, disconnected, the host or relay went away). ### `QueueEnded` The last track played out with nothing queued (and no loop): the player is idle. Not sent after `stop` or `leave`. ### `AudioLow(u32)` The `audio` stream's buffer fell below its low-water mark: write more. The audio still buffered, in ms. Sent again only after a write. ### `AudioClosed` The `audio` stream closed: drained after `close`, closed at once, or the stay ended. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/enum.VoiceEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-buffered_ms/ --- # Function bindings::zaun::bot::audio::buffered_ms > The audio written and not yet played, in ms (0 without a stream). `zaun_bot::bindings::zaun::bot::audio::buffered_ms` · Function ```rust pub fn buffered_ms() -> u32 ``` The audio written and not yet played, in ms (0 without a stream). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/fn.buffered_ms.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-clear/ --- # Function bindings::zaun::bot::audio::clear > Drops everything buffered at once, keeping the stream open (to interrupt speech). `zaun_bot::bindings::zaun::bot::audio::clear` · Function ```rust pub fn clear() -> Result<(), HostError> ``` Drops everything buffered at once, keeping the stream open (to interrupt speech). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/fn.clear.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-close/ --- # Function bindings::zaun::bot::audio::close > Closes the stream: once the buffer has played (`drain`), or at once. The player resumes. Nothing happens without a stream. `zaun_bot::bindings::zaun::bot::audio::close` · Function ```rust pub fn close(drain: bool) ``` Closes the stream: once the buffer has played (`drain`), or at once. The player resumes. Nothing happens without a stream. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/fn.close.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-open/ --- # Function bindings::zaun::bot::audio::open > Opens the stream in the bot's voice channel, pausing the player. `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take `zaun_bot::bindings::zaun::bot::audio::open` · Function ```rust pub fn open(options: &StreamOptions) -> Result<(), HostError> ``` Opens the stream in the bot's voice channel, pausing the player. `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take; `BAD_REQUEST` for a rate, channel count or low-water mark out of range. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/fn.open.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-write_opus/ --- # Function bindings::zaun::bot::audio::write_opus > Opus packets, for an `opus` stream. Returns the audio buffered, in ms; `BUSY` past 3 s. `zaun_bot::bindings::zaun::bot::audio::write_opus` · Function ```rust pub fn write_opus(packets: &[Vec]) -> Result ``` Opus packets, for an `opus` stream. Returns the audio buffered, in ms; `BUSY` past 3 s. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/fn.write_opus.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-audio-write_pcm/ --- # Function bindings::zaun::bot::audio::write_pcm > Interleaved samples, for a `pcm` stream; any count (the host frames them). Returns the audio buffered, in ms; `BUSY` past 3 s. `zaun_bot::bindings::zaun::bot::audio::write_pcm` · Function ```rust pub fn write_pcm(samples: &[i16]) -> Result ``` Interleaved samples, for a `pcm` stream; any count (the host frames them). Returns the audio buffered, in ms; `BUSY` past 3 s. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/fn.write_pcm.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-commands-set/ --- # Function bindings::zaun::bot::commands::set > Function set in zaun_bot. `zaun_bot::bindings::zaun::bot::commands::set` · Function ```rust pub fn set(commands: &[ApplicationCommand]) -> Result, HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/commands/fn.set.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-add_role/ --- # Function bindings::zaun::bot::community::add_role > `member.roles.update`. `zaun_bot::bindings::zaun::bot::community::add_role` · Function ```rust pub fn add_role(member_id: &str, role_id: &str) -> Result<(), HostError> ``` `member.roles.update`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.add_role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-get_channel/ --- # Function bindings::zaun::bot::community::get_channel > Function get_channel in zaun_bot. `zaun_bot::bindings::zaun::bot::community::get_channel` · Function ```rust pub fn get_channel(channel_id: &str) -> Result ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.get_channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-get_member/ --- # Function bindings::zaun::bot::community::get_member > Needs capability `members` for members the bot has not seen. `zaun_bot::bindings::zaun::bot::community::get_member` · Function ```rust pub fn get_member(member_id: &str) -> Result ``` Needs capability `members` for members the bot has not seen. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.get_member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-get_role/ --- # Function bindings::zaun::bot::community::get_role > Function get_role in zaun_bot. `zaun_bot::bindings::zaun::bot::community::get_role` · Function ```rust pub fn get_role(role_id: &str) -> Result ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.get_role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-kick/ --- # Function bindings::zaun::bot::community::kick > `member.kick`. `zaun_bot::bindings::zaun::bot::community::kick` · Function ```rust pub fn kick(member_id: &str, reason: Option<&str>) -> Result<(), HostError> ``` `member.kick`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.kick.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-list_channels/ --- # Function bindings::zaun::bot::community::list_channels > Function list_channels in zaun_bot. `zaun_bot::bindings::zaun::bot::community::list_channels` · Function ```rust pub fn list_channels() -> Result, HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.list_channels.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-list_members/ --- # Function bindings::zaun::bot::community::list_members > Function list_members in zaun_bot. `zaun_bot::bindings::zaun::bot::community::list_members` · Function ```rust pub fn list_members(after: Option<&str>, limit: u32) -> Result, HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.list_members.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-list_roles/ --- # Function bindings::zaun::bot::community::list_roles > Function list_roles in zaun_bot. `zaun_bot::bindings::zaun::bot::community::list_roles` · Function ```rust pub fn list_roles() -> Result, HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.list_roles.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-remove_role/ --- # Function bindings::zaun::bot::community::remove_role > Function remove_role in zaun_bot. `zaun_bot::bindings::zaun::bot::community::remove_role` · Function ```rust pub fn remove_role(member_id: &str, role_id: &str) -> Result<(), HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.remove_role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-community-timeout/ --- # Function bindings::zaun::bot::community::timeout > `member.timeout`; `none` clears. `zaun_bot::bindings::zaun::bot::community::timeout` · Function ```rust pub fn timeout(member_id: &str, until: Option, reason: Option<&str>) -> Result<(), HostError> ``` `member.timeout`; `none` clears. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/fn.timeout.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-dms-close/ --- # Function bindings::zaun::bot::dms::close > `dm.close`: hides it from the bot's list. `zaun_bot::bindings::zaun::bot::dms::close` · Function ```rust pub fn close(channel_id: &str) -> Result<(), HostError> ``` `dm.close`: hides it from the bot's list. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/dms/fn.close.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-dms-list_open/ --- # Function bindings::zaun::bot::dms::list_open > `dm.list`: the DMs the bot has open. `zaun_bot::bindings::zaun::bot::dms::list_open` · Function ```rust pub fn list_open() -> Result, HostError> ``` `dm.list`: the DMs the bot has open. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/dms/fn.list_open.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-dms-open/ --- # Function bindings::zaun::bot::dms::open > `dm.open`: the DM with `member-id`, created when there is none. `zaun_bot::bindings::zaun::bot::dms::open` · Function ```rust pub fn open(member_id: &str) -> Result ``` `dm.open`: the DM with `member-id`, created when there is none. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/dms/fn.open.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-http-fetch/ --- # Function bindings::zaun::bot::http::fetch > Function fetch in zaun_bot. `zaun_bot::bindings::zaun::bot::http::fetch` · Function ```rust pub fn fetch(req: &Request) -> Result ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/http/fn.fetch.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-delete_original/ --- # Function bindings::zaun::bot::interactions::delete_original > Deletes the original response. `zaun_bot::bindings::zaun::bot::interactions::delete_original` · Function ```rust pub fn delete_original(interaction_id: &str) -> Result<(), HostError> ``` Deletes the original response. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/fn.delete_original.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-edit_original/ --- # Function bindings::zaun::bot::interactions::edit_original > Edits the original response (ends a deferred "thinking" state). `zaun_bot::bindings::zaun::bot::interactions::edit_original` · Function ```rust pub fn edit_original(interaction_id: &str, body: &MessageBody) -> Result<(), HostError> ``` Edits the original response (ends a deferred "thinking" state). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/fn.edit_original.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-followup/ --- # Function bindings::zaun::bot::interactions::followup > A follow-up message, within 15 minutes; at most 10. `zaun_bot::bindings::zaun::bot::interactions::followup` · Function ```rust pub fn followup(interaction_id: &str, body: &MessageBody) -> Result, HostError> ``` A follow-up message, within 15 minutes; at most 10. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/fn.followup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-interactions-respond/ --- # Function bindings::zaun::bot::interactions::respond > The initial response, within 3 s (the runtime defers automatically at 2.5 s). Returns the message id when the response created a channel message. `zaun_bot::bindings::zaun::bot::interactions::respond` · Function ```rust pub fn respond(interaction_id: &str, response: &Response) -> Result, HostError> ``` The initial response, within 3 s (the runtime defers automatically at 2.5 s). Returns the message id when the response created a channel message. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/fn.respond.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-log-write/ --- # Function bindings::zaun::bot::log::write > Function write in zaun_bot. `zaun_bot::bindings::zaun::bot::log::write` · Function ```rust pub fn write(level: Level, message: &str) ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/log/fn.write.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-delete/ --- # Function bindings::zaun::bot::messages::delete > `message.delete`. `zaun_bot::bindings::zaun::bot::messages::delete` · Function ```rust pub fn delete(channel_id: &str, message_id: &str) -> Result<(), HostError> ``` `message.delete`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.delete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-dm/ --- # Function bindings::zaun::bot::messages::dm > A direct message to member `member-id` (capability `dms`): opens the DM when needed, then sends. Returns the DM's channel id and the message id. `zaun_bot::bindings::zaun::bot::messages::dm` · Function ```rust pub fn dm(member_id: &str, body: &MessageBody) -> Result<(Id, Id), HostError> ``` A direct message to member `member-id` (capability `dms`): opens the DM when needed, then sends. Returns the DM's channel id and the message id. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.dm.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-edit/ --- # Function bindings::zaun::bot::messages::edit > `message.edit` of one of the bot's messages. `zaun_bot::bindings::zaun::bot::messages::edit` · Function ```rust pub fn edit(channel_id: &str, message_id: &str, body: &MessageBody) -> Result<(), HostError> ``` `message.edit` of one of the bot's messages. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.edit.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-history/ --- # Function bindings::zaun::bot::messages::history > `message.history`: up to `limit` (1-100) messages before `before`. `zaun_bot::bindings::zaun::bot::messages::history` · Function ```rust pub fn history(channel_id: &str, before: Option, limit: u32) -> Result, HostError> ``` `message.history`: up to `limit` (1-100) messages before `before`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.history.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-react/ --- # Function bindings::zaun::bot::messages::react > `reaction.add`. `zaun_bot::bindings::zaun::bot::messages::react` · Function ```rust pub fn react(channel_id: &str, message_id: &str, emoji: &str) -> Result<(), HostError> ``` `reaction.add`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.react.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-send/ --- # Function bindings::zaun::bot::messages::send > `message.send`. Returns the new message id. `zaun_bot::bindings::zaun::bot::messages::send` · Function ```rust pub fn send(channel_id: &str, body: &MessageBody, reply_to: Option<&str>) -> Result ``` `message.send`. Returns the new message id. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.send.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-unreact/ --- # Function bindings::zaun::bot::messages::unreact > `reaction.remove` of the bot's own reaction. `zaun_bot::bindings::zaun::bot::messages::unreact` · Function ```rust pub fn unreact(channel_id: &str, message_id: &str, emoji: &str) -> Result<(), HostError> ``` `reaction.remove` of the bot's own reaction. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.unreact.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-messages-upload/ --- # Function bindings::zaun::bot::messages::upload > Uploads a file for the bot's next message (capability `attachments`). Returns the attachment id to put in `message-body.attachments`. `zaun_bot::bindings::zaun::bot::messages::upload` · Function ```rust pub fn upload(channel_id: &str, name: &str, mime: &str, bytes: &[u8]) -> Result ``` Uploads a file for the bot's next message (capability `attachments`). Returns the attachment id to put in `message-body.attachments`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/fn.upload.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-presence-set/ --- # Function bindings::zaun::bot::presence::set > Sets the bot's status and activity (`signal.presence`). The host shows changes at most every 3 s: a later call within that time replaces an earlier one that has not gone out. The b `zaun_bot::bindings::zaun::bot::presence::set` · Function ```rust pub fn set(status: Status, activity: Option<&Activity>) ``` Sets the bot's status and activity (`signal.presence`). The host shows changes at most every 3 s: a later call within that time replaces an earlier one that has not gone out. The bot is `online` without an activity when it starts. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/presence/fn.set.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-presence-set_status_text/ --- # Function bindings::zaun::bot::presence::set_status_text > Sets the custom status text and emoji (`member.status.set`), kept until `expires-at` (or changed); `none` for both clears it. `zaun_bot::bindings::zaun::bot::presence::set_status_text` · Function ```rust pub fn set_status_text(text: Option<&str>, emoji: Option<&str>, expires_at: Option) -> Result<(), HostError> ``` Sets the custom status text and emoji (`member.status.set`), kept until `expires-at` (or changed); `none` for both clears it. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/presence/fn.set_status_text.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-delete/ --- # Function bindings::zaun::bot::storage::delete > Function delete in zaun_bot. `zaun_bot::bindings::zaun::bot::storage::delete` · Function ```rust pub fn delete(key: &str) -> Result<(), HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/storage/fn.delete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-get/ --- # Function bindings::zaun::bot::storage::get > Function get in zaun_bot. `zaun_bot::bindings::zaun::bot::storage::get` · Function ```rust pub fn get(key: &str) -> Result>, HostError> ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/storage/fn.get.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-list_keys/ --- # Function bindings::zaun::bot::storage::list_keys > Keys starting with `prefix`, in order, after `after`, at most `limit` (≤ 1000). `zaun_bot::bindings::zaun::bot::storage::list_keys` · Function ```rust pub fn list_keys(prefix: &str, after: Option<&str>, limit: u32) -> Result, HostError> ``` Keys starting with `prefix`, in order, after `after`, at most `limit` (≤ 1000). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/storage/fn.list_keys.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-storage-set/ --- # Function bindings::zaun::bot::storage::set > `QUOTA_EXCEEDED` when the grant is used up. `zaun_bot::bindings::zaun::bot::storage::set` · Function ```rust pub fn set(key: &str, value: &[u8]) -> Result<(), HostError> ``` `QUOTA_EXCEEDED` when the grant is used up. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/storage/fn.set.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-timers-after/ --- # Function bindings::zaun::bot::timers::after > Fires once after `ms`. `zaun_bot::bindings::zaun::bot::timers::after` · Function ```rust pub fn after(ms: u64, tag: &str) -> Result ``` Fires once after `ms`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/timers/fn.after.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-timers-cancel/ --- # Function bindings::zaun::bot::timers::cancel > Function cancel in zaun_bot. `zaun_bot::bindings::zaun::bot::timers::cancel` · Function ```rust pub fn cancel(id: u64) ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/timers/fn.cancel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-timers-every/ --- # Function bindings::zaun::bot::timers::every > Fires every `ms` (≥ 1000). `zaun_bot::bindings::zaun::bot::timers::every` · Function ```rust pub fn every(ms: u64, tag: &str) -> Result ``` Fires every `ms` (≥ 1000). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/timers/fn.every.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-clear_queue/ --- # Function bindings::zaun::bot::voice::clear_queue > Empties the queue; the current track keeps playing. `zaun_bot::bindings::zaun::bot::voice::clear_queue` · Function ```rust pub fn clear_queue() -> Result<(), HostError> ``` Empties the queue; the current track keeps playing. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.clear_queue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-end_stream/ --- # Function bindings::zaun::bot::voice::end_stream > The `pushed` track ends once its buffered packets have played. `zaun_bot::bindings::zaun::bot::voice::end_stream` · Function ```rust pub fn end_stream() ``` The `pushed` track ends once its buffered packets have played. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.end_stream.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-enqueue/ --- # Function bindings::zaun::bot::voice::enqueue > Adds `track` to the queue (≤ 100); returns the queue's length. `zaun_bot::bindings::zaun::bot::voice::enqueue` · Function ```rust pub fn enqueue(track: &Track) -> Result ``` Adds `track` to the queue (≤ 100); returns the queue's length. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.enqueue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-join/ --- # Function bindings::zaun::bot::voice::join > Joins voice channel `channel` (leaving another one first). Returns once media can flow (at most about 10 s). `FORBIDDEN` without `voice`, `CONNECT` or `SPEAK`. `zaun_bot::bindings::zaun::bot::voice::join` · Function ```rust pub fn join(channel: &str) -> Result<(), HostError> ``` Joins voice channel `channel` (leaving another one first). Returns once media can flow (at most about 10 s). `FORBIDDEN` without `voice`, `CONNECT` or `SPEAK`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.join.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-leave/ --- # Function bindings::zaun::bot::voice::leave > Leaves; playback stops and the queue is cleared. `zaun_bot::bindings::zaun::bot::voice::leave` · Function ```rust pub fn leave() ``` Leaves; playback stops and the queue is cleared. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.leave.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-move_/ --- # Function bindings::zaun::bot::voice::move_ > Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. `NOT_FOUND` past the end. `zaun_bot::bindings::zaun::bot::voice::move_` · Function ```rust pub fn move_(from: u32, to: u32) -> Result<(), HostError> ``` Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. `NOT_FOUND` past the end. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.move_.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-pause/ --- # Function bindings::zaun::bot::voice::pause > Function pause in zaun_bot. `zaun_bot::bindings::zaun::bot::voice::pause` · Function ```rust pub fn pause() ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.pause.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-play/ --- # Function bindings::zaun::bot::voice::play > Plays `track` now, replacing the current one; the queue stays. `zaun_bot::bindings::zaun::bot::voice::play` · Function ```rust pub fn play(track: &Track) -> Result<(), HostError> ``` Plays `track` now, replacing the current one; the queue stays. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.play.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-push/ --- # Function bindings::zaun::bot::voice::push > Opus packets (2.5 to 120 ms each, ≤ 1000 bytes) for the current `pushed` track. Returns the audio buffered, in ms; `BUSY` past 3 s, so push about as fast as it plays. `zaun_bot::bindings::zaun::bot::voice::push` · Function ```rust pub fn push(packets: &[Vec]) -> Result ``` Opus packets (2.5 to 120 ms each, ≤ 1000 bytes) for the current `pushed` track. Returns the audio buffered, in ms; `BUSY` past 3 s, so push about as fast as it plays. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.push.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-remove/ --- # Function bindings::zaun::bot::voice::remove > Removes the queued track at `index` (0 plays next); returns its title. `NOT_FOUND` past the end. `zaun_bot::bindings::zaun::bot::voice::remove` · Function ```rust pub fn remove(index: u32) -> Result, HostError> ``` Removes the queued track at `index` (0 plays next); returns its title. `NOT_FOUND` past the end. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.remove.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-resume/ --- # Function bindings::zaun::bot::voice::resume > Function resume in zaun_bot. `zaun_bot::bindings::zaun::bot::voice::resume` · Function ```rust pub fn resume() ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.resume.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-seek/ --- # Function bindings::zaun::bot::voice::seek > Jumps to `ms` into the current track (past the end: the track ends). `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. `zaun_bot::bindings::zaun::bot::voice::seek` · Function ```rust pub fn seek(ms: u64) -> Result<(), HostError> ``` Jumps to `ms` into the current track (past the end: the track ends). `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.seek.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-set_loop/ --- # Function bindings::zaun::bot::voice::set_loop > Sets what happens when a track ends (`off` when the bot joins). `zaun_bot::bindings::zaun::bot::voice::set_loop` · Function ```rust pub fn set_loop(mode: LoopMode) -> Result<(), HostError> ``` Sets what happens when a track ends (`off` when the bot joins). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.set_loop.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-set_volume/ --- # Function bindings::zaun::bot::voice::set_volume > Sets the playback volume, 0-200 % (100 when the bot joins; `BAD_REQUEST` above 200). Changing it means decoding and re-encoding the Opus audio, so hosts without an Opus encoder ans `zaun_bot::bindings::zaun::bot::voice::set_volume` · Function ```rust pub fn set_volume(percent: u16) -> Result<(), HostError> ``` Sets the playback volume, 0-200 % (100 when the bot joins; `BAD_REQUEST` above 200). Changing it means decoding and re-encoding the Opus audio, so hosts without an Opus encoder answer `UNSUPPORTED`: call it anyway and tell the member. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.set_volume.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-shuffle/ --- # Function bindings::zaun::bot::voice::shuffle > Puts the queue in a random order (the current track keeps playing). `zaun_bot::bindings::zaun::bot::voice::shuffle` · Function ```rust pub fn shuffle() -> Result<(), HostError> ``` Puts the queue in a random order (the current track keeps playing). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.shuffle.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-skip/ --- # Function bindings::zaun::bot::voice::skip > Ends the current track; the next one starts. `zaun_bot::bindings::zaun::bot::voice::skip` · Function ```rust pub fn skip() ``` Ends the current track; the next one starts. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.skip.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-state/ --- # Function bindings::zaun::bot::voice::state > Where the bot is and what it plays. `zaun_bot::bindings::zaun::bot::voice::state` · Function ```rust pub fn state() -> VoiceState ``` Where the bot is and what it plays. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.state.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-bindings-zaun-bot-voice-stop/ --- # Function bindings::zaun::bot::voice::stop > Ends the current track and clears the queue. `zaun_bot::bindings::zaun::bot::voice::stop` · Function ```rust pub fn stop() ``` Ends the current track and clears the queue. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/fn.stop.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-dispatch/ --- # Function dispatch > Calls the `Bot` handler for `event`. `zaun_bot::dispatch` · Function ```rust pub fn dispatch(bot: &mut B, ctx: EventContext, event: Event) ``` Calls the `Bot` handler for `event`. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/events/fn.dispatch.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-mention-is_id/ --- # Function mention::is_id > Whether `id` is a well-formed Zaun id: 16 bytes in unpadded base64url (22 characters, the last one of `A`, `Q`, `g`, `w`). `zaun_bot::mention::is_id` · Function ```rust pub fn is_id(id: &str) -> bool ``` Whether `id` is a well-formed Zaun id: 16 bytes in unpadded base64url (22 characters, the last one of `A`, `Q`, `g`, `w`). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/fn.is_id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-mention-member/ --- # Function mention::member > The text that shows a member mention: `<@id>` (discord.js `userMention`). `zaun_bot::mention::member` · Function ```rust pub fn member(id: &str) -> String ``` The text that shows a member mention: `<@id>` (discord.js `userMention`). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/fn.member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-mention-none/ --- # Function mention::none > No mentions. `zaun_bot::mention::none` · Function ```rust pub fn none() -> Mentions ``` No mentions. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/fn.none.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-mention-parse/ --- # Function mention::parse > The mentions `content` shows: `<@id>` (and Discord's `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most `MAX_MEMBERS` members and `MAX_ROLES` r `zaun_bot::mention::parse` · Function ```rust pub fn parse(content: &str) -> Mentions ``` The mentions `content` shows: `<@id>` (and Discord's `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most `MAX_MEMBERS` members and `MAX_ROLES` roles; malformed ids are skipped. Use it only on text the bot wrote: on text from members it would mention whoever they named. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/fn.parse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-mention-role/ --- # Function mention::role > The text that shows a role mention: `<@&id>` (discord.js `roleMention`). `zaun_bot::mention::role` · Function ```rust pub fn role(id: &str) -> String ``` The text that shows a role mention: `<@&id>` (discord.js `roleMention`). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/mention/fn.role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-presence-clear_status/ --- # Function presence::clear_status > Clears the custom status. `zaun_bot::presence::clear_status` · Function ```rust pub fn clear_status() -> Result<(), HostError> ``` Clears the custom status. # Errors The host's refusal. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/presence/fn.clear_status.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-presence-set/ --- # Function presence::set > Sets the bot's status and activity (`None`: no activity). `zaun_bot::presence::set` · Function ```rust pub fn set>>(status: Status, activity: impl Into>) ``` Sets the bot's status and activity (`None`: no activity). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/presence/fn.set.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-presence-set_status/ --- # Function presence::set_status > Sets the custom status text and emoji, cleared by the host at `expires_at` (ms) if given. `zaun_bot::presence::set_status` · Function ```rust pub fn set_status(text: Option<&str>, emoji: Option<&str>, expires_at: Option) -> Result<(), HostError> ``` Sets the custom status text and emoji, cleared by the host at `expires_at` (ms) if given. # Errors The host's refusal. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/presence/fn.set_status.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-presence-set_status_text/ --- # Function presence::set_status_text > Sets the custom status text, kept until changed. `zaun_bot::presence::set_status_text` · Function ```rust pub fn set_status_text>(text: impl Into) -> Result<(), HostError> ``` Sets the custom status text, kept until changed. # Errors The host's refusal (too long, rate limited). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/presence/fn.set_status_text.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/function-text_choice/ --- # Function text_choice > A text `Choice` (autocomplete results and fixed choices). `zaun_bot::text_choice` · Function ```rust pub fn text_choice, impl Into>(name: impl Into, value: impl Into) -> Choice ``` A text `Choice` (autocomplete results and fixed choices). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/options/fn.text_choice.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/macro-export_bot/ --- # Macro export_bot > Exports a `Bot` type as the component's `zaun:bot/bot` implementation. `zaun_bot::export_bot` · Macro ```rust macro_rules! export_bot { … } ``` Exports a `Bot` type as the component's `zaun:bot/bot` implementation. The type must implement `Bot` (and so `Default`). Use it once, in the bot crate's root. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/macro.export_bot.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/macro-log_info/ --- # Macro log_info > Writes an `info` line to the bot's log (`zaun-host bot logs`). `zaun_bot::log_info` · Macro ```rust macro_rules! log_info { … } ``` Writes an `info` line to the bot's log (`zaun-host bot logs`). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/macro.log_info.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-actionrow/ --- # Struct ActionRow > Builds a types::ActionRow: up to 5 buttons, or one select. `zaun_bot::ActionRow` · Struct ```rust pub struct ActionRow(…) ``` Builds a [`types::ActionRow`]: up to 5 buttons, or one select. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty row. ### `buttons` ```rust pub fn buttons>(buttons: impl IntoIterator) -> Self ``` A row of buttons. ### `select` ```rust pub fn select(select: Select) -> Self ``` A row holding one select. ### `button` ```rust pub fn button(self, button: Button) -> Self ``` Adds a button. ### `build` ```rust pub fn build(self) -> ActionRow ``` The finished row. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/select/struct.ActionRow.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-audio/ --- # Struct Audio > The bot's audio output stream. `zaun_bot::Audio` · Struct ```rust pub struct Audio ``` The bot's audio output stream. ## Methods ### `open` ```rust pub fn open(options: &StreamOptions) -> Result<(), HostError> ``` Opens the stream with every option. # Errors `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take; `BAD_REQUEST` for values out of range. ### `open_opus` ```rust pub fn open_opus(title: Option<&str>) -> Result<(), HostError> ``` Opens a stream of Opus packets the bot encodes (`Audio::write_opus`). # Errors As `Audio::open`. ### `open_pcm` ```rust pub fn open_pcm(sample_rate: u32, channels: u8, title: Option<&str>) -> Result<(), HostError> ``` Opens a stream of 16-bit PCM (`Audio::write_pcm`) at `sample_rate` (8000, 12000, 16000, 24000 or 48000) with 1 or 2 interleaved channels; the host encodes it. # Errors As `Audio::open`; `UNSUPPORTED` on hosts without an Opus encoder. ### `write_opus` ```rust pub fn write_opus(packets: &[Vec]) -> Result ``` Writes Opus packets (2.5–120 ms each, ≤ 1000 bytes); returns the ms buffered. # Errors `BUSY` past 3 s buffered (write again on `AudioLow`); `CONFLICT` without an `opus` stream. ### `write_pcm` ```rust pub fn write_pcm(samples: &[i16]) -> Result ``` Writes interleaved samples, any count; returns the ms buffered. # Errors `BUSY` past 3 s buffered (write again on `AudioLow`); `CONFLICT` without a `pcm` stream. ### `buffered_ms` ```rust pub fn buffered_ms() -> u32 ``` The audio written and not yet played, in ms (0 without a stream). ### `clear` ```rust pub fn clear() -> Result<(), HostError> ``` Drops everything buffered at once; the stream stays open. # Errors `CONFLICT` without a stream. ### `close` ```rust pub fn close(drain: bool) ``` Closes the stream, after the buffer has played (`drain`) or at once; the player resumes. `VoiceEvent::AudioClosed` follows. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/audio/struct.Audio.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-audio-pcmformat/ --- # Struct audio::PcmFormat > PCM the host encodes to Opus. `zaun_bot::audio::PcmFormat` · Struct ```rust pub struct PcmFormat { … } ``` PCM the host encodes to Opus. ## Fields ### `sample_rate: u32` 8000, 12000, 16000, 24000 or 48000 Hz (Opus's own rates; nothing is resampled). ### `channels: u8` 1 (mono) or 2 (stereo, interleaved left-right). ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/struct.PcmFormat.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-audio-streamoptions/ --- # Struct audio::StreamOptions > Struct StreamOptions in zaun_bot. `zaun_bot::audio::StreamOptions` · Struct ```rust pub struct StreamOptions { … } ``` ## Fields ### `format: AudioFormat` ### `low_water_ms: Option` Send `audio-low` when less than this is buffered, in ms (20-2000; default 200). ### `title: Option` Shown as the current title in `voice-state` while the stream plays. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/struct.StreamOptions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-http-request/ --- # Struct bindings::zaun::bot::http::Request > Struct Request in zaun_bot. `zaun_bot::bindings::zaun::bot::http::Request` · Struct ```rust pub struct Request { … } ``` ## Fields ### `method: String` ### `url: String` ### `headers: Vec<(String, String)>` ### `body: Option>` ### `timeout_ms: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/http/struct.Request.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-http-response/ --- # Struct bindings::zaun::bot::http::Response > Struct Response in zaun_bot. `zaun_bot::bindings::zaun::bot::http::Response` · Struct ```rust pub struct Response { … } ``` ## Fields ### `status: u16` ### `headers: Vec<(String, String)>` ### `body: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/http/struct.Response.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-actionrow/ --- # Struct bindings::zaun::bot::types::ActionRow > Type 1: up to 5 buttons, or one select. `zaun_bot::bindings::zaun::bot::types::ActionRow` · Struct ```rust pub struct ActionRow { … } ``` Type 1: up to 5 buttons, or one select. ## Fields ### `id: Option` ### `components: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ActionRow.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-activity/ --- # Struct bindings::zaun::bot::types::Activity > What a member (or the bot) is doing. `zaun_bot::bindings::zaun::bot::types::Activity` · Struct ```rust pub struct Activity { … } ``` What a member (or the bot) is doing. ## Fields ### `kind: ActivityType` ### `name: String` 1-128 characters. ### `details: Option` <= 128: e.g. the track. ### `state: Option` <= 128: e.g. the artist. ### `url: Option` `streaming` only: an `https://` link (open only after the reader confirms). ### `started_at: Option` When it started, ms since the epoch. ### `emoji: Option` `custom` only: a Unicode emoji. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Activity.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-attachment/ --- # Struct bindings::zaun::bot::types::Attachment > Struct Attachment in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Attachment` · Struct ```rust pub struct Attachment { … } ``` ## Fields ### `attachment_id: Id` ### `name: String` ### `size: u64` ### `mime: String` ### `sha3_256: String` base64url SHA3-256. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Attachment.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-button/ --- # Struct bindings::zaun::bot::types::Button > Type 2. `zaun_bot::bindings::zaun::bot::types::Button` · Struct ```rust pub struct Button { … } ``` Type 2. ## Fields ### `id: Option` ### `style: ButtonStyle` ### `label: Option` ### `emoji: Option` A Unicode emoji. ### `custom_id: Option` Styles 1-4. ### `url: Option` Style 5 only: an `https://` link, opened after the reader confirms. ### `disabled: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Button.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-checkbox/ --- # Struct bindings::zaun::bot::types::Checkbox > Type 23. `zaun_bot::bindings::zaun::bot::types::Checkbox` · Struct ```rust pub struct Checkbox { … } ``` Type 23. ## Fields ### `id: Option` ### `custom_id: String` ### `is_default: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Checkbox.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-checkboxgroup/ --- # Struct bindings::zaun::bot::types::CheckboxGroup > Type 22: 1-10 options. `zaun_bot::bindings::zaun::bot::types::CheckboxGroup` · Struct ```rust pub struct CheckboxGroup { … } ``` Type 22: 1-10 options. ## Fields ### `id: Option` ### `custom_id: String` ### `options: Vec` ### `min_values: Option` ### `max_values: Option` ### `required: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.CheckboxGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-choiceoption/ --- # Struct bindings::zaun::bot::types::ChoiceOption > Struct ChoiceOption in zaun_bot. `zaun_bot::bindings::zaun::bot::types::ChoiceOption` · Struct ```rust pub struct ChoiceOption { … } ``` ## Fields ### `label: String` ### `value: String` ### `description: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ChoiceOption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-commandoption/ --- # Struct bindings::zaun::bot::types::CommandOption > Struct CommandOption in zaun_bot. `zaun_bot::bindings::zaun::bot::types::CommandOption` · Struct ```rust pub struct CommandOption { … } ``` ## Fields ### `kind: OptionKind` ### `name: String` ### `name_localizations: Vec` ### `description: String` ### `description_localizations: Vec` ### `required: bool` ### `choices: Vec` ### `channel_types: Vec` ### `min_value: Option` ### `max_value: Option` ### `min_length: Option` ### `max_length: Option` ### `autocomplete: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.CommandOption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-communityprofile/ --- # Struct bindings::zaun::bot::types::CommunityProfile > Struct CommunityProfile in zaun_bot. `zaun_bot::bindings::zaun::bot::types::CommunityProfile` · Struct ```rust pub struct CommunityProfile { … } ``` ## Fields ### `system_channel_id: Option` ### `default_slowmode_s: u32` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.CommunityProfile.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-container/ --- # Struct bindings::zaun::bot::types::Container > Type 17. `zaun_bot::bindings::zaun::bot::types::Container` · Struct ```rust pub struct Container { … } ``` Type 17. ## Fields ### `id: Option` ### `components: Vec` ### `accent_color: Option` ### `spoiler: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Container.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-defaultvalue/ --- # Struct bindings::zaun::bot::types::DefaultValue > Struct DefaultValue in zaun_bot. `zaun_bot::bindings::zaun::bot::types::DefaultValue` · Struct ```rust pub struct DefaultValue { … } ``` ## Fields ### `id: Id` ### `kind: DefaultValueKind` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.DefaultValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embed/ --- # Struct bindings::zaun::bot::types::Embed > Struct Embed in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Embed` · Struct ```rust pub struct Embed { … } ``` ## Fields ### `title: Option` ### `description: Option` ### `url: Option` `https://` only. ### `color: Option` ### `timestamp: Option` ### `author: Option` ### `footer: Option` ### `image: Option` Attachment ids of the same message, never URLs. ### `thumbnail: Option` ### `fields: Vec` ## Trait implementations `Clone`, `Debug`, `From` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Embed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embedauthor/ --- # Struct bindings::zaun::bot::types::EmbedAuthor > embeds `zaun_bot::bindings::zaun::bot::types::EmbedAuthor` · Struct ```rust pub struct EmbedAuthor { … } ``` ---- embeds ---------------------------------------------------------------- ## Fields ### `name: String` ### `url: Option` ### `icon: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.EmbedAuthor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embedfield/ --- # Struct bindings::zaun::bot::types::EmbedField > Struct EmbedField in zaun_bot. `zaun_bot::bindings::zaun::bot::types::EmbedField` · Struct ```rust pub struct EmbedField { … } ``` ## Fields ### `name: String` ### `value: String` ### `inline: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.EmbedField.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-embedfooter/ --- # Struct bindings::zaun::bot::types::EmbedFooter > Struct EmbedFooter in zaun_bot. `zaun_bot::bindings::zaun::bot::types::EmbedFooter` · Struct ```rust pub struct EmbedFooter { … } ``` ## Fields ### `text: String` ### `icon: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.EmbedFooter.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-entityselect/ --- # Struct bindings::zaun::bot::types::EntitySelect > Struct EntitySelect in zaun_bot. `zaun_bot::bindings::zaun::bot::types::EntitySelect` · Struct ```rust pub struct EntitySelect { … } ``` ## Fields ### `id: Option` ### `kind: EntityKind` ### `custom_id: String` ### `placeholder: Option` ### `min_values: Option` ### `max_values: Option` ### `default_values: Vec` ### `channel_types: Vec` Channel select only. ### `required: Option` ### `disabled: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.EntitySelect.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-file/ --- # Struct bindings::zaun::bot::types::File > Type 13. `zaun_bot::bindings::zaun::bot::types::File` · Struct ```rust pub struct File { … } ``` Type 13. ## Fields ### `id: Option` ### `file: Id` ### `spoiler: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.File.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-fileupload/ --- # Struct bindings::zaun::bot::types::FileUpload > Type 19. `zaun_bot::bindings::zaun::bot::types::FileUpload` · Struct ```rust pub struct FileUpload { … } ``` Type 19. ## Fields ### `id: Option` ### `custom_id: String` ### `min_values: Option` ### `max_values: Option` ### `required: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.FileUpload.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-interaction/ --- # Struct bindings::zaun::bot::types::Interaction > Struct Interaction in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Interaction` · Struct ```rust pub struct Interaction { … } ``` ## Fields ### `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` ### `message: Option` For component interactions: the message holding the component. ### `data: InteractionData` ### `created_at: Timestamp` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Interaction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-interactionmetadata/ --- # Struct bindings::zaun::bot::types::InteractionMetadata > Struct InteractionMetadata in zaun_bot. `zaun_bot::bindings::zaun::bot::types::InteractionMetadata` · Struct ```rust pub struct InteractionMetadata { … } ``` ## Fields ### `interaction_id: Id` ### `kind: u8` ### `name: Option` ### `member_id: Id` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.InteractionMetadata.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-label/ --- # Struct bindings::zaun::bot::types::Label > Type 18. `zaun_bot::bindings::zaun::bot::types::Label` · Struct ```rust pub struct Label { … } ``` Type 18. ## Fields ### `id: Option` ### `label: String` ### `description: Option` ### `component: LabelChild` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Label.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-localized/ --- # Struct bindings::zaun::bot::types::Localized > Struct Localized in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Localized` · Struct ```rust pub struct Localized { … } ``` ## Fields ### `locale: String` ### `text: String` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Localized.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-mediagallery/ --- # Struct bindings::zaun::bot::types::MediaGallery > Type 12: 1-10 items. `zaun_bot::bindings::zaun::bot::types::MediaGallery` · Struct ```rust pub struct MediaGallery { … } ``` Type 12: 1-10 items. ## Fields ### `id: Option` ### `items: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MediaGallery.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-mediaitem/ --- # Struct bindings::zaun::bot::types::MediaItem > Struct MediaItem in zaun_bot. `zaun_bot::bindings::zaun::bot::types::MediaItem` · Struct ```rust pub struct MediaItem { … } ``` ## Fields ### `media: Id` ### `description: Option` ### `spoiler: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MediaItem.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-memberroles/ --- # Struct bindings::zaun::bot::types::MemberRoles > Struct MemberRoles in zaun_bot. `zaun_bot::bindings::zaun::bot::types::MemberRoles` · Struct ```rust pub struct MemberRoles { … } ``` ## Fields ### `member_id: Id` ### `role_ids: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MemberRoles.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-membertimeout/ --- # Struct bindings::zaun::bot::types::MemberTimeout > `until` is `none` when the timeout was cleared. `zaun_bot::bindings::zaun::bot::types::MemberTimeout` · Struct ```rust pub struct MemberTimeout { … } ``` `until` is `none` when the timeout was cleared. ## Fields ### `member_id: Id` ### `until: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MemberTimeout.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messagebody/ --- # Struct bindings::zaun::bot::types::MessageBody > What a bot sends: `message.send`, responses, follow-ups and edits. `zaun_bot::bindings::zaun::bot::types::MessageBody` · Struct ```rust pub struct MessageBody { … } ``` What a bot sends: `message.send`, responses, follow-ups and edits. ## Fields ### `content: Option` ### `embeds: Vec` ### `components: Vec` ### `attachments: Vec` Attachment ids the bot uploaded (`messages.upload`). ### `mentions: Option` ### `flags: MessageFlags` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MessageBody.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messagedeleted/ --- # Struct bindings::zaun::bot::types::MessageDeleted > Struct MessageDeleted in zaun_bot. `zaun_bot::bindings::zaun::bot::types::MessageDeleted` · Struct ```rust pub struct MessageDeleted { … } ``` ## Fields ### `channel_id: Id` ### `message_id: Id` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MessageDeleted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messageevent/ --- # Struct bindings::zaun::bot::types::MessageEvent > A message, and whether it is in a direct-message channel with the bot. `zaun_bot::bindings::zaun::bot::types::MessageEvent` · Struct ```rust pub struct MessageEvent { … } ``` A message, and whether it is in a direct-message channel with the bot. ## Fields ### `message: Message` ### `is_dm: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MessageEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messageflags/ --- # Struct bindings::zaun::bot::types::MessageFlags > messages Discord's values: 4, 64, 4096, 32768. `LOADING` is host-set only. `zaun_bot::bindings::zaun::bot::types::MessageFlags` · Struct ```rust pub struct MessageFlags(…) ``` ---- messages ------------------------------------------------------- Discord's values: 4, 64, 4096, 32768. `LOADING` is host-set only. ## Methods ### `empty` ```rust pub const fn empty() -> Self ``` Get a flags value with all bits unset. ### `all` ```rust pub const fn all() -> Self ``` Get a flags value with all known bits set. ### `bits` ```rust pub const fn bits(&self) -> u8 ``` Get the underlying bits value. The returned value is exactly the bits set in this flags value. ### `from_bits` ```rust pub const fn from_bits(bits: u8) -> Option ``` Convert from a bits value. This method will return `None` if any unknown bits are set. ### `from_bits_truncate` ```rust pub const fn from_bits_truncate(bits: u8) -> Self ``` Convert from a bits value, unsetting any unknown bits. ### `from_bits_retain` ```rust pub const fn from_bits_retain(bits: u8) -> Self ``` Convert from a bits value exactly. ### `from_name` ```rust pub fn from_name(name: &str) -> Option ``` Get a flags value with the bits of a flag with the given name set. This method will return `None` if `name` is empty or doesn't correspond to any named flag. ### `is_empty` ```rust pub const fn is_empty(&self) -> bool ``` Whether all bits in `self` are unset. ### `is_all` ```rust pub const fn is_all(&self) -> bool ``` Whether all known bits in this flags value are set. ### `intersects` ```rust pub const fn intersects(&self, other: Self) -> bool ``` Whether any set bits in `other` are also set in `self`. ### `contains` ```rust pub const fn contains(&self, other: Self) -> bool ``` Whether all set bits in `other` are also set in `self`. ### `insert` ```rust pub fn insert(&mut self, other: Self) ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `remove` ```rust pub fn remove(&mut self, other: Self) ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `remove` won't truncate `other`, but the `!` operator will. ### `toggle` ```rust pub fn toggle(&mut self, other: Self) ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `set` ```rust pub fn set(&mut self, other: Self, value: bool) ``` Call `insert` when `value` is `true` or `remove` when `value` is `false`. ### `intersection` ```rust pub const fn intersection(self, other: Self) -> Self ``` The bitwise and (`&`) of the bits in `self` and `other`. ### `union` ```rust pub const fn union(self, other: Self) -> Self ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `difference` ```rust pub const fn difference(self, other: Self) -> Self ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `difference` won't truncate `other`, but the `!` operator will. ### `symmetric_difference` ```rust pub const fn symmetric_difference(self, other: Self) -> Self ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `complement` ```rust pub const fn complement(self) -> Self ``` The bitwise negation (`!`) of the bits in `self`, truncating the result. ### `iter` ```rust pub const fn iter(&self) -> Iter ``` Yield a set of contained flags values. Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value. ### `iter_names` ```rust pub const fn iter_names(&self) -> IterNames ``` Yield a set of contained named flags values. This method is like [`iter`](#method.iter), except only yields bits in contained named flags. Any unknown bits, or bits not corresponding to a contained flag will not be yielded. ## Trait implementations `Binary`, `BitAnd`, `BitAndAssign`, `BitOr`, `BitOrAssign`, `BitXor`, `BitXorAssign`, `Clone`, `Copy`, `Debug`, `Eq`, `Extend`, `Flags`, `FromIterator`, `Hash`, `IntoIterator`, `LowerHex`, `Not`, `Octal`, `Ord`, `PartialEq`, `PartialOrd`, `PublicFlags`, `StructuralPartialEq`, `Sub`, `SubAssign`, `UpperHex` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MessageFlags.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-messagesdeleted/ --- # Struct bindings::zaun::bot::types::MessagesDeleted > Struct MessagesDeleted in zaun_bot. `zaun_bot::bindings::zaun::bot::types::MessagesDeleted` · Struct ```rust pub struct MessagesDeleted { … } ``` ## Fields ### `channel_id: Id` ### `message_ids: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.MessagesDeleted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-modal/ --- # Struct bindings::zaun::bot::types::Modal > Struct Modal in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Modal` · Struct ```rust pub struct Modal { … } ``` ## Fields ### `custom_id: String` ### `title: String` ### `components: Vec` ## Trait implementations `Clone`, `Debug`, `From` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Modal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-modalvalue/ --- # Struct bindings::zaun::bot::types::ModalValue > Struct ModalValue in zaun_bot. `zaun_bot::bindings::zaun::bot::types::ModalValue` · Struct ```rust pub struct ModalValue { … } ``` ## Fields ### `id: Option` ### `custom_id: String` ### `component_type: u8` ### `value: Option` ### `values: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ModalValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-presence/ --- # Struct bindings::zaun::bot::types::Presence > `status`: `online`, `idle`, `dnd` or `offline` (invisible members look offline). `zaun_bot::bindings::zaun::bot::types::Presence` · Struct ```rust pub struct Presence { … } ``` `status`: `online`, `idle`, `dnd` or `offline` (invisible members look offline). ## Fields ### `member_id: Id` ### `status: String` ### `activity: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Presence.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-radiogroup/ --- # Struct bindings::zaun::bot::types::RadioGroup > Type 21: 2-10 options. `zaun_bot::bindings::zaun::bot::types::RadioGroup` · Struct ```rust pub struct RadioGroup { … } ``` Type 21: 2-10 options. ## Fields ### `id: Option` ### `custom_id: String` ### `options: Vec` ### `required: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.RadioGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-rawevent/ --- # Struct bindings::zaun::bot::types::RawEvent > Struct RawEvent in zaun_bot. `zaun_bot::bindings::zaun::bot::types::RawEvent` · Struct ```rust pub struct RawEvent { … } ``` ## Fields ### `kind: String` ### `json: String` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.RawEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-receivedoption/ --- # Struct bindings::zaun::bot::types::ReceivedOption > One option the invoker filled in, with the sub-command path flattened onto the data. `zaun_bot::bindings::zaun::bot::types::ReceivedOption` · Struct ```rust pub struct ReceivedOption { … } ``` One option the invoker filled in, with the sub-command path flattened onto the data. ## Fields ### `name: String` ### `kind: OptionKind` ### `value: OptionValue` ### `focused: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ReceivedOption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-registeredcommand/ --- # Struct bindings::zaun::bot::types::RegisteredCommand > Struct RegisteredCommand in zaun_bot. `zaun_bot::bindings::zaun::bot::types::RegisteredCommand` · Struct ```rust pub struct RegisteredCommand { … } ``` ## Fields ### `command_id: Id` ### `kind: CommandKind` ### `name: String` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.RegisteredCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-registration/ --- # Struct bindings::zaun::bot::types::Registration > What `init` returns. `zaun_bot::bindings::zaun::bot::types::Registration` · Struct ```rust pub struct Registration { … } ``` What `init` returns. ## Fields ### `commands: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Registration.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-resolved/ --- # Struct bindings::zaun::bot::types::Resolved > Struct Resolved in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Resolved` · Struct ```rust pub struct Resolved { … } ``` ## Fields ### `members: Vec` ### `roles: Vec` ### `channels: Vec` ### `messages: Vec` ### `attachments: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Resolved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-section/ --- # Struct bindings::zaun::bot::types::Section > Type 9: 1-3 text displays and an accessory. `zaun_bot::bindings::zaun::bot::types::Section` · Struct ```rust pub struct Section { … } ``` Type 9: 1-3 text displays and an accessory. ## Fields ### `id: Option` ### `components: Vec` ### `accessory: SectionAccessory` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Section.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-selectoption/ --- # Struct bindings::zaun::bot::types::SelectOption > Struct SelectOption in zaun_bot. `zaun_bot::bindings::zaun::bot::types::SelectOption` · Struct ```rust pub struct SelectOption { … } ``` ## Fields ### `label: String` ### `value: String` ### `description: Option` ### `emoji: Option` ### `is_default: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.SelectOption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-separator/ --- # Struct bindings::zaun::bot::types::Separator > Type 14. `zaun_bot::bindings::zaun::bot::types::Separator` · Struct ```rust pub struct Separator { … } ``` Type 14. ## Fields ### `id: Option` ### `divider: bool` ### `spacing: SeparatorSpacing` ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Separator.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-stringselect/ --- # Struct bindings::zaun::bot::types::StringSelect > Type 3. `zaun_bot::bindings::zaun::bot::types::StringSelect` · Struct ```rust pub struct StringSelect { … } ``` Type 3. ## Fields ### `id: Option` ### `custom_id: String` ### `options: Vec` ### `placeholder: Option` ### `min_values: Option` ### `max_values: Option` ### `required: Option` In a modal. ### `disabled: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.StringSelect.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-subcommand/ --- # Struct bindings::zaun::bot::types::SubCommand > Type 1. `zaun_bot::bindings::zaun::bot::types::SubCommand` · Struct ```rust pub struct SubCommand { … } ``` Type 1. ## Fields ### `name: String` ### `name_localizations: Vec` ### `description: String` ### `description_localizations: Vec` ### `options: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.SubCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-subcommandgroup/ --- # Struct bindings::zaun::bot::types::SubCommandGroup > Type 2. `zaun_bot::bindings::zaun::bot::types::SubCommandGroup` · Struct ```rust pub struct SubCommandGroup { … } ``` Type 2. ## Fields ### `name: String` ### `name_localizations: Vec` ### `description: String` ### `description_localizations: Vec` ### `sub_commands: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.SubCommandGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-textdisplay/ --- # Struct bindings::zaun::bot::types::TextDisplay > Type 10. `zaun_bot::bindings::zaun::bot::types::TextDisplay` · Struct ```rust pub struct TextDisplay { … } ``` Type 10. ## Fields ### `id: Option` ### `content: String` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.TextDisplay.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-textinput/ --- # Struct bindings::zaun::bot::types::TextInput > Type 4. `zaun_bot::bindings::zaun::bot::types::TextInput` · Struct ```rust pub struct TextInput { … } ``` Type 4. ## Fields ### `id: Option` ### `custom_id: String` ### `style: TextInputStyle` ### `min_length: Option` ### `max_length: Option` ### `required: Option` ### `value: Option` ### `placeholder: Option` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.TextInput.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-thumbnail/ --- # Struct bindings::zaun::bot::types::Thumbnail > Type 11: an image attachment of the same message. `zaun_bot::bindings::zaun::bot::types::Thumbnail` · Struct ```rust pub struct Thumbnail { … } ``` Type 11: an image attachment of the same message. ## Fields ### `id: Option` ### `media: Id` ### `description: Option` ### `spoiler: bool` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Thumbnail.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-types-typing/ --- # Struct bindings::zaun::bot::types::Typing > Struct Typing in zaun_bot. `zaun_bot::bindings::zaun::bot::types::Typing` · Struct ```rust pub struct Typing { … } ``` ## Fields ### `channel_id: Id` ### `member_ids: Vec` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Typing.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-bindings-zaun-bot-voice-track/ --- # Struct bindings::zaun::bot::voice::Track > Something to play. `zaun_bot::bindings::zaun::bot::voice::Track` · Struct ```rust pub struct Track { … } ``` Something to play. ## Fields ### `source: Source` ### `title: Option` Shown in events and `state`. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/struct.Track.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-button/ --- # Struct Button > Builds a `types::Button`. `zaun_bot::Button` · Struct ```rust pub struct Button(…) ``` Builds a `types::Button`. ## Methods ### `primary` ```rust pub fn primary, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A primary (blurple) button. ### `secondary` ```rust pub fn secondary, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A secondary (grey) button. ### `success` ```rust pub fn success, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A success (green) button. ### `danger` ```rust pub fn danger, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A danger (red) button. ### `link` ```rust pub fn link, impl Into>(url: impl Into, label: impl Into) -> Self ``` A link button: `https://` only; clients ask before opening it. Sends no interaction. ### `emoji` ```rust pub fn emoji>(self, emoji: impl Into) -> Self ``` Adds a Unicode emoji. ### `disabled` ```rust pub fn disabled(self, disabled: bool) -> Self ``` Greys it out. ### `build` ```rust pub fn build(self) -> Button ``` The finished button. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/button/struct.Button.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-commandoptionbuilder/ --- # Struct CommandOptionBuilder > Builds a `CommandOption`. `zaun_bot::CommandOptionBuilder` · Struct ```rust pub struct CommandOptionBuilder(…) ``` Builds a `CommandOption`. ## Methods ### `new` ```rust pub fn new, impl Into>(kind: OptionKind, name: impl Into, description: impl Into) -> Self ``` An option of `kind`. `name`: 1–32 lowercase; `description`: 1–100. ### `string` ```rust pub fn string, impl Into>(name: impl Into, description: impl Into) -> Self ``` A text option. ### `integer` ```rust pub fn integer, impl Into>(name: impl Into, description: impl Into) -> Self ``` An integer option. ### `user` ```rust pub fn user, impl Into>(name: impl Into, description: impl Into) -> Self ``` A member option. ### `required` ```rust pub fn required(self) -> Self ``` Must be filled. ### `autocomplete` ```rust pub fn autocomplete(self) -> Self ``` Ask the bot for suggestions as the invoker types (`Bot::on_autocomplete`). ### `choice` ```rust pub fn choice, impl Into>(self, name: impl Into, value: impl Into) -> Self ``` Adds a fixed text choice (≤ 25; not with autocomplete). ### `range` ```rust pub fn range(self, min: f64, max: f64) -> Self ``` Numeric bounds (integer and number options). ### `length` ```rust pub fn length(self, min: u16, max: u16) -> Self ``` Length bounds (text options, 0–6 000). ### `build` ```rust pub fn build(self) -> CommandOption ``` The finished option. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/options/struct.CommandOptionBuilder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-config/ --- # Struct Config > The bot's configuration: the keys its manifest declares in `config`, each with the value the owner set or else its default. Keys with neither are absent. Given to `Bot::on_start` a `zaun_bot::Config` · Struct ```rust pub struct Config(…) ``` The bot's configuration: the keys its manifest declares in `[config]`, each with the value the owner set or else its default. Keys with neither are absent. Given to `Bot::on_start` and `Bot::commands` at start and to `Bot::on_config` on a change. ## Methods ### `get` ```rust pub fn get(&self, key: &str) -> Option<&str> ``` The value of `key`, if set (by the owner, or the manifest's default). ### `get_or` ```rust pub fn get_or<'a>(&self, key: &str, default: &'a str) -> &'a str ``` The value of `key`, or `default` when it is not set. ## Trait implementations `Clone`, `Debug`, `Default`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bot/struct.Config.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-container/ --- # Struct Container > Builds a Components V2 `types::Container`. `zaun_bot::Container` · Struct ```rust pub struct Container { … } ``` Builds a Components V2 `types::Container`. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty container. ### `accent` ```rust pub fn accent(self, rgb: u32) -> Self ``` Accent colour, `0xRRGGBB`. ### `text` ```rust pub fn text>(self, content: impl Into) -> Self ``` Adds a text block. ### `section` ```rust pub fn section(self, section: Section) -> Self ``` Adds a section. ### `row` ```rust pub fn row(self, row: ActionRow) -> Self ``` Adds a row of buttons or a select. ### `separator` ```rust pub fn separator(self) -> Self ``` Adds a divider line. ### `build` ```rust pub fn build(self) -> Container ``` The finished container. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/layout/struct.Container.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-context/ --- # Struct Context > The interaction being handled, without its data (handlers get the data separately). `zaun_bot::Context` · Struct ```rust pub struct Context { … } ``` The interaction being handled, without its data (handlers get the data separately). The first answer must be one of `reply`, `reply_ephemeral`, `respond`, `defer`, `defer_update`, `update_message` or `show_modal`, within 3 s. After it, use `followup` and `edit_original` for 15 minutes. ## Fields ### `id: Id` The interaction id. ### `bot_id: Id` The bot's id in this community. ### `channel_id: Id` The channel it happened in. ### `member: Member` Who triggered it. ### `app_permissions: u64` The bot's effective permissions in the channel. ### `locale: Option` The invoker's locale (BCP 47), if their client sent one. ### `message: Option` For component interactions: the message holding the component. ### `created_at: u64` When the host received it (ms). ## Methods ### `split` ```rust pub fn split(i: Interaction) -> (Self, InteractionData) ``` Splits an interaction into its context and data. ### `respond` ```rust pub fn respond(&self, response: Response) -> Result, HostError> ``` Sends any initial `Response`. Returns the created message id, if any. # Errors The host's refusal (already answered, too late, a message the bot may not send). ### `reply` ```rust pub fn reply>(&self, reply: impl Into) -> Result, HostError> ``` Answers with a message in the channel. # Errors See `respond`. ### `reply_ephemeral` ```rust pub fn reply_ephemeral>(&self, reply: impl Into) -> Result, HostError> ``` Answers with a message only the invoker sees. # Errors See `respond`. ### `defer` ```rust pub fn defer(&self, ephemeral: bool) -> Result, HostError> ``` Shows "thinking…" and buys 15 minutes; finish with `edit_original`. # Errors See `respond`. ### `defer_update` ```rust pub fn defer_update(&self) -> Result, HostError> ``` Acknowledges a component click without changing anything yet. # Errors See `respond`. ### `update_message` ```rust pub fn update_message>(&self, reply: impl Into) -> Result, HostError> ``` Replaces the message holding the clicked component (it must be the bot's). # Errors See `respond`. ### `show_modal` ```rust pub fn show_modal>(&self, modal: impl Into) -> Result, HostError> ``` Opens a modal for the invoker. Not allowed in answer to a modal submit. # Errors See `respond`. ### `followup` ```rust pub fn followup>(&self, reply: impl Into) -> Result, HostError> ``` Sends a follow-up message (at most 10). # Errors The host's refusal. ### `edit_original` ```rust pub fn edit_original>(&self, reply: impl Into) -> Result<(), HostError> ``` Replaces the original response. # Errors The host's refusal. ### `delete_original` ```rust pub fn delete_original(&self) -> Result<(), HostError> ``` Deletes the original response. # Errors The host's refusal. ### `dm` ```rust pub fn dm>(&self, member_id: &str, reply: impl Into) -> Result<(Id, Id), HostError> ``` Sends a direct message to a member (capability `dms`), for example the invoker: `ctx.dm(&ctx.member.member_id, "details")`. Returns the DM's channel id and the message id. # Errors The host's refusal (`FORBIDDEN` with reason `dms_closed` when the member does not take DMs from bots). ### `set_presence` ```rust pub fn set_presence>>(&self, status: Status, activity: impl Into>) ``` Sets the bot's status and activity (`crate::presence::set`). ### `set_status_text` ```rust pub fn set_status_text>(&self, text: impl Into) -> Result<(), HostError> ``` Sets the bot's custom status text (`crate::presence::set_status_text`). # Errors The host's refusal. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/context/struct.Context.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-embedbuilder/ --- # Struct EmbedBuilder > Builds an `Embed`. Pictures are attachment ids of the same message. `zaun_bot::EmbedBuilder` · Struct ```rust pub struct EmbedBuilder(…) ``` Builds an `Embed`. Pictures are attachment ids of the same message. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty embed; give it at least a title, description, field, author or footer. ### `title` ```rust pub fn title>(self, t: impl Into) -> Self ``` Title (≤ 256). ### `description` ```rust pub fn description>(self, d: impl Into) -> Self ``` Description (≤ 4 096). ### `url` ```rust pub fn url>(self, url: impl Into) -> Self ``` The title's `https://` link. ### `color` ```rust pub fn color(self, rgb: u32) -> Self ``` Side colour, `0xRRGGBB`. ### `timestamp` ```rust pub fn timestamp(self, ms: u64) -> Self ``` Timestamp, ms since the epoch. ### `author` ```rust pub fn author>(self, name: impl Into) -> Self ``` Author line. ### `footer` ```rust pub fn footer>(self, text: impl Into) -> Self ``` Footer text. ### `image` ```rust pub fn image>(self, attachment: impl Into) -> Self ``` Large picture: an image attachment of the same message. ### `thumbnail` ```rust pub fn thumbnail>(self, attachment: impl Into) -> Self ``` Small picture: an image attachment of the same message. ### `field` ```rust pub fn field, impl Into>(self, name: impl Into, value: impl Into, inline: bool) -> Self ``` A field (≤ 25). ### `build` ```rust pub fn build(self) -> Embed ``` The finished embed. ## Trait implementations `Clone`, `Debug`, `Default`, `From` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/embed/struct.EmbedBuilder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-eventcontext/ --- # Struct EventContext > What an event handler can do: send, reply, react, delete and send direct messages. Every call is an ordinary command on the bot's member, checked by the host. `zaun_bot::EventContext` · Struct ```rust pub struct EventContext { … } ``` What an event handler can do: send, reply, react, delete and send direct messages. Every call is an ordinary command on the bot's member, checked by the host. ## Fields ### `me: Option` Who and where the bot is, once `on_ready` has run (always, for every later event). ## Methods ### `send` ```rust pub fn send>(&self, channel_id: &str, reply: impl Into) -> Result ``` Sends a message to a channel. Returns its id. # Errors The host's refusal. ### `reply_to` ```rust pub fn reply_to>(&self, message: &Message, reply: impl Into) -> Result ``` Replies to a message, in its channel. # Errors The host's refusal. ### `react` ```rust pub fn react(&self, message: &Message, emoji: &str) -> Result<(), HostError> ``` Adds a reaction. # Errors The host's refusal. ### `delete_message` ```rust pub fn delete_message(&self, message: &Message) -> Result<(), HostError> ``` Deletes a message (the bot's own, or any with `MANAGE_MESSAGES`). # Errors The host's refusal. ### `dm` ```rust pub fn dm>(&self, member_id: &str, reply: impl Into) -> Result<(Id, Id), HostError> ``` Sends a direct message to a member (capability `dms`). Returns the DM's channel id and the message id. `FORBIDDEN` with reason `dms_closed` when the member does not take DMs from bots or closed this one. # Errors The host's refusal. ### `is_me` ```rust pub fn is_me(&self, member_id: &str) -> bool ``` Whether `member_id` is the bot itself (to ignore its own messages). ### `mentions_me` ```rust pub fn mentions_me(&self, message: &Message) -> bool ``` Whether `message` mentions the bot: by its member id, by `@everyone`, or by one of its roles. Only when the message names roles does it ask the host for the bot's own roles (`community::get_member`); a refusal there counts as not mentioned. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/events/struct.EventContext.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-modal/ --- # Struct Modal > Builds a types::Modal: 1–5 labelled inputs and text blocks. `zaun_bot::Modal` · Struct ```rust pub struct Modal { … } ``` Builds a [`types::Modal`]: 1–5 labelled inputs and text blocks. ## Methods ### `new` ```rust pub fn new, impl Into>(custom_id: impl Into, title: impl Into) -> Self ``` A modal; `title` ≤ 45 scalars. ### `input` ```rust pub fn input>(self, label: impl Into, input: TextInput) -> Self ``` Adds a text input under `label` (≤ 45). ### `select` ```rust pub fn select>(self, label: impl Into, select: Select) -> Self ``` Adds a select under `label`. ### `text` ```rust pub fn text>(self, content: impl Into) -> Self ``` Adds a block of text. ### `build` ```rust pub fn build(self) -> Modal ``` The finished modal. ## Trait implementations `Clone`, `Debug`, `From` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/modal/struct.Modal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-applicationcommand/ --- # Struct prelude::ApplicationCommand > Struct ApplicationCommand in zaun_bot. `zaun_bot::prelude::ApplicationCommand` · Struct ```rust pub struct ApplicationCommand { … } ``` ## Fields ### `kind: CommandKind` ### `name: String` ### `name_localizations: Vec` ### `description: String` Empty for user and message commands. ### `description_localizations: Vec` ### `options: Vec` ### `default_member_permissions: Option` Bits the invoker needs in the channel. `some(0)`: owner only; `none`: everyone. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ApplicationCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-channel/ --- # Struct prelude::Channel > Struct Channel in zaun_bot. `zaun_bot::prelude::Channel` · Struct ```rust pub struct Channel { … } ``` ## Fields ### `channel_id: Id` ### `name: String` ### `kind: String` `text`, `announcement`, `voice`, `category`, `dm`, ... ### `topic: Option` ### `parent_id: Option` ### `position: u32` ### `participants: Vec` A `dm` channel's two members (the bot and the person); empty otherwise. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-choice/ --- # Struct prelude::Choice > Struct Choice in zaun_bot. `zaun_bot::prelude::Choice` · Struct ```rust pub struct Choice { … } ``` ## Fields ### `name: String` ### `name_localizations: Vec` ### `value: ChoiceValue` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Choice.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-commanddata/ --- # Struct prelude::CommandData > Struct CommandData in zaun_bot. `zaun_bot::prelude::CommandData` · Struct ```rust pub struct CommandData { … } ``` ## Fields ### `command_id: Id` ### `name: String` ### `kind: CommandKind` ### `group: Option` ### `sub_command: Option` ### `options: Vec` ### `resolved: Resolved` ### `target_id: Option` The member (user commands) or message (message commands) acted on. ## Methods ### `focused` ```rust pub fn focused(&self) -> Option<(&str, &OptionValue)> ``` The option the invoker is typing in (autocomplete). ## Trait implementations `Clone`, `Debug`, `Options` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.CommandData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-componentdata/ --- # Struct prelude::ComponentData > Struct ComponentData in zaun_bot. `zaun_bot::prelude::ComponentData` · Struct ```rust pub struct ComponentData { … } ``` ## Fields ### `custom_id: String` ### `component_type: u8` ### `values: Vec` ### `resolved: Resolved` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ComponentData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-hosterror/ --- # Struct prelude::HostError > What the host refused, mirroring the protocol's error codes. `zaun_bot::prelude::HostError` · Struct ```rust pub struct HostError { … } ``` What the host refused, mirroring the protocol's error codes. ## Fields ### `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` The `reason` or `field` the host gave, if any. ### `retry_after_ms: Option` For `RATE_LIMITED` and `BUSY`. ## Methods ### `is_unsupported` ```rust pub fn is_unsupported(&self) -> bool ``` Whether the host does not implement this call (or this case of it) yet: an older host, or a feature it lacks, such as volume without an Opus encoder. Fall back to what the bot did before; trying again will not help. ## Trait implementations `Clone`, `Debug`, `Display`, `Error` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-member/ --- # Struct prelude::Member > community objects `zaun_bot::prelude::Member` · Struct ```rust pub struct Member { … } ``` ---- community objects ------------------------------------------------------------ ## Fields ### `member_id: Id` ### `display_name: String` ### `role_ids: Vec` ### `joined_at: Timestamp` ### `bot_id: Option` Present only for bots. ### `voice_channel: Option` 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. ## Methods ### `mention` ```rust pub fn mention(&self) -> String ``` The text that shows a mention of this member: `<@member_id>`. ### `send` ```rust pub fn send>(&self, reply: impl Into) -> Result<(Id, Id), HostError> ``` Sends the member a direct message (capability `dms`), opening the DM when needed. Returns the DM's channel id and the message id. # Errors `FORBIDDEN` with detail `dms_closed` when the member does not take DMs from bots. ### `kick` ```rust pub fn kick(&self, reason: Option<&str>) -> Result<(), HostError> ``` Removes the member from the community (`KICK_MEMBERS`). # Errors The host's refusal. ### `timeout` ```rust pub fn timeout(&self, until: Option, reason: Option<&str>) -> Result<(), HostError> ``` Times the member out until `until` (ms since the epoch); `None` clears it (`TIMEOUT_MEMBERS`). # Errors The host's refusal. ### `add_role` ```rust pub fn add_role(&self, role_id: &str) -> Result<(), HostError> ``` Gives the member a role below the bot's own (`MANAGE_ROLES`). # Errors The host's refusal. ### `remove_role` ```rust pub fn remove_role(&self, role_id: &str) -> Result<(), HostError> ``` Takes a role away (`MANAGE_ROLES`). # Errors The host's refusal. ### `has_role` ```rust pub fn has_role(&self, role_id: &str) -> bool ``` Whether the member had `role_id` when the bot saw it. ### `is_bot` ```rust pub fn is_bot(&self) -> bool ``` Whether the member is a bot. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-mentions/ --- # Struct prelude::Mentions > Struct Mentions in zaun_bot. `zaun_bot::prelude::Mentions` · Struct ```rust pub struct Mentions { … } ``` ## Fields ### `everyone: bool` ### `members: Vec` ### `roles: Vec` ## Methods ### `has_member` ```rust pub fn has_member(&self, id: &str) -> bool ``` Whether member `id` is named. ### `has_role` ```rust pub fn has_role(&self, id: &str) -> bool ``` Whether role `id` is named. ### `includes` ```rust pub fn includes(&self, member_id: &str, role_ids: &[Id]) -> bool ``` Whether a member with `member_id` and `role_ids` is mentioned: by id, by one of its roles, or by `@everyone`. ### `is_empty` ```rust pub fn is_empty(&self) -> bool ``` Whether nobody is mentioned. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Mentions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-message/ --- # Struct prelude::Message > Struct Message in zaun_bot. `zaun_bot::prelude::Message` · Struct ```rust pub struct Message { … } ``` ## Fields ### `message_id: Id` ### `channel_id: Id` ### `sequence: u64` ### `author_id: Id` ### `created_at: Timestamp` ### `edited_at: Option` ### `content: String` Empty when the bot lacks `message_content` (unless it is mentioned). ### `embeds: Vec` ### `components: Vec` ### `flags: u32` Raw flag bits. ### `reply_to: Option` ### `mentions: Mentions` ### `attachments: Vec` ### `interaction: Option` ## Methods ### `reply` ```rust pub fn reply>(&self, reply: impl Into) -> Result ``` Replies in the same channel. Returns the reply's id. # Errors The host's refusal. ### `edit` ```rust pub fn edit>(&self, reply: impl Into) -> Result<(), HostError> ``` Edits it (the bot's own messages only). # Errors The host's refusal. ### `delete` ```rust pub fn delete(&self) -> Result<(), HostError> ``` Deletes it (the bot's own, or any with `MANAGE_MESSAGES`). # Errors The host's refusal. ### `react` ```rust pub fn react(&self, emoji: &str) -> Result<(), HostError> ``` Adds a reaction. # Errors The host's refusal. ### `unreact` ```rust pub fn unreact(&self, emoji: &str) -> Result<(), HostError> ``` Removes the bot's own reaction. # Errors The host's refusal. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Message.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-modaldata/ --- # Struct prelude::ModalData > Struct ModalData in zaun_bot. `zaun_bot::prelude::ModalData` · Struct ```rust pub struct ModalData { … } ``` ## Fields ### `custom_id: String` ### `components: Vec` ### `resolved: Resolved` ## Methods ### `text` ```rust pub fn text(&self, custom_id: &str) -> Option<&str> ``` The text a modal input with `custom_id` held. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.ModalData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-reaction/ --- # Struct prelude::Reaction > Struct Reaction in zaun_bot. `zaun_bot::prelude::Reaction` · Struct ```rust pub struct Reaction { … } ``` ## Fields ### `channel_id: Id` ### `message_id: Id` ### `emoji: String` ### `member_id: Id` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Reaction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-ready/ --- # Struct prelude::Ready > events The bot's own identity, once its connection is up. `zaun_bot::prelude::Ready` · Struct ```rust pub struct Ready { … } ``` ---- events ---------------------------------------------------------------- The bot's own identity, once its connection is up. ## Fields ### `bot_id: Id` ### `member_id: Id` ### `community_id: Id` ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Ready.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-prelude-role/ --- # Struct prelude::Role > Struct Role in zaun_bot. `zaun_bot::prelude::Role` · Struct ```rust pub struct Role { … } ``` ## Fields ### `role_id: Id` ### `name: String` ### `color: Option` ### `position: u32` ### `permissions: Permissions` ### `managed_by: Option` Set on a bot's managed role. ## Methods ### `mention` ```rust pub fn mention(&self) -> String ``` The text that shows a mention of this role: `<@&role_id>`. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/struct.Role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-presence-activity/ --- # Struct presence::Activity > What the bot is doing: build one with `Activity::playing`, `Activity::listening`, … `zaun_bot::presence::Activity` · Struct ```rust pub struct Activity(…) ``` What the bot is doing: build one with `Activity::playing`, `Activity::listening`, … ## Methods ### `playing` ```rust pub fn playing>(name: impl Into) -> Self ``` "Playing {name}". ### `streaming` ```rust pub fn streaming, impl Into>(name: impl Into, url: impl Into) -> Self ``` "Streaming {name}", with an `https://` link members may open (after confirming). ### `listening` ```rust pub fn listening>(name: impl Into) -> Self ``` "Listening to {name}". ### `watching` ```rust pub fn watching>(name: impl Into) -> Self ``` "Watching {name}". ### `competing` ```rust pub fn competing>(name: impl Into) -> Self ``` "Competing in {name}". ### `custom` ```rust pub fn custom>(text: impl Into) -> Self ``` Free text, with an optional emoji (`Activity::emoji`). ### `details` ```rust pub fn details>(self, details: impl Into) -> Self ``` A second line, e.g. the track (≤ 128 characters). ### `state` ```rust pub fn state>(self, state: impl Into) -> Self ``` A third line, e.g. the artist (≤ 128 characters). ### `started_at` ```rust pub fn started_at(self, ms: u64) -> Self ``` When it started, ms since the epoch (clients show the elapsed time). ### `emoji` ```rust pub fn emoji>(self, emoji: impl Into) -> Self ``` A Unicode emoji, for `Activity::custom` only. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/presence/struct.Activity.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-reply/ --- # Struct Reply > Builds a `MessageBody`. `Reply::from("text")` is the common case. `zaun_bot::Reply` · Struct ```rust pub struct Reply(…) ``` Builds a `MessageBody`. `Reply::from("text")` is the common case. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty body. ### `content` ```rust pub fn content>(self, text: impl Into) -> Self ``` Sets the text (≤ 4 000 scalars). ### `embed` ```rust pub fn embed>(self, embed: impl Into) -> Self ``` Adds an embed (≤ 10). ### `row` ```rust pub fn row(self, row: ActionRow) -> Self ``` Adds a row of buttons or one select. ### `component` ```rust pub fn component(self, component: Component) -> Self ``` Adds any top-level component. Anything but an action row needs `v2`. ### `container` ```rust pub fn container(self, container: Container) -> Self ``` Adds a Components V2 container and switches the message to V2 layout. ### `v2` ```rust pub fn v2(self) -> Self ``` Uses Components V2 layout: no `content` or embeds, components carry everything. ### `ephemeral` ```rust pub fn ephemeral(self) -> Self ``` Only the invoker sees it (interaction answers only). ### `silent` ```rust pub fn silent(self) -> Self ``` Delivers without notifying anyone. ### `attachment` ```rust pub fn attachment>(self, id: impl Into) -> Self ``` Attaches a file uploaded with `crate::messages::upload`. ### `build` ```rust pub fn build(self) -> MessageBody ``` The finished body. ### `mention_member` ```rust pub fn mention_member>(self, id: impl Into) -> Self ``` Notifies member `id` (write `mention::member` in the text to show where). ### `mention_members` ```rust pub fn mention_members>(self, ids: impl IntoIterator) -> Self ``` Notifies these members. ### `mention_role` ```rust pub fn mention_role>(self, id: impl Into) -> Self ``` Notifies the members with role `id` (write `mention::role` in the text). ### `mention_roles` ```rust pub fn mention_roles>(self, ids: impl IntoIterator) -> Self ``` Notifies the members with these roles. ### `mention_everyone` ```rust pub fn mention_everyone(self) -> Self ``` Notifies everyone who can see the channel (needs `MENTION_EVERYONE`). ### `mentions` ```rust pub fn mentions(self, mentions: Mentions) -> Self ``` Sets the mentions to exactly `mentions` (`mention::none()`: nobody; on an edit, clears them). ### `mentions_from_content` ```rust pub fn mentions_from_content(self) -> Self ``` Adds the mentions the content shows (`<@id>`, `<@&id>`, `@everyone`; see `mention::parse`). Call it after `content`, and only for text the bot wrote itself, never for text a member gave it. ## Trait implementations `Clone`, `Debug`, `Default`, `From<&str>`, `From`, `From` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/body/struct.Reply.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-section/ --- # Struct Section > A Components V2 section: 1–3 text blocks with a button beside them. `zaun_bot::Section` · Struct ```rust pub struct Section ``` A Components V2 section: 1–3 text blocks with a button beside them. ## Methods ### `with_button` ```rust pub fn with_button(texts: &[&str], button: Button) -> Section ``` A section of `texts` with a button accessory. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/layout/struct.Section.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-slashcommand/ --- # Struct SlashCommand > Builds an ApplicationCommand: a slash command, or a user or message context command. `zaun_bot::SlashCommand` · Struct ```rust pub struct SlashCommand(…) ``` Builds an [`ApplicationCommand`]: a slash command, or a user or message context command. ## Methods ### `new` ```rust pub fn new, impl Into>(name: impl Into, description: impl Into) -> Self ``` A slash command. `name`: 1–32 lowercase letters, digits, `-` or `_`; `description`: 1–100. ### `user` ```rust pub fn user>(name: impl Into) -> Self ``` A user context-menu command ("Apps → name" on a member). ### `message` ```rust pub fn message>(name: impl Into) -> Self ``` A message context-menu command. ### `option` ```rust pub fn option(self, option: CommandOptionBuilder) -> Self ``` Adds an option (≤ 25; required ones first). ### `sub_command` ```rust pub fn sub_command(self, sub: SubCommand) -> Self ``` Adds a sub-command. ### `group` ```rust pub fn group(self, group: SubCommandGroup) -> Self ``` Adds a group of sub-commands. ### `default_member_permissions` ```rust pub fn default_member_permissions(self, bits: u64) -> Self ``` Bits the invoker needs in the channel; `0` makes it owner-only. ### `localized_name` ```rust pub fn localized_name(self, locale: &str, name: &str) -> Self ``` Adds a translated name (BCP 47 locale). ### `build` ```rust pub fn build(self) -> ApplicationCommand ``` The finished command. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/command/struct.SlashCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-subcommand/ --- # Struct SubCommand > Builds a sub-command. `zaun_bot::SubCommand` · Struct ```rust pub struct SubCommand(…) ``` Builds a sub-command. ## Methods ### `new` ```rust pub fn new, impl Into>(name: impl Into, description: impl Into) -> Self ``` A sub-command (`/name sub`). ### `option` ```rust pub fn option(self, option: CommandOptionBuilder) -> Self ``` Adds an option. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/command/struct.SubCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-subcommandgroup/ --- # Struct SubCommandGroup > Builds a group of sub-commands (`/name group sub`). `zaun_bot::SubCommandGroup` · Struct ```rust pub struct SubCommandGroup(…) ``` Builds a group of sub-commands (`/name group sub`). ## Methods ### `new` ```rust pub fn new, impl Into>(name: impl Into, description: impl Into) -> Self ``` A group. ### `sub_command` ```rust pub fn sub_command(self, sub: SubCommand) -> Self ``` Adds a sub-command. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/command/struct.SubCommandGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-textdisplay/ --- # Struct TextDisplay > A Components V2 text block (markdown, ≤ 4 000 per message in all). `zaun_bot::TextDisplay` · Struct ```rust pub struct TextDisplay ``` A Components V2 text block (markdown, ≤ 4 000 per message in all). ## Methods ### `new` ```rust pub fn new>(content: impl Into) -> TextDisplay ``` A text display. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/layout/struct.TextDisplay.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-textinput/ --- # Struct TextInput > Builds a `types::TextInput` for a modal. `zaun_bot::TextInput` · Struct ```rust pub struct TextInput(…) ``` Builds a `types::TextInput` for a modal. ## Methods ### `short` ```rust pub fn short>(custom_id: impl Into) -> Self ``` A one-line input. ### `paragraph` ```rust pub fn paragraph>(custom_id: impl Into) -> Self ``` A multi-line input. ### `length` ```rust pub fn length(self, min: u16, max: u16) -> Self ``` Length bounds (0–4 000). ### `required` ```rust pub fn required(self, required: bool) -> Self ``` Whether it must be filled (default true). ### `placeholder` ```rust pub fn placeholder>(self, text: impl Into) -> Self ``` Placeholder (≤ 100). ### `value` ```rust pub fn value>(self, text: impl Into) -> Self ``` Pre-filled value. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/modal/struct.TextInput.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-voice/ --- # Struct Voice > The bot's voice: one stay at a time. `zaun_bot::Voice` · Struct ```rust pub struct Voice ``` The bot's voice: one stay at a time. ## Methods ### `seek` ```rust pub fn seek(ms: u64) -> Result<(), HostError> ``` Jumps to `ms` into the current track; past the end, the track ends. # Errors `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. ### `set_volume` ```rust pub fn set_volume(percent: u16) -> Result<(), HostError> ``` Sets the playback volume, 0–200 % (100 when the bot joins). # Errors `BAD_REQUEST` (detail `percent`) above 200, checked before the call; `UNSUPPORTED` on hosts without an Opus encoder, which is most of them for now: tell the member and go on. ### `remove` ```rust pub fn remove(index: u32) -> Result, HostError> ``` Removes the queued track at `index` (0 plays next); returns its title. # Errors `NOT_FOUND` past the end of the queue; `UNSUPPORTED` on hosts without queue control. ### `move_track` ```rust pub fn move_track(from: u32, to: u32) -> Result<(), HostError> ``` Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. # Errors `NOT_FOUND` past the end of the queue; `UNSUPPORTED` on hosts without queue control. ### `shuffle` ```rust pub fn shuffle() -> Result<(), HostError> ``` Puts the queue in a random order; the current track keeps playing. # Errors `UNSUPPORTED` on hosts without queue control. ### `clear_queue` ```rust pub fn clear_queue() -> Result<(), HostError> ``` Empties the queue; unlike `Voice::stop`, the current track keeps playing. # Errors `UNSUPPORTED` on hosts without queue control. ### `set_loop` ```rust pub fn set_loop(mode: LoopMode) -> Result<(), HostError> ``` Sets what happens when a track ends: go on, repeat it, or requeue it at the end. # Errors `UNSUPPORTED` on hosts without looping. ### `join` ```rust pub fn join(channel: &str) -> Result<(), HostError> ``` Joins voice channel `channel` (leaving another one); returns once audio can flow. # Errors `NOT_GRANTED` without the `voice` capability; `FORBIDDEN` without `CONNECT`/`SPEAK`. ### `leave` ```rust pub fn leave() ``` Leaves; playback stops and the queue is cleared. ### `play_url` ```rust pub fn play_url(url: &str, title: Option<&str>) -> Result<(), HostError> ``` Plays an Ogg Opus file or stream now, replacing the current track: an `https://` URL on a `network` host, or an `http://`/`https://` URL on a `local_network` address. The SDK passes the URL through; the host checks it. # Errors `CONFLICT` when not in a voice channel; an address outside the grants shows up as a `TrackError` event when the track starts. ### `enqueue_url` ```rust pub fn enqueue_url(url: &str, title: Option<&str>) -> Result ``` Queues an Ogg Opus file or stream (as `Voice::play_url`); returns the queue's length. # Errors As `Voice::play_url`; `CONFLICT` with `limit_reached` past 100 tracks. ### `play_ogg` ```rust pub fn play_ogg(bytes: Vec, title: Option<&str>) -> Result<(), HostError> ``` Plays Ogg Opus bytes (≤ 16 MiB) now. # Errors As `Voice::play_url`. ### `start_stream` ```rust pub fn start_stream(title: Option<&str>) -> Result<(), HostError> ``` Starts a track the bot feeds with `Voice::push_opus` until `Voice::end_stream`. # Errors As `Voice::play_url`. ### `push_opus` ```rust pub fn push_opus(packets: &[Vec]) -> Result ``` Opus packets (2.5–120 ms each, ≤ 1000 bytes) for the current stream; returns the ms buffered. Push about as fast as it plays. # Errors `BUSY` past 3 s buffered (push again later); `CONFLICT` without a stream track. ### `end_stream` ```rust pub fn end_stream() ``` Ends the stream track once its buffered packets have played. ### `skip` ```rust pub fn skip() ``` Ends the current track; the next queued one starts. ### `stop` ```rust pub fn stop() ``` Ends the current track and clears the queue. ### `pause` ```rust pub fn pause() ``` Pauses. ### `resume` ```rust pub fn resume() ``` Resumes. ### `state` ```rust pub fn state() -> VoiceState ``` Where the bot is and what it plays. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/voice/struct.Voice.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/struct-voice-voicestate/ --- # Struct voice::VoiceState > Struct VoiceState in zaun_bot. `zaun_bot::voice::VoiceState` · Struct ```rust pub struct VoiceState { … } ``` ## Fields ### `channel: Option` The voice channel the bot is in. ### `status: PlayerStatus` ### `current: Option` The current track's title. ### `queued: Vec>` The queued tracks' titles, in order (index 0 plays next). ### `loop_mode: LoopMode` What happens when a track ends. ### `position_ms: u64` How far into the current track playback is, in ms (0 when idle). Paused time does not count. ### `duration_ms: Option` The current track's length in ms, when known: `none` for live streams, pushed audio, and files whose length the host cannot tell yet. ### `participants: Vec` The members in the bot's voice channel, the bot itself left out (empty when it is in none). Empty means the bot is alone. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/struct.VoiceState.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/trait-bindings-guest/ --- # Trait bindings::Guest > Trait Guest in zaun_bot. `zaun_bot::bindings::Guest` · Trait ```rust pub trait Guest { … } ``` ## Methods ### `init` ```rust fn init(config: Vec<(String, String)>) -> Registration; ``` Called once per instance start with the bot's configuration: the keys its manifest declares in `[config]`, each with the owner's value or else the declared default (keys with neither are left out). Secret values are passed like any other. ### `on_config_change` ```rust fn on_config_change(config: Vec<(String, String)>); ``` The owner changed the configuration while the bot runs: every value again, as for `init`. The instance is not restarted and its commands stay registered. ### `on_event` ```rust fn on_event(event: Event); ``` A subscribed event. ### `on_interaction` ```rust fn on_interaction(interaction: Interaction); ``` An application command, component click or modal submit. ### `on_autocomplete` ```rust fn on_autocomplete(interaction: Interaction) -> Vec; ``` Autocomplete: return up to 25 choices for the focused option. ### `on_timer` ```rust fn on_timer(id: u64, tag: String); ``` A timer fired. ### `on_voice_event` ```rust fn on_voice_event(event: VoiceEvent); ``` Something happened in the bot's voice stay or player. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/trait.Guest.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/trait-bot/ --- # Trait Bot > A Zaun bot. Every handler has a no-op default; implement the ones you need. `zaun_bot::Bot` · Trait ```rust pub trait Bot { … } ``` A Zaun bot. Every handler has a no-op default; implement the ones you need. The host calls one handler at a time, so `&mut self` state is safe. State lives only as long as the instance; use `crate::storage` for anything that must survive a restart. Event handlers run only for events the manifest's `events` asks for (wire types such as `message.created`, groups such as `messages`, `members`, `dms`, or `*`); see `docs/events.md`. `on_ready` always runs first. ## Methods ### `on_start` ```rust fn on_start(&mut self, config: &Config); ``` The bot started (each instance start, before `Bot::commands`): a good place to set its presence (`crate::presence`). ### `on_config` ```rust fn on_config(&mut self, config: &Config); ``` The owner changed the bot's configuration while it runs: every value again, as at start. The bot is not restarted; refresh whatever it derived from the old values. ### `commands` ```rust fn commands(&mut self, config: &Config) -> Vec; ``` The application commands to register when the bot starts. ### `on_command` ```rust fn on_command(&mut self, ctx: Context, command: CommandData); ``` A slash, user or message command was used. Answer within 3 s (or call `Context::defer`); the runtime defers automatically at 2.5 s. ### `on_component` ```rust fn on_component(&mut self, ctx: Context, component: ComponentData); ``` A button was clicked or a select changed on one of the bot's messages. ### `on_modal` ```rust fn on_modal(&mut self, ctx: Context, modal: ModalData); ``` A modal the bot opened was submitted. ### `on_autocomplete` ```rust fn on_autocomplete(&mut self, ctx: Context, command: CommandData) -> Vec; ``` The invoker is typing in an option with `autocomplete`. Return up to 25 choices. ### `on_timer` ```rust fn on_timer(&mut self, id: u64, tag: String); ``` A timer from `crate::timers` fired. ### `on_event` ```rust fn on_event(&mut self, ctx: EventContext, event: Event); ``` Every event; the default calls the typed handlers below. Override it to see events raw, before (or instead of) them. ### `on_ready` ```rust fn on_ready(&mut self, ctx: EventContext, me: Ready); ``` The bot's connection is up: its ids and community. Always the first event. ### `on_message_create` ```rust fn on_message_create(&mut self, ctx: EventContext, message: Message, is_dm: bool); ``` A message was posted (`messages`). `is_dm`: in a direct message with the bot. ### `on_message_update` ```rust fn on_message_update(&mut self, ctx: EventContext, message: Message, is_dm: bool); ``` A message was edited (`messages`). ### `on_message_delete` ```rust fn on_message_delete(&mut self, ctx: EventContext, channel_id: Id, message_id: Id); ``` A message was deleted (`messages`). ### `on_message_delete_bulk` ```rust fn on_message_delete_bulk(&mut self, ctx: EventContext, channel_id: Id, ids: Vec); ``` Messages were deleted together, by a ban (`messages`). ### `on_reaction_add` ```rust fn on_reaction_add(&mut self, ctx: EventContext, reaction: Reaction); ``` A reaction was added (`reactions`). ### `on_reaction_remove` ```rust fn on_reaction_remove(&mut self, ctx: EventContext, reaction: Reaction); ``` A reaction was removed (`reactions`). ### `on_member_join` ```rust fn on_member_join(&mut self, ctx: EventContext, member: Member); ``` A member joined (`members`, capability `members`). ### `on_member_update` ```rust fn on_member_update(&mut self, ctx: EventContext, member: Member); ``` A member changed their name (`members`). ### `on_member_leave` ```rust fn on_member_leave(&mut self, ctx: EventContext, member_id: Id); ``` A member left, was kicked or banned (`members`). ### `on_removed` ```rust fn on_removed(&mut self, ctx: EventContext, reason: String); ``` The bot itself was removed (`kicked`, `banned`); it stops right after. ### `on_member_roles_update` ```rust fn on_member_roles_update(&mut self, ctx: EventContext, roles: MemberRoles); ``` A member's roles changed (`members`). ### `on_member_timeout` ```rust fn on_member_timeout(&mut self, ctx: EventContext, timeout: MemberTimeout); ``` A member was timed out, or their timeout cleared (`members`). ### `on_channel_create` ```rust fn on_channel_create(&mut self, ctx: EventContext, channel: Channel); ``` A channel the bot can see was created (`channels`). ### `on_channel_update` ```rust fn on_channel_update(&mut self, ctx: EventContext, channel: Channel); ``` A channel changed (`channels`). ### `on_channel_delete` ```rust fn on_channel_delete(&mut self, ctx: EventContext, channel_id: Id); ``` A channel was deleted, or the bot lost access (`channels`). ### `on_role_create` ```rust fn on_role_create(&mut self, ctx: EventContext, role: Role); ``` A role was created (`roles`). ### `on_role_update` ```rust fn on_role_update(&mut self, ctx: EventContext, role: Role); ``` A role changed (`roles`). ### `on_role_delete` ```rust fn on_role_delete(&mut self, ctx: EventContext, role_id: Id); ``` A role was deleted (`roles`). ### `on_typing_start` ```rust fn on_typing_start(&mut self, ctx: EventContext, typing: Typing); ``` Members are typing in a channel the bot can see (`typing`). ### `on_presence_update` ```rust fn on_presence_update(&mut self, ctx: EventContext, presence: Presence); ``` A member's presence changed (`presence`, capability `presence`). ### `on_community_update` ```rust fn on_community_update(&mut self, ctx: EventContext, profile: CommunityProfile); ``` The community's settings changed (`community`). ### `on_commands_update` ```rust fn on_commands_update(&mut self, ctx: EventContext, bot_id: Id); ``` A bot's command list changed (`commands`); its bot id. ### `on_dm_open` ```rust fn on_dm_open(&mut self, ctx: EventContext, channel: Channel); ``` A DM with the bot was opened, by the bot or a member (`dms`, capability `dms`). ### `on_dm_close` ```rust fn on_dm_close(&mut self, ctx: EventContext, channel_id: Id); ``` The bot closed a DM (`dms`). ### `on_raw` ```rust fn on_raw(&mut self, ctx: EventContext, event: RawEvent); ``` An event without a typed handler: its wire type and JSON body. ### `on_voice_event` ```rust fn on_voice_event(&mut self, event: VoiceEvent); ``` Something happened in the bot's voice stay or player (`crate::Voice`): a track started, ended or failed, someone joined or left, or the stay ended. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bot/trait.Bot.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/trait-options/ --- # Trait Options > Reads option and modal values by name. `zaun_bot::Options` · Trait ```rust pub trait Options { … } ``` Reads option and modal values by name. ## Methods ### `value` ```rust fn value(&self, name: &str) -> Option<&OptionValue>; ``` The value named `name`. ### `str` ```rust fn str(&self, name: &str) -> Option<&str>; ``` A text value (string options, modal text inputs). ### `int` ```rust fn int(&self, name: &str) -> Option; ``` An integer value. ### `bool` ```rust fn bool(&self, name: &str) -> Option; ``` A boolean value. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/options/trait.Options.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-choice/ --- # Type alias bindings::Choice > Type alias Choice in zaun_bot. `zaun_bot::bindings::Choice` · Type alias ```rust pub type Choice = Choice; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/type.Choice.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-event/ --- # Type alias bindings::Event > Type alias Event in zaun_bot. `zaun_bot::bindings::Event` · Type alias ```rust pub type Event = Event; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/type.Event.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-interaction/ --- # Type alias bindings::Interaction > Type alias Interaction in zaun_bot. `zaun_bot::bindings::Interaction` · Type alias ```rust pub type Interaction = Interaction; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/type.Interaction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-registration/ --- # Type alias bindings::Registration > Type alias Registration in zaun_bot. `zaun_bot::bindings::Registration` · Type alias ```rust pub type Registration = Registration; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/type.Registration.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-voiceevent/ --- # Type alias bindings::VoiceEvent > Type alias VoiceEvent in zaun_bot. `zaun_bot::bindings::VoiceEvent` · Type alias ```rust pub type VoiceEvent = VoiceEvent; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/type.VoiceEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-audio-hosterror/ --- # Type alias bindings::zaun::bot::audio::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::audio::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/audio/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-commands-applicationcommand/ --- # Type alias bindings::zaun::bot::commands::ApplicationCommand > Type alias ApplicationCommand in zaun_bot. `zaun_bot::bindings::zaun::bot::commands::ApplicationCommand` · Type alias ```rust pub type ApplicationCommand = ApplicationCommand; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/commands/type.ApplicationCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-commands-hosterror/ --- # Type alias bindings::zaun::bot::commands::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::commands::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/commands/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-commands-registeredcommand/ --- # Type alias bindings::zaun::bot::commands::RegisteredCommand > Type alias RegisteredCommand in zaun_bot. `zaun_bot::bindings::zaun::bot::commands::RegisteredCommand` · Type alias ```rust pub type RegisteredCommand = RegisteredCommand; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/commands/type.RegisteredCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-channel/ --- # Type alias bindings::zaun::bot::community::Channel > Type alias Channel in zaun_bot. `zaun_bot::bindings::zaun::bot::community::Channel` · Type alias ```rust pub type Channel = Channel; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/type.Channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-hosterror/ --- # Type alias bindings::zaun::bot::community::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::community::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-id/ --- # Type alias bindings::zaun::bot::community::Id > Type alias Id in zaun_bot. `zaun_bot::bindings::zaun::bot::community::Id` · Type alias ```rust pub type Id = Id; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/type.Id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-member/ --- # Type alias bindings::zaun::bot::community::Member > Type alias Member in zaun_bot. `zaun_bot::bindings::zaun::bot::community::Member` · Type alias ```rust pub type Member = Member; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/type.Member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-role/ --- # Type alias bindings::zaun::bot::community::Role > Type alias Role in zaun_bot. `zaun_bot::bindings::zaun::bot::community::Role` · Type alias ```rust pub type Role = Role; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/type.Role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-community-timestamp/ --- # Type alias bindings::zaun::bot::community::Timestamp > Type alias Timestamp in zaun_bot. `zaun_bot::bindings::zaun::bot::community::Timestamp` · Type alias ```rust pub type Timestamp = Timestamp; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/community/type.Timestamp.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-dms-channel/ --- # Type alias bindings::zaun::bot::dms::Channel > Type alias Channel in zaun_bot. `zaun_bot::bindings::zaun::bot::dms::Channel` · Type alias ```rust pub type Channel = Channel; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/dms/type.Channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-dms-hosterror/ --- # Type alias bindings::zaun::bot::dms::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::dms::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/dms/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-dms-id/ --- # Type alias bindings::zaun::bot::dms::Id > Type alias Id in zaun_bot. `zaun_bot::bindings::zaun::bot::dms::Id` · Type alias ```rust pub type Id = Id; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/dms/type.Id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-hosterror/ --- # Type alias bindings::zaun::bot::interactions::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::interactions::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-id/ --- # Type alias bindings::zaun::bot::interactions::Id > Type alias Id in zaun_bot. `zaun_bot::bindings::zaun::bot::interactions::Id` · Type alias ```rust pub type Id = Id; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/type.Id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-messagebody/ --- # Type alias bindings::zaun::bot::interactions::MessageBody > Type alias MessageBody in zaun_bot. `zaun_bot::bindings::zaun::bot::interactions::MessageBody` · Type alias ```rust pub type MessageBody = MessageBody; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/type.MessageBody.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-interactions-response/ --- # Type alias bindings::zaun::bot::interactions::Response > Type alias Response in zaun_bot. `zaun_bot::bindings::zaun::bot::interactions::Response` · Type alias ```rust pub type Response = Response; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/interactions/type.Response.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-hosterror/ --- # Type alias bindings::zaun::bot::messages::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::messages::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-id/ --- # Type alias bindings::zaun::bot::messages::Id > Type alias Id in zaun_bot. `zaun_bot::bindings::zaun::bot::messages::Id` · Type alias ```rust pub type Id = Id; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/type.Id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-message/ --- # Type alias bindings::zaun::bot::messages::Message > Type alias Message in zaun_bot. `zaun_bot::bindings::zaun::bot::messages::Message` · Type alias ```rust pub type Message = Message; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/type.Message.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-messages-messagebody/ --- # Type alias bindings::zaun::bot::messages::MessageBody > Type alias MessageBody in zaun_bot. `zaun_bot::bindings::zaun::bot::messages::MessageBody` · Type alias ```rust pub type MessageBody = MessageBody; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/messages/type.MessageBody.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-presence-activity/ --- # Type alias bindings::zaun::bot::presence::Activity > Type alias Activity in zaun_bot. `zaun_bot::bindings::zaun::bot::presence::Activity` · Type alias ```rust pub type Activity = Activity; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/presence/type.Activity.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-presence-hosterror/ --- # Type alias bindings::zaun::bot::presence::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::presence::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/presence/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-presence-timestamp/ --- # Type alias bindings::zaun::bot::presence::Timestamp > Type alias Timestamp in zaun_bot. `zaun_bot::bindings::zaun::bot::presence::Timestamp` · Type alias ```rust pub type Timestamp = Timestamp; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/presence/type.Timestamp.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-storage-hosterror/ --- # Type alias bindings::zaun::bot::storage::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::storage::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/storage/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-timers-hosterror/ --- # Type alias bindings::zaun::bot::timers::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::timers::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/timers/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-types-id/ --- # Type alias bindings::zaun::bot::types::Id > A Zaun id: base64url without padding (22 characters for 16-byte ids). `zaun_bot::bindings::zaun::bot::types::Id` · Type alias ```rust pub type Id = String; ``` A Zaun id: base64url without padding (22 characters for 16-byte ids). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/type.Id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-types-permissions/ --- # Type alias bindings::zaun::bot::types::Permissions > A permission bitfield (permissions.md the protocol). `zaun_bot::bindings::zaun::bot::types::Permissions` · Type alias ```rust pub type Permissions = u64; ``` A permission bitfield (permissions.md the protocol). [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/type.Permissions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-types-timestamp/ --- # Type alias bindings::zaun::bot::types::Timestamp > Milliseconds since the Unix epoch. `zaun_bot::bindings::zaun::bot::types::Timestamp` · Type alias ```rust pub type Timestamp = u64; ``` Milliseconds since the Unix epoch. [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/types/type.Timestamp.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-voice-hosterror/ --- # Type alias bindings::zaun::bot::voice::HostError > Type alias HostError in zaun_bot. `zaun_bot::bindings::zaun::bot::voice::HostError` · Type alias ```rust pub type HostError = HostError; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/type.HostError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-bot/type-alias-bindings-zaun-bot-voice-id/ --- # Type alias bindings::zaun::bot::voice::Id > Type alias Id in zaun_bot. `zaun_bot::bindings::zaun::bot::voice::Id` · Type alias ```rust pub type Id = Id; ``` [Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/bindings/zaun/bot/voice/type.Id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/constant-mention-everyone/ --- # Constant mention::EVERYONE > The text that shows `@everyone`. `zaun_client::mention::EVERYONE` · Constant ```rust pub const EVERYONE: &str = "@everyone"; ``` The text that shows `@everyone`. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/mention/constant.EVERYONE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/constant-text_budget/ --- # Constant TEXT_BUDGET > The largest frame text, in bytes as written inside the JSON string that carries it (`framing::escaped_len`: every `"` or `\` counts twice), that one message always carries, uncompr `zaun_client::TEXT_BUDGET` · Constant ```rust pub const TEXT_BUDGET: usize = _; ``` The largest frame text, in bytes as written inside the JSON string that carries it (`framing::escaped_len`: every `"` or `\` counts twice), that one message always carries, uncompressed even to a post-quantum connection: 13 124. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/budget/constant.TEXT_BUDGET.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/constant-typing_shown_ms/ --- # Constant TYPING_SHOWN_MS > How long one typing signal shows: the host repeats it at most every 3 s while typing goes on, so two missed repeats end it. `zaun_client::TYPING_SHOWN_MS` · Constant ```rust pub const TYPING_SHOWN_MS: u64 = 6_000; ``` How long one typing signal shows: the host repeats it at most every 3 s while typing goes on, so two missed repeats end it. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/typing/constant.TYPING_SHOWN_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-audioplayerevent/ --- # Enum AudioPlayerEvent > What a player tells the application. `zaun_client::AudioPlayerEvent` · Enum ```rust pub enum AudioPlayerEvent { … } ``` What a player tells the application. ## Variants ### `StateChange { from, to }` The status changed. ### `TrackStart { title }` A resource started playing. ### `TrackEnd { title }` A resource ended: played out, skipped, stopped or failed. ### `Error { title, error }` A resource could not be read (the track ends), or a packet was skipped. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/player/enum.AudioPlayerEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-audioplayerstatus/ --- # Enum AudioPlayerStatus > What a player is doing. `zaun_client::AudioPlayerStatus` · Enum ```rust pub enum AudioPlayerStatus { … } ``` What a player is doing. ## Variants ### `Idle` Nothing to play. ### `Playing` Sending a resource. ### `Paused` Paused with `AudioPlayer::pause`. ### `AutoPaused` Paused because no subscribed session can send (none subscribed, or all muted or without `SPEAK`); resumes by itself. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/player/enum.AudioPlayerStatus.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-error/ --- # Enum Error > A `zaun-client` failure. `zaun_client::Error` · Enum ```rust pub enum Error { … } ``` A `zaun-client` failure. ## Variants ### `Simplex(Error)` The SimpleX client failed or refused. ### `Refused { kind, code, body }` The host refused the command with this protocol error. ### `BadLink` The text is not a Zaun invitation link. ### `UnknownCommunity` The community is not one this client belongs to. ### `NotPostQuantum` The host connection is not post-quantum; the client closed it. ### `HostRejected(String)` The host's welcome failed verification. ### `Protocol(String)` A command could not be built or sent. ### `Timeout(&'static str)` No answer in time. ### `Unsupported(&'static str)` The community's host does not support this (its welcome did not list the capability), so nothing was sent: a host without `embeds` would drop them silently. ### `Transfer(&'static str)` A file transfer failed (an attachment upload or download). ### `Voice(String)` A voice session could not start or was refused locally (already in voice, a host media policy this client does not accept). ### `Audio(String)` Audio could not be played: a resource that cannot be opened, ffmpeg missing or refused, an option out of range. Names no path or URL. ### `Store(String)` The local store could not be read or written. ### `Closed` The client has stopped. ## Trait implementations `Debug`, `Display`, `Error`, `From` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/error/enum.Error.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-event/ --- # Enum Event > One thing that happened. `zaun_client::Event` · Enum ```rust pub enum Event { … } ``` One thing that happened. ## Variants ### `Ready(Community)` A community is connected and its cache loaded: after a join, a creation, a restart, or the host coming back. ### `AppsReady(Community)` The community's bots and their commands loaded (just after `Event::Ready`). ### `PresencesReady(Community)` Who is online loaded (just after `Event::Ready`); `Community::presences` has it. ### `PresenceUpdate { community, presence }` A member's status or activity changed; offline members leave `Community::presences`. ### `CommandsUpdate { community, bot }` A bot's commands changed (`Community::commands` has the new list). ### `BotUpdate { community, card }` A bot was installed, updated, re-granted, enabled, disabled or crashed: its card. ### `BotRemove { community, bot, member }` A bot was removed. ### `InteractionCreate(Box)` As a bot: someone used one of this bot's commands, components or modals. ### `InteractionReply(EphemeralReply)` A bot's ephemeral reply to this member. ### `ModalOpen(ModalOpen)` A bot asks this member to fill in a modal. ### `Autocomplete(Suggestions)` A bot's autocomplete suggestions. ### `InteractionFail(InteractionFailure)` One of this member's interactions got no answer. ### `MessageCreate(Message)` A new message. ### `MessageUpdate { message, author, content, embeds, mentions, edited_at }` A message was edited by its author. ### `MessageDelete { message, by }` A message was deleted. ### `MessageDeleteBulk { channel, messages }` Several messages were deleted at once. ### `ReactionAdd(Reaction)` Someone added a reaction. ### `ReactionRemove(Reaction)` Someone took a reaction off. ### `ChannelCreate(Channel)` A channel was made, or became visible to this member. ### `ChannelUpdate(Channel)` A channel changed. ### `ChannelDelete(Channel)` A channel was deleted, or is no longer visible to this member. ### `RoleCreate(Role)` A role was made. ### `RoleUpdate(Role)` A role changed. ### `RoleDelete(Role)` A role was deleted. ### `MemberAdd(Member)` Someone joined the community. ### `MemberUpdate(Member)` A member changed: their name, roles or timeout. ### `MemberRemove(Member)` A member left or was removed. ### `VoiceStateUpdate(VoiceState)` Someone joined, left or changed state in a voice channel. ### `CommunityUpdate(Community)` The community's profile changed. ### `CommunityDelete { community, reason }` This client left a community, or was removed from it (kicked, banned, …); it is forgotten here, keys and saved state included. A removal while this client was away comes on its next session, from a host after 0.4.0 (which says it again after a welcome without the binding, or sends an uncorrelated `BANNED`). ### `CommunityMoving { community, host }` The owner handed the community to a new host; this client is moving there. ### `CommunityMoved { community, host }` This client moved with its community to the new host. ### `CommunityMoveRefused { community, code }` The new host refused this member; the move is given up. ### `Disconnect(Community)` The connection to a community's host closed; the community stays saved. ### `Offline` No SimpleX relay is reachable. ### `Online` A relay is reachable again. ### `Warning(String)` Something was ignored safely; the text names no content or secret. ### `DmCreate { channel, recipient }` DM: a direct message became known: opened by either side, or found when the community loaded. `recipient` is the other participant. ### `DmDelete(Channel)` DM: this member closed a direct message. ### `MessageSent { pending, message }` A post made with `Channel::send_pending` is in: the host accepted it as `message`, which replaces the pending one shown (matched by `pending`). Its `message.created` may also arrive as a `Event::MessageCreate`. ### `MessageSendFailed { pending, channel, error }` A post made with `Channel::send_pending` did not go through; the pending one shown should say so. ### `TypingStart { channel, typing }` Someone else is typing in a channel (typing): members by id in a `named` channel, only how many in an `anonymous` one. It shows for `TYPING_SHOWN_MS` unless repeated; `Channel::typing` gives the current state. ### `Raw { community, channel, actor, event }` Any other community event, as the protocol has it. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/events/enum.Event.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-picture/ --- # Enum Picture > Where an embed's picture (or a message's file) comes from. Pictures are never remote URLs: a file is uploaded as one of the message's attachments, so no reader's client ever fetche `zaun_client::Picture` · Enum ```rust pub enum Picture { … } ``` Where an embed's picture (or a message's file) comes from. Pictures are never remote URLs: a file is uploaded as one of the message's attachments, so no reader's client ever fetches anything from a third party. ## Variants ### `File(PathBuf)` A local file, uploaded under its own name. ### `Bytes { name, data }` Bytes, uploaded under `name` (whose extension gives the media type). ### `Attachment(AttachmentId)` An attachment this member uploaded (and has not posted yet) or, for an edit, one the message already has. ## Methods ### `file` ```rust pub fn file>(path: impl Into) -> Self ``` The file at `path`. ### `bytes` ```rust pub fn bytes, impl Into>>(name: impl Into, data: impl Into>) -> Self ``` `data`, uploaded as a file named `name`. ### `attachment` ```rust pub const fn attachment(id: AttachmentId) -> Self ``` The attachment `id`. ## Trait implementations `Clone`, `Debug`, `Eq`, `From<&Attachment>`, `From<&Path>`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/compose/embed/enum.Picture.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-typingnow/ --- # Enum TypingNow > Who else is typing in a channel, as the host last said. This client is never among them. `zaun_client::TypingNow` · Enum ```rust pub enum TypingNow { … } ``` Who else is typing in a channel, as the host last said. This client is never among them. ## Variants ### `Named { member_ids }` A `named` channel: the members typing. ### `Anonymous { count }` An `anonymous` channel: how many, never who. 3 means "three or more". ## Methods ### `from_signal` ```rust pub fn from_signal(s: &TypingSignal) -> Option ``` The state a `signal.typing` event describes; `None` when it names nobody. ### `count` ```rust pub fn count(&self) -> usize ``` How many are typing (for an anonymous channel, 3 means "three or more"). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/typing/enum.TypingNow.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-ui-entitykind/ --- # Enum ui::EntityKind > What an entity select offers. `zaun_client::ui::EntityKind` · Enum ```rust pub enum EntityKind { … } ``` What an entity select offers. ## Variants ### `User` Members (type 5). ### `Role` Roles (type 6). ### `Mentionable` Members and roles (type 7). ### `Channel` Channels (type 8). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/select/enum.EntityKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/enum-voiceevent/ --- # Enum VoiceEvent > What happens in a voice session. `zaun_client::VoiceEvent` · Enum ```rust pub enum VoiceEvent { … } ``` What happens in a voice session. ## Variants ### `Joined(VoiceParticipant)` Someone joined the channel (no key package: that stays inside the session). ### `Updated(VoiceParticipant)` Someone changed mute or deafen, or a moderator did. ### `Left { member, reason }` Someone left the channel. ### `Connected(MemberId)` The media connection to a participant is up. ### `Audio { member, frame }` An Opus frame from a participant, decrypted. ### `Rekeyed(u32)` This member's keys moved to a new epoch (someone joined or left). ### `KeyChanged { member }` The host listed another key for `member` than the one this client saw first, so the participant was skipped: no media and no keys go to it. Either the member replaced its key, or the host is putting itself in the member's place; compare `Member::fingerprint` with the member out of band. ### `Ended { reason, moved_to }` The session ended: left, moved or disconnected by a moderator, the host went away, or the media relay ended the allocation (never replaced by a direct path). When moved, rejoin in `moved_to` with `Channel::join`. ### `Warning(String)` Something was skipped safely (a peer whose key package did not verify, a refused signal); the text names no key or address. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/stay/enum.VoiceEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-files-guess_mime/ --- # Function files::guess_mime > A media type from a file name's extension; `application/octet-stream` otherwise. `zaun_client::files::guess_mime` · Function ```rust pub fn guess_mime(name: &str) -> &'static str ``` A media type from a file name's extension; `application/octet-stream` otherwise. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/files/fn.guess_mime.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-files-measure/ --- # Function files::measure > The size and SHA3-256 of the file at `path`. `zaun_client::files::measure` · Function ```rust pub fn measure(path: &Path) -> Result<(u64, [u8; 32])> ``` The size and SHA3-256 of the file at `path`. # Errors I/O errors. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/files/fn.measure.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-files-safe_name/ --- # Function files::safe_name > A name for `name` that is safe as one path component: no separators, no control characters, no leading dots; `attachment` when nothing is left. `zaun_client::files::safe_name` · Function ```rust pub fn safe_name(name: &str) -> String ``` A name for `name` that is safe as one path component: no separators, no control characters, no leading dots; `attachment` when nothing is left. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/files/fn.safe_name.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-mention-member/ --- # Function mention::member > The text that shows a member mention, `<@id>` (discord.js `userMention`). It only shows where the mention is: the message's mentions list is what notifies. `zaun_client::mention::member` · Function ```rust pub fn member(id: MemberId) -> String ``` The text that shows a member mention, `<@id>` (discord.js `userMention`). It only shows where the mention is: the message's mentions list is what notifies. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/mention/fn.member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-mention-parse/ --- # Function mention::parse > The mentions `content` shows: `<@id>` (and Discord's `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most 50 members and 20 roles; malformed ids `zaun_client::mention::parse` · Function ```rust pub fn parse(content: &str) -> Mentions ``` The mentions `content` shows: `<@id>` (and Discord's `<@!id>`) for members, `<@&id>` for roles, `@everyone`. Each id once, in order, at most 50 members and 20 roles; malformed ids are skipped. Use it on text this member wrote, not on text from someone else. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/mention/fn.parse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-mention-role/ --- # Function mention::role > The text that shows a role mention, `<@&id>` (discord.js `roleMention`). `zaun_client::mention::role` · Function ```rust pub fn role(id: RoleId) -> String ``` The text that shows a role mention, `<@&id>` (discord.js `roleMention`). [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/mention/fn.role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-presence-activity/ --- # Function presence::activity > An activity of `kind` named `name`, for `Client::set_presence`. Set `details`, `state`, `started_at`, `url` (streaming) or `emoji` (custom) on it as needed. `zaun_client::presence::activity` · Function ```rust pub fn activity>(kind: ActivityType, name: impl Into) -> Activity ``` An activity of `kind` named `name`, for `Client::set_presence`. Set `details`, `state`, `started_at`, `url` (streaming) or `emoji` (custom) on it as needed. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/presence/fn.activity.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-presence-line/ --- # Function presence::line > "Playing {name}", "Streaming {name}", "Listening to {name}", "Watching {name}", "Competing in {name}", or `{emoji} {name}` for a custom one. `zaun_client::presence::line` · Function ```rust pub fn line(a: &Activity) -> String ``` "Playing {name}", "Streaming {name}", "Listening to {name}", "Watching {name}", "Competing in {name}", or `{emoji} {name}` for a custom one. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/presence/fn.line.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-registry-inspect_package/ --- # Function registry::inspect_package > What a `.zbot` file says, whether its signature verifies and whether it passes the registry's package checks. `zaun_client::registry::inspect_package` · Function ```rust pub fn inspect_package(bytes: &[u8]) -> Inspection ``` What a `.zbot` file says, whether its signature verifies and whether it passes the registry's package checks. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/fn.inspect_package.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-registry-key_id/ --- # Function registry::key_id > The id of a base64url public key: what a bot card's `source.registry_id` is compared with. `zaun_client::registry::key_id` · Function ```rust pub fn key_id(key: &str) -> KeyIdReport ``` The id of a base64url public key: what a bot card's `source.registry_id` is compared with. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/fn.key_id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-registry-verify_catalog/ --- # Function registry::verify_catalog > Verifies `catalog.json` bytes and the text of `catalog.json.sig` against the key of `pinned` (base64url public keys) that the catalog names, at Unix time `now` (seconds), after `se `zaun_client::registry::verify_catalog` · Function ```rust pub fn verify_catalog(bytes: &[u8], sig: &str, pinned: &[String], now: u64, seen: Option<&str>) -> CatalogCheck ``` Verifies `catalog.json` bytes and the text of `catalog.json.sig` against the key of `pinned` (base64url public keys) that the catalog names, at Unix time `now` (seconds), after `seen` (the `seen` an earlier success returned for that registry, as JSON). [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/fn.verify_catalog.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/function-registry-verify_history/ --- # Function registry::verify_history > Verifies the catalog as `verify_catalog` does (no stored serial), then `history/.json` against the hash the verified catalog lists for it. `zaun_client::registry::verify_history` · Function ```rust pub fn verify_history(catalog: &[u8], sig: &str, pinned: &[String], now: u64, app_id: &str, bytes: &[u8]) -> HistoryCheck ``` Verifies the catalog as `verify_catalog` does (no stored serial), then `history/.json` against the hash the verified catalog lists for it. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/fn.verify_history.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-attachment/ --- # Struct Attachment > A file on a message. `zaun_client::Attachment` · Struct ```rust pub struct Attachment { … } ``` A file on a message. ## Methods ### `id` ```rust pub const fn id(&self) -> AttachmentId ``` Its id. ### `name` ```rust pub fn name(&self) -> &str ``` Its name (empty when the cache does not have it). ### `size` ```rust pub const fn size(&self) -> u64 ``` Its size in bytes. ### `content_type` ```rust pub fn content_type(&self) -> &str ``` Its media type. ### `data` ```rust pub const fn data(&self) -> &AttachmentData ``` The attachment as the protocol describes it. ### `message` ```rust pub const fn message(&self) -> &Message ``` The message it is on. ### `download` ```rust pub fn download>(&self, dest: impl AsRef) -> Result ``` Downloads the file into the folder `dest` under a safe name and answers its path, once its size and SHA3-256 match. # Errors The host refused, the transfer failed or timed out, or the file does not match. ## Trait implementations `Clone`, `Debug`, `From<&Attachment>` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.Attachment.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-audioplayer/ --- # Struct AudioPlayer > Plays `AudioResource`s, one at a time, into every subscribed voice session. `zaun_client::AudioPlayer` · Struct ```rust pub struct AudioPlayer { … } ``` Plays `AudioResource`s, one at a time, into every subscribed voice session. ## Methods ### `new` ```rust pub fn new() -> Result ``` A player, idle, with its own thread. # Errors `Error::Audio` when the thread cannot start. ### `play` ```rust pub fn play(&self, resource: AudioResource) ``` Plays `resource` now, ending the current one; the queue stays. ### `enqueue` ```rust pub fn enqueue(&self, resource: AudioResource) ``` Plays `resource` after the current one and those queued before it. ### `skip` ```rust pub fn skip(&self) ``` Ends the current resource; the next queued one plays. ### `stop` ```rust pub fn stop(&self) ``` Ends the current resource and empties the queue: the player goes idle. ### `pause` ```rust pub fn pause(&self) -> bool ``` Pauses; `false` when there was nothing playing. ### `unpause` ```rust pub fn unpause(&self) -> bool ``` Resumes after `pause`; `false` when it was not paused. ### `status` ```rust pub fn status(&self) -> AudioPlayerStatus ``` What the player is doing. ### `queue_len` ```rust pub fn queue_len(&self) -> usize ``` Resources waiting after the current one. ### `next_event` ```rust pub fn next_event(&self, timeout: Duration) -> Option ``` The next event, or `None` when none arrives within `timeout`. ### `events` ```rust pub fn events(&self) -> impl Iterator + Send + 'static ``` The events, blocking; ends when the player is dropped. ## Trait implementations `Debug`, `Drop` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/player/struct.AudioPlayer.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-audioresource/ --- # Struct AudioResource > Something to play: Opus packets, from an Ogg Opus file or stream, from ffmpeg (any format it reads), or from the application. `zaun_client::AudioResource` · Struct ```rust pub struct AudioResource { … } ``` Something to play: Opus packets, from an Ogg Opus file or stream, from ffmpeg (any format it reads), or from the application. ## Methods ### `ogg` ```rust pub fn ogg(reader: impl Read + Send + 'static) -> Self ``` An Ogg Opus stream (`.opus`, or `.ogg` holding Opus), sent as it is. ### `ogg_file` ```rust pub fn ogg_file>(path: impl AsRef) -> Result ``` An Ogg Opus file, sent as it is; titled with its file name. # Errors `Error::Audio` when the file cannot be opened. ### `opus_packets` ```rust pub fn opus_packets, IntoIter : Send + 'static>>(packets: impl IntoIterator, IntoIter = …>) -> Self ``` Opus packets the application made (each one 2.5 to 120 ms, as its TOC byte says). ### `ffmpeg_file` ```rust pub fn ffmpeg_file>(path: impl AsRef, options: FfmpegOptions) -> Result ``` Any audio file ffmpeg reads (mp3, flac, wav, m4a, a video's sound…), transcoded to Opus. # Errors `Error::Audio` when the file is missing, an option is out of range, or ffmpeg is not installed. ### `ffmpeg_url` ```rust pub fn ffmpeg_url(url: &str, options: FfmpegOptions) -> Result ``` An `http://` or `https://` stream or file, fetched and transcoded by ffmpeg. # Errors `Error::Audio` for another scheme, an option out of range, or no ffmpeg. ### `ffmpeg_reader` ```rust pub fn ffmpeg_reader(reader: impl Read + Send + 'static, options: FfmpegOptions) -> Result ``` Audio the application streams (another program's output, a download), transcoded by ffmpeg as it arrives. # Errors `Error::Audio` for an option out of range, or no ffmpeg. ### `pcm` ```rust pub fn pcm(reader: impl Read + Send + 'static, options: FfmpegOptions) -> Result ``` Raw PCM the application makes (text to speech, a synthesiser): signed 16-bit little-endian samples, 48 kHz, two channels interleaved. Encoded to Opus by ffmpeg. # Errors `Error::Audio` for an option out of range, or no ffmpeg. ### `file` ```rust pub fn file>(path: impl AsRef, options: FfmpegOptions) -> Result ``` Any audio file: an Ogg Opus file is sent as it is (no ffmpeg, no quality lost, like discord.js's `demuxProbe`), anything else goes through ffmpeg. `options` apply only when ffmpeg runs; a volume or seek asks for it even for Ogg Opus. # Errors As `ogg_file` and `ffmpeg_file`. ### `with_title` ```rust pub fn with_title>(self, title: impl Into) -> Self ``` Names the resource (the events carry it). ### `title` ```rust pub fn title(&self) -> Option<&str> ``` The title, if any. ## Trait implementations `Debug`, `Drop` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/player/struct.AudioResource.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-channel/ --- # Struct Channel > A channel or category of a community. `zaun_client::Channel` · Struct ```rust pub struct Channel { … } ``` A channel or category of a community. ## Methods ### `is_dm` ```rust pub fn is_dm(&self) -> bool ``` Whether it is a direct message, not a community channel. ### `recipient` ```rust pub fn recipient(&self) -> Option ``` The other participant of a DM; `None` for a community channel. ### `close_dm` ```rust pub fn close_dm(&self) -> Result<()> ``` Closes a DM for this member. # Errors `NOT_FOUND` or no answer. ### `start_typing` ```rust pub fn start_typing(&self) -> Result ``` Tells the host this member is typing here; call it while the user types (the host forwards at most one signal per member per channel per 3 s). Returns `false` without sending anything in a channel whose typing is `off`. # Errors `Error::Closed` when the client stopped. ### `typing` ```rust pub fn typing(&self) -> Option ``` Who else is typing here now: members by id in a `named` channel, only how many in an `anonymous` one; `None` when nobody is (or the channel's typing is `off`). ### `set_typing_mode` ```rust pub fn set_typing_mode(&self, mode: TypingMode) -> Result<()> ``` Sets who sees typing here (`channel.update`, needs `MANAGE_CHANNELS`): `Named`, `Anonymous` or `Off`. The cache follows with the host's `channel.updated`. # Errors `Error::Refused` (`FORBIDDEN` without the permission), or no answer. ### `typing_mode` ```rust pub fn typing_mode(&self) -> TypingMode ``` The channel's typing setting (`named` when the cache does not have it). ### `invoke_command` ```rust pub fn invoke_command(&self, command: CommandId, options: Vec, target: Option) -> Result ``` Runs a bot command here. `target` is the member (user command) or message (message command) acted on, base64url. The bot's answer arrives as an event. # Errors The host refused (no `USE_APPLICATION_COMMANDS`, bad options) or did not answer. ### `autocomplete` ```rust pub fn autocomplete(&self, command: CommandId, options: Vec) -> Result ``` Asks the bot for suggestions for the option marked `focused`; they arrive as `Event::Autocomplete`. # Errors As `invoke_command`. ### `submit_modal` ```rust pub fn submit_modal(&self, modal: InteractionId, custom_id: &str, components: Vec) -> Result ``` Submits a modal a bot opened (`Event::ModalOpen`): `modal` is the interaction that opened it. # Errors The host refused (a required field missing, too late, submitted already). ### `id` ```rust pub const fn id(&self) -> ChannelId ``` Its id. ### `community` ```rust pub const fn community(&self) -> &Community ``` The community it belongs to. ### `data` ```rust pub fn data(&self) -> Option ``` The cache's copy, or `None` when the cache does not have it (any more). ### `name` ```rust pub fn name(&self) -> String ``` Its name (empty when the cache does not have it). ### `kind` ```rust pub fn kind(&self) -> ChannelKind ``` Text when the cache does not have it. ### `topic` ```rust pub fn topic(&self) -> Option ``` Its topic. ### `parent` ```rust pub fn parent(&self) -> Option ``` The category it is in. ### `is_voice` ```rust pub fn is_voice(&self) -> bool ``` Whether it is a voice (or stage) channel. ### `is_category` ```rust pub fn is_category(&self) -> bool ``` Whether it is a category. ### `send` ```rust pub fn send>(&self, options: impl Into) -> Result ``` Posts a message: text (`channel.send("hi")`), or `MessageOptions` with embeds, files and the message it answers. An embed's pictures and the files are uploaded first, each once, over this member's post-quantum connection to the host. # Errors A broken embed or more than 10 files and pictures (`Error::Protocol`, before anything is uploaded); embeds to a host that does not keep them (`Error::Unsupported`); a failed upload; or the host refused (no `SEND_MESSAGES`, `EMBED_LINKS` or `ATTACH_FILES`, slowmode, too long) or did not answer. ### `send_pending` ```rust pub fn send_pending>(&self, options: impl Into) -> Result ``` Posts like `send` but returns at once with the message as it will look, so it can be shown before the host answers (it takes a relay round trip or two). The outcome comes as `Event::MessageSent` or `Event::MessageSendFailed` with the same `pending` number. Text posts keep their order; a post with files uploads them first and may land after text sent later. # Errors What `send` refuses before anything leaves (a broken embed, too many files, a host without embeds), not yet a member, or the client stopped. ### `send_files` ```rust pub fn send_files>(&self, content: &str, paths: &[impl AsRef]) -> Result ``` Posts `content` with the files at `paths` attached (each uploaded first, over this member's post-quantum connection to the host). # Errors A file the host would not take (too large, a file server it does not use), a failed upload, or as `send`. ### `messages` ```rust pub fn messages(&self, before: Option, limit: u32) -> Result> ``` Up to `limit` messages before sequence `before` (the newest without it), oldest first. # Errors The host refused (no `READ_MESSAGE_HISTORY`) or did not answer. ### `delete` ```rust pub fn delete(&self) -> Result<()> ``` Deletes the channel or category. # Errors The host refused or did not answer. ### `participants` ```rust pub fn participants(&self) -> Vec ``` Who is in this voice channel now (no key material). ### `join` ```rust pub fn join(&self) -> Result ``` Joins this voice channel: relayed through the host's TURN server, every frame sealed end to end. See `VoiceSession`. # Errors Not a voice channel, already in voice in this community, a host media policy this client does not accept, no relay to be had, or the host refused. ### `join_with` ```rust pub fn join_with(&self, options: VoiceOptions) -> Result ``` `join` with `options` (a direct path, joining muted or deafened). # Errors As `join`. ### `message` ```rust pub fn message(&self, id: MessageId) -> PartialMessage ``` The message `id` in this channel, to act on without fetching it. ## Trait implementations `Clone`, `Debug`, `Display`, `PartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.Channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-client/ --- # Struct Client > A Zaun client. Clones share one SimpleX client and one driver; methods may be called from any thread, and block until the host answers or the timeout passes. `zaun_client::Client` · Struct ```rust pub struct Client { … } ``` A Zaun client. Clones share one SimpleX client and one driver; methods may be called from any thread, and block until the host answers or the timeout passes. ## Methods ### `set_presence` ```rust pub fn set_presence(&self, status: PresenceStatus, activity: Option) -> Result<()> ``` Sets this member's status and activity in every community: `Online`, `Idle`, `Dnd` or `Invisible` (everyone else sees `Offline`). The host shows at most one change per 3 s; the latest call wins and is sent again after each reconnection. # Errors `Error::Closed` once the client stopped. ### `builder` ```rust pub fn builder>(dir: impl AsRef) -> ClientBuilder ``` A client whose SimpleX store and community state live in `dir`. ### `events` ```rust pub fn events(&self) -> impl Iterator + Send + 'static ``` The events, blocking for the next one; ends when the client stops. ### `next_event` ```rust pub fn next_event(&self, timeout: Duration) -> Option ``` The next event, or `None` when none arrives within `timeout` or the client stopped. ### `simplex` ```rust pub fn simplex(&self) -> &Client ``` The SimpleX client underneath, for what Zaun does not wrap. ### `now_ms` ```rust pub fn now_ms(&self) -> u64 ``` Milliseconds since the epoch, from the same clock the sessions use. ### `communities` ```rust pub fn communities(&self) -> Vec ``` The communities this client belongs to. ### `community` ```rust pub fn community(&self, id: CommunityId) -> Community ``` The community `id`, as an object that acts for itself. ### `join` ```rust pub fn join(&self, link: &str, display_name: &str) -> Result ``` Joins a community with an invitation link (`zaun://join/…`) under `display_name`, and returns it once the host admitted this member and its cache loaded (`Event::Ready` still comes). A member pending approval is admitted later, by a moderator. # Errors `Error::BadLink`, a refusal (expired, used up, banned), or a timeout. ### `create_community` ```rust pub fn create_community(&self, host_address: &str, host_key: PublicKey, name: &str, display_name: &str) -> Result ``` Creates a community named `name` on the host at `host_address` whose public key is `host_key` (what `zaun-host id` prints), as its owner `display_name`. The community's root key is made here and kept in `/zaun//root.key` (mode 0600): it is the community's identity, so back it up. The host must allow the creation. # Errors The host refused (creation closed) or did not answer. ### `create_community_with_root` ```rust pub fn create_community_with_root(&self, host_address: &str, host_key: PublicKey, name: &str, display_name: &str, root: SecretKey) -> Result ``` `create_community` with a root key made beforehand, so its community id (`protocol::crypto::community_id`) can be allow-listed on the host first. # Errors As `create_community`. ### `command` ```rust pub fn command(&self, community: CommunityId, channel: Option, body: B) -> Result<::Response> ``` Sends any command and decodes its answer: the escape hatch for every command without a typed method. `channel` is the envelope's channel, for channel commands. # Errors `Error::Refused` with the host's error, `Error::UnknownCommunity`, or a timeout. ### `command_named` ```rust pub fn command_named(&self, community: CommunityId, channel: Option, name: &str, body: Value) -> Result ``` Sends the command called `name` (`"channel.update"`, …) with its body as JSON (the specification's field names) and answers the response body as JSON: `command` for a program that picks commands at run time. The body is checked as that command's type before it is sent. `session.hello` and signals are not sent this way. [`command`]: Self::command # Errors `Error::Protocol` for an unknown name or a body that does not fit it; then as `command`. ### `close` ```rust pub fn close(&self) ``` Stops the driver and the SimpleX client after saving state. Other clones stop too. ### `moderate_voice` ```rust pub fn moderate_voice(&self, community: CommunityId, action: Moderate) -> Result<()> ``` Server-mutes, server-deafens, moves or disconnects a member in voice (`voice.moderate`; `MUTE_MEMBERS`, `DEAFEN_MEMBERS`, `MOVE_MEMBERS`). # Errors The host refused (missing permission, rank) or did not answer. ## Trait implementations `Clone` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/client/struct.Client.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-clientbuilder/ --- # Struct ClientBuilder > Configures a `Client`. The directory holds the SimpleX store and `zaun/`, the community keys and state; give every client its own. `zaun_client::ClientBuilder` · Struct ```rust pub struct ClientBuilder { … } ``` Configures a `Client`. The directory holds the SimpleX store and `zaun/`, the community keys and state; give every client its own. ## Methods ### `name` ```rust pub fn name>(self, name: impl Into) -> Self ``` The SimpleX profile name a new store starts with. ### `key` ```rust pub fn key>(self, key: impl Into) -> Self ``` The store passphrase. ### `relay` ```rust pub fn relay>(self, address: impl Into) -> Self ``` Adds a relay: an SMP server (`smp://…`) or an XFTP file server (`xftp://…`). With no SMP server the official SimpleX servers are used, and with them the official file servers unless an `xftp://` one is given. Uploads go only to these file servers, so they must be among the ones a community's host downloads from (`CommunityData::attachments`). ### `log` ```rust pub fn log(self, sink: impl Write + Send + 'static) -> Self ``` Where the SimpleX client logs (stderr by default). ### `timeout` ```rust pub const fn timeout(self, timeout: Duration) -> Self ``` How long a command waits for the host's answer (60 s by default). ### `join_timeout` ```rust pub const fn join_timeout(self, timeout: Duration) -> Self ``` How long a join or a community creation may take, connection included (120 s). ### `transfer_timeout` ```rust pub const fn transfer_timeout(self, timeout: Duration) -> Self ``` How long an attachment upload or download may take (10 minutes by default). ### `start` ```rust pub fn start(self) -> Result ``` Starts the SimpleX client and reconnects every saved community. # Errors The SimpleX client failed to start (wrong passphrase, unreadable store). [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/builder/struct.ClientBuilder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-community/ --- # Struct Community > A community this client belongs to (or did: a handle outlives a leave). `zaun_client::Community` · Struct ```rust pub struct Community { … } ``` A community this client belongs to (or did: a handle outlives a leave). ## Methods ### `dms` ```rust pub fn dms(&self) -> Vec ``` This member's open DMs, from the cache. ### `fetch_dms` ```rust pub fn fetch_dms(&self) -> Result> ``` Reloads the open DMs from the host. # Errors The host refused or did not answer. ### `dm_settings` ```rust pub fn dm_settings(&self) -> Result ``` This member's DM setting. # Errors The host refused or did not answer. ### `set_dms_from_bots` ```rust pub fn set_dms_from_bots(&self, allow: bool) -> Result ``` Lets bots open DMs with this member (`true`), or not. # Errors The host refused or did not answer. ### `presences` ```rust pub fn presences(&self) -> Vec ``` The presence of every member who is not offline. ### `set_status_text` ```rust pub fn set_status_text(&self, text: Option<&str>, emoji: Option<&str>, expires_at: Option) -> Result ``` Sets this member's custom status here (text, emoji, and when the host clears it, ms); `None` for both text and emoji clears it. Everyone else gets a member update. # Errors The host's refusal (`PAYLOAD_TOO_LARGE` past 128 characters, `BAD_REQUEST`), or a connection error. ### `commands` ```rust pub fn commands(&self) -> Vec ``` Every bot command in the community, as last heard (each with its `bot_id`). ### `bots` ```rust pub fn bots(&self) -> Vec ``` The installed bots' public cards, as last heard. ### `fetch_bots` ```rust pub fn fetch_bots(&self) -> Result> ``` Asks the host for every bot's card (owners also get each bot's full request). # Errors The host refused or did not answer. ### `bot` ```rust pub fn bot(&self, bot: BotId) -> Result ``` Asks the host for one bot's card. # Errors The host refused (`NOT_FOUND`) or did not answer. ### `install_bot` ```rust pub fn install_bot(&self, package: AttachmentId, grants: Option, role_position: Option) -> Result ``` Owner only: installs the `.zbot` package uploaded as `package` (an attachment not on a message). `grants` absent: everything the manifest asks for, within the host's ceiling. # Errors The host refused (not the owner, a bad package, over the ceiling) or did not answer. ### `update_bot` ```rust pub fn update_bot(&self, bot: BotId, package: AttachmentId) -> Result ``` Owner only: updates a bot to a newer package of the same publisher. # Errors As `install_bot`. ### `grant_bot` ```rust pub fn grant_bot(&self, bot: BotId, permissions: Option, capabilities: Option) -> Result ``` Owner only: replaces a bot's grants (approves a waiting update when it covers it). # Errors The host refused or did not answer. ### `enable_bot` ```rust pub fn enable_bot(&self, bot: BotId) -> Result ``` Owner only: starts a disabled bot. # Errors The host refused or did not answer. ### `disable_bot` ```rust pub fn disable_bot(&self, bot: BotId) -> Result ``` Owner only: stops a bot and hides its commands. # Errors The host refused or did not answer. ### `remove_bot` ```rust pub fn remove_bot(&self, bot: BotId, keep_data: bool) -> Result<()> ``` Owner only: removes a bot, its role and commands (and its data unless `keep_data`). # Errors The host refused or did not answer. ### `register_bot` ```rust pub fn register_bot(&self, member: &Member, name: Option<&str>) -> Result ``` Owner only: marks `member` (a client connected over SimpleX) as an external bot. # Errors The host refused or did not answer. ### `set_commands` ```rust pub fn set_commands(&self, commands: Vec) -> Result> ``` As a bot: replaces this bot's whole command list; answers it with the host's ids. # Errors The host refused (this member is not a bot, a command breaks the rules). ### `configure_bot` ```rust pub fn configure_bot)>>(&self, bot: BotId, values: impl IntoIterator)>) -> Result> ``` Owner only: sets (`Some`) or clears (`None`, back to the default) the values of the settings `bot`'s manifest declares (its card's `config`), and answers every value the owner has set, a secret one as `"••••"` (`MASKED`). The bot gets them at once. Keys are `[a-z][a-z0-9_]{0,63}`, values ≤ 4 KiB, ≤ 32 of each. # Errors A malformed key or value (`Error::Protocol`), or the host refused: `FORBIDDEN` (not the owner), `NOT_FOUND` (no such bot), `BAD_REQUEST` with field `config.` (a key the manifest does not declare). Needs zaun-host 0.4.0. ### `bot_config` ```rust pub fn bot_config(&self, bot: BotId) -> Result> ``` Owner only: the values set for `bot`'s settings, a secret one as `"••••"`; a key not here uses its card's `default`. # Errors As `configure_bot`. ### `install_bot_from` ```rust pub fn install_bot_from(&self, package: AttachmentId, grants: Option, role_position: Option, source: InstallSource) -> Result ``` Owner only: `install_bot` with the registry `source` the package was verified against: the uploaded `catalog.json`, its signature and, for a version not in the catalog's `latest`, the uploaded history file. The host checks the source offline against its own registry keys; one that does not verify installs as `direct`. # Errors As `install_bot`, and `BAD_REQUEST` for a source that repeats an attachment or has a blank signature. ### `update_bot_from` ```rust pub fn update_bot_from(&self, bot: BotId, package: AttachmentId, source: InstallSource) -> Result ``` Owner only: `update_bot` with the registry `source` the new package was verified against, as for `install_bot_from`. # Errors As `install_bot_from`. ### `id` ```rust pub const fn id(&self) -> CommunityId ``` Its id. ### `data` ```rust pub fn data(&self) -> Option ``` A copy of the cache: the whole community as plain data, or `None` when this client does not belong to it (any more). ### `name` ```rust pub fn name(&self) -> String ``` Its name, from the descriptor the host's welcome proved (empty before). ### `description` ```rust pub fn description(&self) -> Option ``` Its description, from the same descriptor. ### `is_owner` ```rust pub fn is_owner(&self) -> bool ``` Whether this client owns it. ### `me` ```rust pub fn me(&self) -> Option ``` This client as a member of it. ### `channels` ```rust pub fn channels(&self) -> Vec ``` Its channels and categories this member can see, in order. ### `channel_by_name` ```rust pub fn channel_by_name(&self, name: &str) -> Option ``` The first channel named `name` (names are not unique). ### `channel` ```rust pub fn channel(&self, id: ChannelId) -> Channel ``` The channel `id`, known to the cache or not. ### `roles` ```rust pub fn roles(&self) -> Vec ``` Its roles, highest first. ### `role_by_name` ```rust pub fn role_by_name(&self, name: &str) -> Option ``` The first role named `name`. ### `role` ```rust pub fn role(&self, id: RoleId) -> Role ``` The role `id`, known to the cache or not. ### `members` ```rust pub fn members(&self) -> Vec ``` The members the cache has heard of; `fetch_members` loads them all. ### `member` ```rust pub fn member(&self, id: MemberId) -> Member ``` The member `id`, known to the cache or not. ### `fetch_members` ```rust pub fn fetch_members(&self) -> Result> ``` Loads every member into the cache. # Errors The host refused or did not answer. ### `create_channel` ```rust pub fn create_channel(&self, name: &str, kind: ChannelKind) -> Result ``` Makes a channel of `kind` named `name`. # Errors The host refused (no `MANAGE_CHANNELS`) or did not answer. ### `create_channel_in` ```rust pub fn create_channel_in(&self, parent: &Channel, name: &str, kind: ChannelKind) -> Result ``` Makes a channel of `kind` named `name` inside the category `parent`. # Errors As `create_channel`. ### `create_role` ```rust pub fn create_role(&self, name: &str, permissions: Permissions) -> Result ``` Makes a role named `name` with `permissions`. # Errors The host refused (no `MANAGE_ROLES`, or permissions this member lacks) or did not answer. ### `create_invite` ```rust pub fn create_invite(&self, max_uses: u32, expires_in: Option) -> Result ``` Makes an invitation link for `max_uses` joins (0: no limit), expiring after `expires_in` if given. The link is a secret: give it only to who should join. # Errors The host refused or did not answer. ### `leave` ```rust pub fn leave(&self) -> Result<()> ``` Leaves the community (the owner cannot). Once the host accepts, it is forgotten here: its state and member key leave the store, `Event::CommunityDelete` follows with `RemovalReason::Left`, and a later `Client::join` of it starts afresh. # Errors The host refused or did not answer. ### `hand_off` ```rust pub fn hand_off(&self, host_address: &str, host_key: PublicKey) -> Result ``` As the owner, hands the community to the host at `host_address` whose key is `host_key`; see `HandOff`. # Errors This client does not hold the root key, the host refused, or no answer came. ### `follow` ```rust pub fn follow(&self, host_address: &str, host_key: PublicKey) -> Result ``` Follows the community to the host the owner named, when no descriptor update arrived. # Errors The new host refused this member, or a timeout. ### `voice_channels` ```rust pub fn voice_channels(&self) -> Vec ``` This member's voice channels. ## Trait implementations `Clone`, `Debug`, `Display`, `PartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.Community.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-communitydata/ --- # Struct CommunityData > A community as this client last heard of it. Cheap to clone; a clone does not update. `zaun_client::CommunityData` · Struct ```rust pub struct CommunityData { … } ``` A community as this client last heard of it. Cheap to clone; a clone does not update. Every map is bounded by the community itself: entries leave when the host reports the channel, role or member gone. `members` holds the members this client has heard of (events, `Community::fetch_members`), not always all. ## Fields ### `id: CommunityId` The community. ### `me: MemberId` This client's member id in it. ### `is_owner: bool` Whether this client is the owner. ### `loaded: bool` The host's snapshot has loaded at least once (`Event::Ready` was said). ### `name: String` The community's name, from its descriptor as the host's welcome proved it (empty until then). ### `description: Option` Its description, from the same descriptor. ### `profile: Option` The host-managed profile, once the snapshot has it. ### `channels: BTreeMap` Channels and categories this member can see. ### `dms: BTreeMap` DM: this member's open direct messages with bots, by channel. Entries leave when the DM is closed here or the community is. ### `roles: BTreeMap` Roles, `@everyone` (`RoleId::EVERYONE`) included. ### `members: BTreeMap` Members heard of, this client included once the snapshot arrived. ### `attachments: Option` What the host takes as attachments (its largest file, the file servers it downloads from), from its last welcome; `None` before one, or when the host did not say. ### `capabilities: Vec` The capabilities this client and the host both support (`frag`, `embeds`, …), from the host's last welcome; empty before one. Replaced at each welcome, so it never grows. ### `commands: BTreeMap` The bots' application commands, each with its `bot_id`. A bot's whole list is replaced by `command.updated` and dropped with the bot, so it never outgrows the bots. ### `bots: BTreeMap` Installed bots' public cards; an entry leaves with `bot.removed`. ### `typing: BTreeMap` Typing: who else is typing per channel (`CommunityData::typing_in`). One entry per channel, replaced by each `signal.typing`, gone with the channel. ### `presences: BTreeMap` Presence: every member not offline, as others see them (`presence.list`, then each `signal.presence`); see `CommunityData::presence_of`. ## Methods ### `supports` ```rust pub fn supports(&self, capability: &str) -> bool ``` Whether the host's last welcome listed `capability`. ### `channel_by_name` ```rust pub fn channel_by_name(&self, name: &str) -> Option<&Channel> ``` The first channel named `name` (channel names are not unique). ### `role_by_name` ```rust pub fn role_by_name(&self, name: &str) -> Option<&Role> ``` The first role named `name`. ### `ordered_channels` ```rust pub fn ordered_channels(&self) -> Vec<&Channel> ``` Channels in display order: by position, categories' children after them. ### `permissions` ```rust pub fn permissions(&self, member: &MemberId, channel: Option<&ChannelId>, now_ms: u64) -> Option ``` What `member` may do in `channel` (or community-wide with `None`) at `now_ms`, or `None` when the member or the channel is not in the cache. ### `can` ```rust pub fn can(&self, member: &MemberId, channel: Option<&ChannelId>, bits: Permissions, now_ms: u64) -> bool ``` Whether `member` has every bit of `bits` in `channel` at `now_ms` (see `permissions`); `false` when the cache does not know. ### `can_use` ```rust pub fn can_use(&self, member: &MemberId, channel: &ChannelId, command: &ApplicationCommand, now_ms: u64) -> bool ``` Whether `member` may use bot command `command` in `channel`: `VIEW_CHANNEL` and `USE_APPLICATION_COMMANDS` there, plus the command's `default_member_permissions` (`"0"`: the owner only). As the rest of this view, it can show more than the host allows. ### `presence_of` ```rust pub fn presence_of(&self, member: MemberId) -> Presence ``` `member`'s presence (offline when the cache has none). ### `typing_in` ```rust pub fn typing_in(&self, channel: &ChannelId, now_ms: u64) -> Option<&TypingNow> ``` Who else is typing in `channel` at `now_ms`, if anyone. ### `typing_mode` ```rust pub fn typing_mode(&self, channel: &ChannelId) -> TypingMode ``` The channel's typing setting (`named` when the cache does not have the channel). ## Trait implementations `Clone`, `Debug`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/cache/struct.CommunityData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-dmchannel/ --- # Struct DmChannel > A DM channel: an ordinary channel object of kind `dm` with its two participants. `zaun_client::DmChannel` · Struct ```rust pub struct DmChannel { … } ``` A DM channel: an ordinary channel object of kind `dm` with its two participants. ## Fields ### `channel_id: ChannelId` The channel. ### `participants: [MemberId; 2]` Its two members, sorted. ### `rest: Map` The rest of the channel object, as the host sent it. ## Methods ### `between` ```rust pub fn between(channel_id: ChannelId, a: MemberId, b: MemberId) -> Self ``` A DM learnt only from a message in it: the two members, no other field. ### `from_channel` ```rust pub fn from_channel(channel: &Channel) -> Option ``` The DM a channel object describes; `None` for any other kind of channel, or a DM without exactly two participants. ### `other` ```rust pub fn other(&self, me: MemberId) -> MemberId ``` The participant who is not `me` (`me` when both are). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/dm/wire/struct.DmChannel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-editmessage/ --- # Struct EditMessage > An edit of one of this member's messages. A plain `&str` replaces the text and leaves the embeds and mentions as they are. `zaun_client::EditMessage` · Struct ```rust pub struct EditMessage { … } ``` An edit of one of this member's messages. A plain `&str` replaces the text and leaves the embeds and mentions as they are. An edit uploads nothing: an embed's pictures must be attachments the message already has (`Picture::Attachment`, or an `Attachment` of it). ## Methods ### `mention_member` ```rust pub fn mention_member(self, member: MemberId) -> Self ``` Notifies `member`, as `MessageOptions::mention_member`. Any mention on an edit replaces all of the message's mentions, and needs `SEND_MESSAGES`. ### `mention_role` ```rust pub fn mention_role(self, role: RoleId) -> Self ``` Notifies the members with `role`, as `MessageOptions::mention_role`. ### `mention_everyone` ```rust pub fn mention_everyone(self) -> Self ``` Notifies everyone who can see the channel (needs `MENTION_EVERYONE`; dropped without). ### `mentions` ```rust pub fn mentions(self, mentions: Mentions) -> Self ``` Replaces the message's mentions with exactly `mentions`; `Mentions::default` clears them, `@everyone` too. ### `mentions_from_content` ```rust pub const fn mentions_from_content(self) -> Self ``` Also notifies whoever the text shows (see `mention::parse`): the new text, or the message's own when the edit keeps it. The edit then always sends mentions, so text that shows none clears them. Only for text this member wrote. ### `new` ```rust pub fn new() -> Self ``` An edit that changes nothing yet: the text stays (a `Message` knows it; a `PartialMessage` needs `content`), and so do the embeds. ### `content` ```rust pub fn content>(self, content: impl Into) -> Self ``` The new text. ### `embed` ```rust pub fn embed>(self, embed: impl Into) -> Self ``` Replaces the embeds with these, starting with this one. ### `embeds` ```rust pub fn embeds, impl IntoIterator>>(self, embeds: impl IntoIterator>) -> Self ``` Replaces the embeds with `embeds` (none removes them all). ### `clear_embeds` ```rust pub fn clear_embeds(self) -> Self ``` Removes every embed. ## Trait implementations `Clone`, `Debug`, `Default`, `Eq`, `From<&String>`, `From<&str>`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/compose/options/struct.EditMessage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-embedbuilder/ --- # Struct EmbedBuilder > A rich embed, built with chained setters and sent with `MessageOptions::embed`: `zaun_client::EmbedBuilder` · Struct ```rust pub struct EmbedBuilder { … } ``` A rich embed, built with chained setters and sent with `MessageOptions::embed`: ```rust use zaun_client::{EmbedBuilder, MessageOptions, Picture}; let embed = EmbedBuilder::new() .title("Release 1.2") .url("https://example.com/releases/1.2") .description("What changed") .color(0x5865F2) .author("Release bot", None, Some(Picture::file("bot.png"))) .field("Fixes", "12", true) .field("Features", "3", true) .image(Picture::file("screenshot.png")) .footer("zaun", None); channel.send(MessageOptions::new().embed(embed))?; ``` ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty embed. One needs a title, a description, an author, a footer, a picture or a field to be sent. ### `title` ```rust pub fn title>(self, title: impl Into) -> Self ``` The title (1–256 characters). ### `description` ```rust pub fn description>(self, description: impl Into) -> Self ``` The text (1–4 096 characters). ### `url` ```rust pub fn url>(self, url: impl Into) -> Self ``` The title's link: `https://` only. A reader opens it by choice; nothing loads it. ### `color` ```rust pub const fn color(self, color: u32) -> Self ``` The colour of its edge, `0xRRGGBB`. ### `timestamp` ```rust pub const fn timestamp(self, ms: u64) -> Self ``` A time it shows, ms since the Unix epoch. ### `author` ```rust pub fn author>(self, name: impl Into, url: Option<&str>, icon: Option) -> Self ``` The author line: a name (1–256 characters), a link (`https://`) and a small picture. ### `footer` ```rust pub fn footer>(self, text: impl Into, icon: Option) -> Self ``` The footer line: a text (1–2 048 characters) and a small picture. ### `image` ```rust pub fn image>(self, picture: impl Into) -> Self ``` The large picture. ### `thumbnail` ```rust pub fn thumbnail>(self, picture: impl Into) -> Self ``` The small picture in the corner. ### `field` ```rust pub fn field, impl Into>(self, name: impl Into, value: impl Into, inline: bool) -> Self ``` Adds a field (name 1–256, value 1–1 024 characters; up to 25), shown beside the neighbouring inline fields when `inline`. ### `to_embed` ```rust pub fn to_embed(&self) -> Option ``` The embed as the protocol has it, when no picture is left to upload. ### `check` ```rust pub fn check(&self) -> Result<()> ``` Checks the embed against the protocol's rules (lengths, links, 25 fields, not empty), as sending it would, without uploading anything. # Errors `Error::Protocol` naming the field and the rule. ## Trait implementations `Clone`, `Debug`, `Default`, `Eq`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/compose/embed/struct.EmbedBuilder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ephemeralreply/ --- # Struct EphemeralReply > A bot's ephemeral reply (`EPHEMERAL`): only this member sees it, nothing stores it, and it lives as long as the interaction (15 minutes). Key it by its message's `message_id`. `zaun_client::EphemeralReply` · Struct ```rust pub struct EphemeralReply { … } ``` A bot's ephemeral reply (`EPHEMERAL`): only this member sees it, nothing stores it, and it lives as long as the interaction (15 minutes). Key it by its message's `message_id`. ## Fields ### `channel: Option` Where the interaction happened. ### `interaction: InteractionId` The interaction it answers. ### `op: EphemeralOp` Created, updated or deleted. ### `message: Option>` The message (absent when deleted). ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/bots/events/struct.EphemeralReply.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ffmpegoptions/ --- # Struct FfmpegOptions > How `AudioResource::ffmpeg_file` and its siblings transcode. `zaun_client::FfmpegOptions` · Struct ```rust pub struct FfmpegOptions { … } ``` How `AudioResource::ffmpeg_file` and its siblings transcode. ## Fields ### `bitrate_kbps: u32` Opus bitrate in kbit/s, 8 to 256 (default 128). ### `volume: Option` Gain, 0.0 to 4.0 (`None` leaves the volume alone). ### `seek: Option` Start this far in. ### `program: PathBuf` The ffmpeg program (default `ffmpeg`, found on `PATH`). ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/player/struct.FfmpegOptions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-handoff/ --- # Struct HandOff > What a hand-off signed and published: the new delegation and the descriptor naming it. `zaun_client::HandOff` · Struct ```rust pub struct HandOff { … } ``` What a hand-off signed and published: the new delegation and the descriptor naming it. ## Fields ### `descriptor: SignedJson` The descriptor, next revision, referencing `delegation`. ### `delegation: SignedJson` The delegation to the new host. ### `epoch: u64` Its epoch. ## Methods ### `import_json` ```rust pub fn import_json(&self) -> String ``` `{"descriptor": …, "delegation": …}`, the file `zaun-host import --descriptor` takes for a bundle exported before the hand-off. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/api/moves/struct.HandOff.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-interaction/ --- # Struct Interaction > Someone used one of this bot's commands, components or modals. Answer within 3 s (`respond`, or `Response::defer` first); follow-ups and edits work for 15 minutes. `zaun_client::Interaction` · Struct ```rust pub struct Interaction { … } ``` Someone used one of this bot's commands, components or modals. Answer within 3 s (`respond`, or `Response::defer` first); follow-ups and edits work for 15 minutes. ## Methods ### `id` ```rust pub fn id(&self) -> InteractionId ``` Its id. ### `kind` ```rust pub fn kind(&self) -> InteractionType ``` Command, component, autocomplete or modal submit. ### `data` ```rust pub fn data(&self) -> &Data ``` Everything the host sent. ### `channel` ```rust pub fn channel(&self) -> Channel ``` The channel it happened in. ### `member` ```rust pub fn member(&self) -> Member ``` Who used it. ### `command_name` ```rust pub fn command_name(&self) -> Option<&str> ``` The command's name, for a command or autocomplete. ### `options` ```rust pub fn options(&self) -> &[OptionValue] ``` The options given, for a command or autocomplete. ### `custom_id` ```rust pub fn custom_id(&self) -> Option<&str> ``` The clicked component's or submitted modal's `custom_id`. ### `field` ```rust pub fn field(&self, custom_id: &str) -> Option<&str> ``` A submitted modal input's text (`value`) by `custom_id`. ### `respond` ```rust pub fn respond(&self, response: Response) -> Result ``` Answers it (once, within 3 s). # Errors The host refused (too late, answered already, a body it does not accept). ### `reply` ```rust pub fn reply>(&self, content: impl Into) -> Result ``` Answers with a text message in the channel. # Errors As `respond`. ### `reply_ephemeral` ```rust pub fn reply_ephemeral>(&self, content: impl Into) -> Result ``` Answers with a message only the invoker sees. # Errors As `respond`. ### `followup` ```rust pub fn followup(&self, body: MessageBody) -> Result ``` Another message after the answer (up to 10, within 15 minutes). # Errors The host refused or did not answer. ### `edit_original` ```rust pub fn edit_original(&self, body: MessageBody) -> Result<()> ``` Edits the answer (ends a deferred "thinking…"); absent fields stay. # Errors The host refused or did not answer. ### `delete_original` ```rust pub fn delete_original(&self) -> Result<()> ``` Deletes the answer. # Errors The host refused or did not answer. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/bots/interaction/struct.Interaction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-interactionfailure/ --- # Struct InteractionFailure > An interaction that got no answer (the bot timed out, failed or is not running). `zaun_client::InteractionFailure` · Struct ```rust pub struct InteractionFailure { … } ``` An interaction that got no answer (the bot timed out, failed or is not running). ## Fields ### `channel: Option` Where the interaction happened. ### `interaction: InteractionId` The interaction. ### `reason: FailReason` Why. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/bots/events/struct.InteractionFailure.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-member/ --- # Struct Member > A member of a community. `zaun_client::Member` · Struct ```rust pub struct Member { … } ``` A member of a community. ## Methods ### `dm` ```rust pub fn dm(&self) -> Result ``` The DM with this member, opened if needed (a bot DMs a member; a member DMs a bot). # Errors `FORBIDDEN{reason:"dms_closed"}`, `RATE_LIMITED{category:"dms"}`, `NOT_FOUND`, or no answer. ### `send` ```rust pub fn send>(&self, options: impl Into) -> Result ``` Sends this member a direct message: opens the DM, then posts in it. # Errors What `dm` and `Channel::send` refuse. ### `presence` ```rust pub fn presence(&self) -> Presence ``` What this member is doing and whether they are online (offline when unknown). ### `status_text` ```rust pub fn status_text(&self) -> Option ``` Their custom status text, if they set one. ### `status_emoji` ```rust pub fn status_emoji(&self) -> Option ``` Their custom status emoji, if they set one. ### `bot_id` ```rust pub fn bot_id(&self) -> Option ``` The bot this member is, if it is one. ### `is_bot` ```rust pub fn is_bot(&self) -> bool ``` Whether this member is a bot. ### `can_use` ```rust pub fn can_use(&self, command: &ApplicationCommand, channel: &Channel) -> bool ``` Whether this member may use `command` in `channel` (a local view; the host decides). ### `mention` ```rust pub fn mention(&self) -> String ``` The text that shows a mention of this member, `<@id>`. ### `id` ```rust pub const fn id(&self) -> MemberId ``` Its id. ### `community` ```rust pub const fn community(&self) -> &Community ``` The community it belongs to. ### `data` ```rust pub fn data(&self) -> Option ``` The cache's copy, or `None` before the cache heard of this member (`Community::fetch_members`). ### `display_name` ```rust pub fn display_name(&self) -> String ``` Their name in this community. ### `is_me` ```rust pub fn is_me(&self) -> bool ``` Whether this member is this client. ### `roles` ```rust pub fn roles(&self) -> Vec ``` Their roles. ### `timed_out_until` ```rust pub fn timed_out_until(&self) -> Option ``` When a timeout ends, ms since the epoch; `None` when not timed out. ### `permissions` ```rust pub fn permissions(&self, channel: Option<&Channel>) -> Permissions ``` What this member may do in the community, or in `channel`, as the cache sees it; the host still decides. ### `can` ```rust pub fn can(&self, permission: Permissions, channel: Option<&Channel>) -> bool ``` Whether this member has `permission` (in `channel`), as the cache sees it. ### `add_role` ```rust pub fn add_role(&self, role: &Role) -> Result<()> ``` Gives this member `role`. # Errors The host refused (no `MANAGE_ROLES`, or a role above this member's) or did not answer. ### `remove_role` ```rust pub fn remove_role(&self, role: &Role) -> Result<()> ``` Takes `role` from this member. # Errors As `add_role`. ### `set_roles` ```rust pub fn set_roles(&self, add: &[&Role], remove: &[&Role]) -> Result<()> ``` Adds and removes roles in one command. # Errors As `add_role`. ### `kick` ```rust pub fn kick(&self, reason: Option<&str>) -> Result<()> ``` Removes this member; they may join again with a new invitation. # Errors The host refused (no `KICK_MEMBERS`, or a member above this one) or did not answer. ### `ban` ```rust pub fn ban(&self, reason: Option<&str>) -> Result<()> ``` Removes this member and keeps them out. # Errors The host refused (no `BAN_MEMBERS`) or did not answer. ### `timeout` ```rust pub fn timeout(&self, duration: Option, reason: Option<&str>) -> Result<()> ``` Times this member out for `duration`, or lifts it with `None`. # Errors The host refused (no `TIMEOUT_MEMBERS`) or did not answer. ### `fingerprint` ```rust pub fn fingerprint(&self) -> Option ``` The fingerprint of this member's key (this client's own, or the one pinned on first sight), to compare out of band. ## Trait implementations `Clone`, `Debug`, `Display`, `PartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.Member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-message/ --- # Struct Message > A message in a channel. `zaun_client::Message` · Struct ```rust pub struct Message { … } ``` A message in a channel. ## Methods ### `components` ```rust pub fn components(&self) -> &[Component] ``` Its buttons, selects and layout (bots only). ### `flags` ```rust pub const fn flags(&self) -> u32 ``` Its flags (`flags::*`). ### `is_loading` ```rust pub const fn is_loading(&self) -> bool ``` Whether a deferred bot reply is still "thinking…". ### `interaction` ```rust pub const fn interaction(&self) -> Option<&InteractionMetadata> ``` The interaction this bot reply answers. ### `click` ```rust pub fn click(&self, custom_id: &str, values: Vec) -> Result ``` Clicks a button, or chooses `values` in a select, of this message. # Errors The host refused (no such enabled component, values out of bounds). ### `mentions` ```rust pub const fn mentions(&self) -> &Mentions ``` Who it mentions, as the host honoured them: `everyone`, `members`, `roles`. For a message this client just posted, the ones it asked for. ### `mentions_member` ```rust pub fn mentions_member(&self, member: &Member) -> bool ``` Whether it mentions `member`: by id, by one of the member's roles (as the cache has them), or by `@everyone`. ### `mentions_me` ```rust pub fn mentions_me(&self) -> bool ``` Whether it mentions this client's member (a client notifies its member then, unless the message is `silent`). ### `silent` ```rust pub const fn silent(&self) -> bool ``` Sent with `SUPPRESS_NOTIFICATIONS`: its mentions notify nobody. ### `id` ```rust pub const fn id(&self) -> MessageId ``` Its id. ### `content` ```rust pub fn content(&self) -> &str ``` Its text (empty when it has embeds or attachments instead). ### `embeds` ```rust pub fn embeds(&self) -> &[Embed] ``` Its rich embeds. A picture names one of `attachments` (`attachment` finds it); nothing is fetched from elsewhere. ### `channel` ```rust pub const fn channel(&self) -> &Channel ``` The channel it is in. ### `community` ```rust pub const fn community(&self) -> &Community ``` The community it belongs to. ### `author` ```rust pub fn author(&self) -> Member ``` Who wrote it. ### `is_mine` ```rust pub fn is_mine(&self) -> bool ``` Whether this client wrote it. ### `sequence` ```rust pub const fn sequence(&self) -> u64 ``` Its position in the channel. ### `timestamp` ```rust pub const fn timestamp(&self) -> u64 ``` When the host accepted it, ms since the epoch. ### `reply_to` ```rust pub const fn reply_to(&self) -> Option ``` The message it answers. ### `attachments` ```rust pub fn attachments(&self) -> Vec ``` Its files; `Attachment::download` fetches one. ### `attachment` ```rust pub fn attachment(&self, id: AttachmentId) -> Option ``` One of its attachments, by id: an embed's picture, say. ### `reply` ```rust pub fn reply>(&self, options: impl Into) -> Result ``` Answers this message in its channel: text, or `MessageOptions`. # Errors As `Channel::send`. ### `edit` ```rust pub fn edit>(&mut self, options: impl Into) -> Result<()> ``` Edits this message (one of this member's): new text (`message.edit("…")`), or an `EditMessage` that also replaces or removes the embeds or the mentions. Text not given stays, and so do the mentions unless the edit names some (then they replace them all). Pictures of new embeds must be attachments the message already has. # Errors A picture still to upload or a broken embed (`Error::Protocol`), embeds to a host that does not keep them (`Error::Unsupported`), or the host refused or did not answer. ### `delete` ```rust pub fn delete(&self) -> Result<()> ``` Deletes this message (one's own, or any with `MANAGE_MESSAGES`). # Errors The host refused or did not answer. ### `react` ```rust pub fn react(&self, emoji: &str) -> Result<()> ``` Adds `emoji` as this member. # Errors The host refused or did not answer. ### `unreact` ```rust pub fn unreact(&self, emoji: &str) -> Result<()> ``` Takes this member's `emoji` off. # Errors The host refused or did not answer. ## Trait implementations `Clone`, `Debug`, `Display`, `From<&Message>`, `PartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.Message.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-messageoptions/ --- # Struct MessageOptions > A message to post: text, embeds, files and the message it answers. A plain `&str` is one with text only, so `channel.send("hi")` still reads as it did. `zaun_client::MessageOptions` · Struct ```rust pub struct MessageOptions { … } ``` A message to post: text, embeds, files and the message it answers. A plain `&str` is one with text only, so `channel.send("hi")` still reads as it did. ```rust use zaun_client::{EmbedBuilder, MessageOptions, Picture}; channel.send( MessageOptions::new() .content("Today's weather") .embed(EmbedBuilder::new().title("Sunny").image(Picture::file("map.png"))) .file("forecast.pdf"), )?; ``` ## Methods ### `mention_member` ```rust pub fn mention_member(self, member: MemberId) -> Self ``` Notifies `member` (write `mention::member` in the text to show where). Each member counts once; at most 50. ### `mention_role` ```rust pub fn mention_role(self, role: RoleId) -> Self ``` Notifies the members with `role` (`mention::role` shows it). The host drops a role that is not mentionable unless this member has `MENTION_EVERYONE`. At most 20. ### `mention_everyone` ```rust pub fn mention_everyone(self) -> Self ``` Notifies everyone who can see the channel (needs `MENTION_EVERYONE`; dropped without). ### `mentions` ```rust pub fn mentions(self, mentions: Mentions) -> Self ``` Notifies exactly `mentions`. ### `mentions_from_content` ```rust pub fn mentions_from_content(self) -> Self ``` Also notifies whoever the text shows (`<@id>`, `<@&id>`, `@everyone`; see `mention::parse`). Call it after `content`, and only for text this member wrote. ### `new` ```rust pub fn new() -> Self ``` An empty message; it needs text, an embed or a file. ### `content` ```rust pub fn content>(self, content: impl Into) -> Self ``` The text (up to 4 000 characters; may be empty beside an embed or a file). ### `embed` ```rust pub fn embed>(self, embed: impl Into) -> Self ``` Adds an embed (up to 10). Its pictures are uploaded with the message's files. ### `embeds` ```rust pub fn embeds, impl IntoIterator>>(self, embeds: impl IntoIterator>) -> Self ``` Adds embeds. ### `file` ```rust pub fn file>(self, path: impl Into) -> Self ``` Attaches the file at `path` (with the embeds' pictures, up to 10 files in all). A file that is also an embed's picture is uploaded once. ### `file_bytes` ```rust pub fn file_bytes, impl Into>>(self, name: impl Into, data: impl Into>) -> Self ``` Attaches `data` as a file named `name`. ### `reply_to` ```rust pub const fn reply_to(self, message: MessageId) -> Self ``` Posts it as an answer to `message`. ## Trait implementations `Clone`, `Debug`, `Default`, `Eq`, `From<&String>`, `From<&str>`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/compose/options/struct.MessageOptions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-modalopen/ --- # Struct ModalOpen > A bot asks this member to fill in a modal; submit it with `Channel::submit_modal` and `interaction` as the modal id. `zaun_client::ModalOpen` · Struct ```rust pub struct ModalOpen { … } ``` A bot asks this member to fill in a modal; submit it with `Channel::submit_modal` and `interaction` as the modal id. ## Fields ### `channel: Option` Where the interaction happened. ### `interaction: InteractionId` The interaction that opened it. ### `custom_id: String` The modal's `custom_id`. ### `title: String` Its title. ### `components: Vec` Labels and text displays. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/bots/events/struct.ModalOpen.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-partialmessage/ --- # Struct PartialMessage > A message known only by its id, as an edit, a deletion or a reaction names it: the client keeps no message history, so its text and author are not at hand. It acts like a `Message` `zaun_client::PartialMessage` · Struct ```rust pub struct PartialMessage { … } ``` A message known only by its id, as an edit, a deletion or a reaction names it: the client keeps no message history, so its text and author are not at hand. It acts like a `Message`. ## Methods ### `id` ```rust pub const fn id(&self) -> MessageId ``` Its id. ### `channel` ```rust pub const fn channel(&self) -> &Channel ``` Its channel. ### `community` ```rust pub const fn community(&self) -> &Community ``` Its community. ### `reply` ```rust pub fn reply>(&self, options: impl Into) -> Result ``` Answers this message in its channel: text, or `MessageOptions`. # Errors As `Channel::send`. ### `edit` ```rust pub fn edit>(&self, options: impl Into) -> Result<()> ``` Edits this message (one of this member's): new text, or an `EditMessage` with its text and new embeds (whose pictures must be attachments the message already has) or mentions. # Errors No text given ([`Error::Protocol`]: a partial message does not know its own, and the protocol replaces it), or as `Message::edit`. ### `delete` ```rust pub fn delete(&self) -> Result<()> ``` Deletes this message (one's own, or any with `MANAGE_MESSAGES`). # Errors The host refused or did not answer. ### `react` ```rust pub fn react(&self, emoji: &str) -> Result<()> ``` Adds `emoji` as this member. # Errors The host refused or did not answer. ### `unreact` ```rust pub fn unreact(&self, emoji: &str) -> Result<()> ``` Takes this member's `emoji` off. # Errors The host refused or did not answer. ## Trait implementations `Clone`, `Debug`, `From<&Message>`, `PartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.PartialMessage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-pendingmessage/ --- # Struct PendingMessage > A post on its way (`Channel::send_pending`): what to show until the host answers. `zaun_client::PendingMessage` · Struct ```rust pub struct PendingMessage { … } ``` A post on its way (`Channel::send_pending`): what to show until the host answers. ## Fields ### `pending: u64` This client's number for it, named again by the outcome event. ### `channel: Channel` Where it was posted. ### `author: MemberId` This member. ### `content: String` Its text. ### `reply_to: Option` The message it answers, if any. ### `created_at: u64` When it was posted here, ms since the Unix epoch (the host's time comes with it). ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.PendingMessage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-presence/ --- # Struct Presence > A member's presence as everyone else sees it (`invisible` members look `Offline`). `zaun_client::Presence` · Struct ```rust pub struct Presence { … } ``` A member's presence as everyone else sees it (`invisible` members look `Offline`). ## Fields ### `member: MemberId` The member. ### `status: Status` `Online`, `Idle`, `Dnd` or `Offline`. ### `activity: Option` What they are doing, if they said. ## Methods ### `activity_line` ```rust pub fn activity_line(&self) -> Option ``` How clients show the activity: "Playing chess", "Listening to lofi radio", or the custom text with its emoji. ## Trait implementations `Clone`, `Debug`, `Eq`, `From<&PresenceSignal>`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/presence/struct.Presence.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-reaction/ --- # Struct Reaction > A reaction added or taken off. `zaun_client::Reaction` · Struct ```rust pub struct Reaction { … } ``` A reaction added or taken off. ## Fields ### `message: PartialMessage` The message. ### `emoji: String` The emoji. ### `member: Member` Who reacted. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/events/struct.Reaction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-registry-catalogcheck/ --- # Struct registry::CatalogCheck > `verify_catalog`'s answer: the registry's report and, when `ok`, the verified catalog. `zaun_client::registry::CatalogCheck` · Struct ```rust pub struct CatalogCheck { … } ``` `verify_catalog`'s answer: the registry's report and, when `ok`, the verified catalog. ## Fields ### `report: CatalogReport` The registry's report: `ok`, `installable`, `registry_id`, `seen`, `errors`, … ### `catalog: Option` The verified catalog, present only when `ok`. ## Methods ### `failed` ```rust pub fn failed(d: Diagnostic) -> Self ``` The answer of one failure. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/struct.CatalogCheck.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-registry-historycheck/ --- # Struct registry::HistoryCheck > `verify_history`'s answer: the registry's report and, when `ok`, the verified history. `zaun_client::registry::HistoryCheck` · Struct ```rust pub struct HistoryCheck { … } ``` `verify_history`'s answer: the registry's report and, when `ok`, the verified history. ## Fields ### `report: HistoryReport` The registry's report: `ok`, `versions`, `errors`. ### `history: Option` The verified history file, present only when `ok`. ## Methods ### `failed` ```rust pub fn failed(d: Diagnostic) -> Self ``` The answer of one failure. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/struct.HistoryCheck.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-registry-keyidreport/ --- # Struct registry::KeyIdReport > `key_id`'s answer. `zaun_client::registry::KeyIdReport` · Struct ```rust pub struct KeyIdReport { … } ``` `key_id`'s answer. ## Fields ### `ok: bool` Whether the text is a public key. ### `id: Option` The key's id (a registry id for a registry key), base64url. ### `errors: Vec` Why it is not a key. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/registry/struct.KeyIdReport.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-response/ --- # Struct Response > What a bot answers an interaction with. Build one with the constructors. `zaun_client::Response` · Struct ```rust pub struct Response { … } ``` What a bot answers an interaction with. Build one with the constructors. ## Methods ### `message` ```rust pub fn message(body: MessageBody) -> Self ``` A message in the channel (type 4). ### `text` ```rust pub fn text>(content: impl Into) -> Self ``` A text message in the channel. ### `ephemeral` ```rust pub fn ephemeral(body: MessageBody) -> Self ``` A message only the invoker sees (type 4 with `EPHEMERAL`). ### `defer` ```rust pub fn defer(ephemeral: bool) -> Self ``` "Thinking…" now, the message later with `edit_original` (type 5). ### `defer_update` ```rust pub const fn defer_update() -> Self ``` Acknowledge a component click without a visible change yet (type 6). ### `update` ```rust pub fn update(body: MessageBody) -> Self ``` Edit the message holding the clicked component (type 7). ### `choices` ```rust pub fn choices(choices: Vec) -> Self ``` Autocomplete suggestions, up to 25 (type 8). ### `show` ```rust pub fn show(modal: Modal) -> Self ``` Open `modal` (type 9). ### `modal` ```rust pub fn modal, impl Into>(custom_id: impl Into, title: impl Into, components: Vec) -> Self ``` Open a modal (type 9): 1–5 labels or text displays. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/bots/respond/struct.Response.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-role/ --- # Struct Role > A role of a community. `zaun_client::Role` · Struct ```rust pub struct Role { … } ``` A role of a community. ## Methods ### `managed_by` ```rust pub fn managed_by(&self) -> Option ``` The bot whose managed role this is: only that bot holds it, and only the owner's grants change it. ### `mention` ```rust pub fn mention(&self) -> String ``` The text that shows a mention of this role, `<@&id>`. ### `id` ```rust pub const fn id(&self) -> RoleId ``` Its id. ### `community` ```rust pub const fn community(&self) -> &Community ``` The community it belongs to. ### `data` ```rust pub fn data(&self) -> Option ``` The cache's copy, or `None` when the cache does not have it. ### `name` ```rust pub fn name(&self) -> String ``` Its name (empty when the cache does not have it). ### `permissions` ```rust pub fn permissions(&self) -> Permissions ``` Its permissions. ### `delete` ```rust pub fn delete(&self) -> Result<()> ``` Deletes the role. # Errors The host refused or did not answer. ## Trait implementations `Clone`, `Debug`, `Display`, `PartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/objects/struct.Role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-suggestions/ --- # Struct Suggestions > A bot's suggestions for the option this member is typing. `zaun_client::Suggestions` · Struct ```rust pub struct Suggestions { … } ``` A bot's suggestions for the option this member is typing. ## Fields ### `community: Community` The community. ### `channel: Option` Where the interaction happened. ### `interaction: InteractionId` The autocomplete interaction. ### `choices: Vec` Up to 25. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/bots/events/struct.Suggestions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-typingseen/ --- # Struct TypingSeen > A typing state and when it stops showing. `zaun_client::TypingSeen` · Struct ```rust pub struct TypingSeen { … } ``` A typing state and when it stops showing. ## Fields ### `now: TypingNow` Who is typing. ### `until_ms: u64` When it stops showing, ms since the epoch (this client's clock). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/typing/struct.TypingSeen.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-actionrow/ --- # Struct ui::ActionRow > A row of up to five buttons, or one select. `zaun_client::ui::ActionRow` · Struct ```rust pub struct ActionRow(…) ``` A row of up to five buttons, or one select. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty row. ### `buttons` ```rust pub fn buttons>(buttons: impl IntoIterator) -> Self ``` A row of buttons. ### `select` ```rust pub fn select(select: Select) -> Self ``` A row holding one select. ### `button` ```rust pub fn button(self, button: Button) -> Self ``` Adds a button. ### `build` ```rust pub fn build(self) -> Component ``` The component. ## Trait implementations `Clone`, `Debug`, `Default`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/select/struct.ActionRow.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-button/ --- # Struct ui::Button > A button: one that sends an interaction (`custom_id`), or a link the reader confirms. `zaun_client::ui::Button` · Struct ```rust pub struct Button(…) ``` A button: one that sends an interaction (`custom_id`), or a link the reader confirms. ## Methods ### `primary` ```rust pub fn primary, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A blue button. ### `secondary` ```rust pub fn secondary, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A grey button. ### `success` ```rust pub fn success, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A green button. ### `danger` ```rust pub fn danger, impl Into>(custom_id: impl Into, label: impl Into) -> Self ``` A red button. ### `link` ```rust pub fn link, impl Into>(url: impl Into, label: impl Into) -> Self ``` A link (`https://` only); readers confirm before it opens. ### `emoji` ```rust pub fn emoji>(self, emoji: impl Into) -> Self ``` Adds a Unicode emoji. ### `disabled` ```rust pub const fn disabled(self, disabled: bool) -> Self ``` Shown but not clickable. ### `build` ```rust pub fn build(self) -> Component ``` The component. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/button/struct.Button.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-checkbox/ --- # Struct ui::Checkbox > One yes/no box (type 23); never required. `zaun_client::ui::Checkbox` · Struct ```rust pub struct Checkbox ``` One yes/no box (type 23); never required. ## Methods ### `new` ```rust pub fn new>(custom_id: impl Into) -> Component ``` The input. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/modal/struct.Checkbox.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-checkboxgroup/ --- # Struct ui::CheckboxGroup > Several choices (type 22). `zaun_client::ui::CheckboxGroup` · Struct ```rust pub struct CheckboxGroup ``` Several choices (type 22). ## Methods ### `new` ```rust pub fn new>(custom_id: impl Into, list: &[(&str, &str)]) -> Component ``` The input: 1–10 `(label, value)` options. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/modal/struct.CheckboxGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-commandbuilder/ --- # Struct ui::CommandBuilder > A slash, user or message command. `zaun_client::ui::CommandBuilder` · Struct ```rust pub struct CommandBuilder(…) ``` A slash, user or message command. ## Methods ### `slash` ```rust pub fn slash(name: &str, description: &str) -> Self ``` `/name`, lower case. ### `user` ```rust pub fn user(name: &str) -> Self ``` An entry in a member's menu. ### `message` ```rust pub fn message(name: &str) -> Self ``` An entry in a message's menu. ### `option` ```rust pub fn option(self, option: OptionBuilder) -> Self ``` Adds an option (slash commands). ### `permissions` ```rust pub const fn permissions(self, bits: Permissions) -> Self ``` Bits the invoker needs; empty means the owner only. ### `build` ```rust pub fn build(self) -> ApplicationCommand ``` The command. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/command/struct.CommandBuilder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-container/ --- # Struct ui::Container > A box around other components (type 17). `zaun_client::ui::Container` · Struct ```rust pub struct Container { … } ``` A box around other components (type 17). ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty container. ### `accent` ```rust pub const fn accent(self, rgb: u32) -> Self ``` Its accent colour, `0xRRGGBB`. ### `text` ```rust pub fn text>(self, content: impl Into) -> Self ``` Adds markdown text. ### `push` ```rust pub fn push(self, component: Component) -> Self ``` Adds any layout component (section, gallery, file, separator). ### `row` ```rust pub fn row(self, row: ActionRow) -> Self ``` Adds a row. ### `build` ```rust pub fn build(self) -> Component ``` The component. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.Container.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-file/ --- # Struct ui::File > One attached file (type 13). `zaun_client::ui::File` · Struct ```rust pub struct File ``` One attached file (type 13). ## Methods ### `new` ```rust pub const fn new(file: AttachmentId) -> Component ``` The component. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.File.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-fileupload/ --- # Struct ui::FileUpload > Files the member uploads (type 19). `zaun_client::ui::FileUpload` · Struct ```rust pub struct FileUpload ``` Files the member uploads (type 19). ## Methods ### `new` ```rust pub fn new>(custom_id: impl Into, max: u32) -> Component ``` The input: up to `max` files. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/modal/struct.FileUpload.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-mediagallery/ --- # Struct ui::MediaGallery > Up to ten pictures (type 12). `zaun_client::ui::MediaGallery` · Struct ```rust pub struct MediaGallery ``` Up to ten pictures (type 12). ## Methods ### `new` ```rust pub fn new(media: &[AttachmentId]) -> Component ``` The component. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.MediaGallery.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-modal/ --- # Struct ui::Modal > A modal: up to five labelled inputs and texts. `zaun_client::ui::Modal` · Struct ```rust pub struct Modal { … } ``` A modal: up to five labelled inputs and texts. ## Fields ### `custom_id: String` Its `custom_id`. ### `title: String` Its title. ### `components: Vec` Its labels and texts. ## Methods ### `new` ```rust pub fn new, impl Into>(custom_id: impl Into, title: impl Into) -> Self ``` An empty modal. ### `field` ```rust pub fn field>(self, label: impl Into, input: Component) -> Self ``` Adds any input (radio, checkbox, file upload, …) under `label`. ### `input` ```rust pub fn input>(self, label: impl Into, input: TextInput) -> Self ``` Adds a text field under `label`. ### `select` ```rust pub fn select>(self, label: impl Into, select: Select) -> Self ``` Adds a select under `label`. ### `text` ```rust pub fn text>(self, content: impl Into) -> Self ``` Adds markdown text. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/modal/struct.Modal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-optionbuilder/ --- # Struct ui::OptionBuilder > An option of a slash command. `zaun_client::ui::OptionBuilder` · Struct ```rust pub struct OptionBuilder(…) ``` An option of a slash command. ## Methods ### `new` ```rust pub fn new(kind: OptionType, name: &str, description: &str) -> Self ``` An option of `kind`. ### `string` ```rust pub fn string(name: &str, description: &str) -> Self ``` Text. ### `integer` ```rust pub fn integer(name: &str, description: &str) -> Self ``` A whole number. ### `user` ```rust pub fn user(name: &str, description: &str) -> Self ``` A member. ### `required` ```rust pub const fn required(self) -> Self ``` Must be given. ### `autocomplete` ```rust pub const fn autocomplete(self) -> Self ``` The bot suggests values as the member types. ### `choice` ```rust pub fn choice(self, name: &str, value: &str) -> Self ``` A fixed string choice. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/command/struct.OptionBuilder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-radiogroup/ --- # Struct ui::RadioGroup > One choice among options (type 21). `zaun_client::ui::RadioGroup` · Struct ```rust pub struct RadioGroup ``` One choice among options (type 21). ## Methods ### `new` ```rust pub fn new>(custom_id: impl Into, list: &[(&str, &str)]) -> Component ``` The input: 2–10 `(label, value)` options. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/modal/struct.RadioGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-section/ --- # Struct ui::Section > One to three texts with a button or thumbnail beside them (type 9). `zaun_client::ui::Section` · Struct ```rust pub struct Section ``` One to three texts with a button or thumbnail beside them (type 9). ## Methods ### `with_button` ```rust pub fn with_button(texts: &[&str], button: Button) -> Component ``` Texts with a button. ### `with` ```rust pub fn with(texts: &[&str], accessory: Component) -> Component ``` Texts with `accessory` (a button or a `Thumbnail`). ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.Section.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-select/ --- # Struct ui::Select > A select menu. `zaun_client::ui::Select` · Struct ```rust pub struct Select(…) ``` A select menu. ## Methods ### `strings` ```rust pub fn strings>(custom_id: impl Into, options: &[(&str, &str)]) -> Self ``` Choices of `(label, value)`. ### `entities` ```rust pub fn entities>(kind: EntityKind, custom_id: impl Into) -> Self ``` Members, roles or channels. ### `placeholder` ```rust pub fn placeholder>(self, text: impl Into) -> Self ``` The text shown before a choice. ### `range` ```rust pub fn range(self, min: u32, max: u32) -> Self ``` How many may be chosen. ### `build` ```rust pub fn build(self) -> Component ``` The component. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/select/struct.Select.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-separator/ --- # Struct ui::Separator > A line or a gap (type 14). `zaun_client::ui::Separator` · Struct ```rust pub struct Separator ``` A line or a gap (type 14). ## Methods ### `line` ```rust pub const fn line() -> Component ``` A divider line. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.Separator.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-textdisplay/ --- # Struct ui::TextDisplay > Markdown text (type 10). `zaun_client::ui::TextDisplay` · Struct ```rust pub struct TextDisplay ``` Markdown text (type 10). ## Methods ### `new` ```rust pub fn new>(content: impl Into) -> Component ``` The component. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.TextDisplay.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-textinput/ --- # Struct ui::TextInput > A text field. `zaun_client::ui::TextInput` · Struct ```rust pub struct TextInput(…) ``` A text field. ## Methods ### `short` ```rust pub fn short>(custom_id: impl Into) -> Self ``` One line. ### `paragraph` ```rust pub fn paragraph>(custom_id: impl Into) -> Self ``` Several lines. ### `length` ```rust pub const fn length(self, min: u32, max: u32) -> Self ``` Length bounds. ### `required` ```rust pub const fn required(self, required: bool) -> Self ``` Whether it must be filled (default yes). ### `placeholder` ```rust pub fn placeholder>(self, text: impl Into) -> Self ``` Grey text shown while empty. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/modal/struct.TextInput.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-ui-thumbnail/ --- # Struct ui::Thumbnail > A picture beside a section (type 11). `zaun_client::ui::Thumbnail` · Struct ```rust pub struct Thumbnail ``` A picture beside a section (type 11). ## Methods ### `new` ```rust pub const fn new(media: AttachmentId) -> Component ``` The component; `media` is an image attachment of the message. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/ui/layout/struct.Thumbnail.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-voiceleave/ --- # Struct VoiceLeave > Why someone left a voice channel. `zaun_client::VoiceLeave` · Struct ```rust pub struct VoiceLeave { … } ``` Why someone left a voice channel. ## Fields ### `reason: VoiceLeftReason` Why. ### `moved_to: Option` The channel a moderator moved them to. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/events/struct.VoiceLeave.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-voicemute/ --- # Struct VoiceMute > Someone's mute and deafen state in a voice channel. `zaun_client::VoiceMute` · Struct ```rust pub struct VoiceMute { … } ``` Someone's mute and deafen state in a voice channel. ## Fields ### `self_mute: bool` Muted by themselves. ### `self_deaf: bool` Deafened by themselves. ### `server_mute: bool` Muted by a moderator. ### `server_deaf: bool` Deafened by a moderator. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/events/struct.VoiceMute.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-voiceoptions/ --- # Struct VoiceOptions > How a voice session connects. `zaun_client::VoiceOptions` · Struct ```rust pub struct VoiceOptions { … } ``` How a voice session connects. By default media goes through the host's TURN relay, and peers see only the relay's address. The relay sees this device's address and the encrypted frames. The relay is reached as the host lists it: `turn:` over UDP or TCP, or `turns:` over TLS 1.3 with the post-quantum X25519MLKEM768 key exchange (a relay without it is refused). ## Fields ### `allow_direct: bool` Also offer peers a direct path to this device's own address, when the host allows it (`ice_policy` `all` or `direct`). The other participants then learn this device's IP address, so ask the user first. Off by default: media is relayed, and a join to a host without a relay is refused. ### `host_ip: Option` The address the stay's socket binds to; `None` takes the address that reaches the TURN server (or, without one, the default route). It is offered to peers only with `allow_direct`. ### `self_mute: bool` Join muted. ### `self_deaf: bool` Join deafened. ### `turn_tls_roots: Vec>` Certificate authorities (DER) to trust for `turns:` relays besides the Mozilla roots, for a host whose relay has a certificate from a private authority. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/struct.VoiceOptions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-voicesession/ --- # Struct VoiceSession > One stay in a voice channel. Dropping it leaves the channel. `zaun_client::VoiceSession` · Struct ```rust pub struct VoiceSession { … } ``` One stay in a voice channel. Dropping it leaves the channel. ## Methods ### `community` ```rust pub const fn community(&self) -> CommunityId ``` The community. ### `channel` ```rust pub const fn channel(&self) -> ChannelId ``` The voice channel. ### `voice_session` ```rust pub const fn voice_session(&self) -> VoiceSessionId ``` This stay's voice session, as the host named it. ### `send_audio` ```rust pub fn send_audio(&self, frame: &[u8]) ``` Sends one Opus packet to every connected participant, sealed, now: the caller keeps the time (one packet per 20 ms for 20 ms packets). Its duration comes from its TOC byte. Frames are dropped while this member is muted (by itself or a moderator) or may not speak. To play files or streams in real time, `subscribe` to an `AudioPlayer` instead. ### `subscribe` ```rust pub fn subscribe(&self, player: &AudioPlayer) ``` Sends what `player` plays (discord.js's `connection.subscribe(player)`), instead of any player subscribed before. The player does not keep this session alive. ### `unsubscribe` ```rust pub fn unsubscribe(&self, player: &AudioPlayer) ``` Stops sending what `player` plays. ### `frames_refused` ```rust pub fn frames_refused(&self) -> u64 ``` How many frames arrived from participants and did not open (a wrong key, a damaged frame, one that was never sealed, or one sealed under an epoch this stay never had or no longer keeps, around joins and leaves); none are played. ### `can_send` ```rust pub fn can_send(&self) -> bool ``` Whether frames given to `send_audio` are sent now. ### `next_event` ```rust pub fn next_event(&self, timeout: Duration) -> Option ``` The next event, or `None` when none arrives within `timeout` or the session ended. ### `events` ```rust pub fn events(&self) -> impl Iterator + Send + 'static ``` The events, blocking; ends with the session. ### `set_self` ```rust pub fn set_self(&self, mute: Option, deaf: Option) -> Result<()> ``` Mutes or deafens this member (`voice.update`); deafened, incoming audio is dropped. # Errors The host refused or did not answer. ### `leave` ```rust pub fn leave(self) -> Result<()> ``` Leaves the channel (`voice.leave`) and closes every media connection. # Errors The host refused or did not answer; the media is closed either way. ## Trait implementations `Drop` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/voice/struct.VoiceSession.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/struct-voicestate/ --- # Struct VoiceState > Someone's state in a voice channel. `zaun_client::VoiceState` · Struct ```rust pub struct VoiceState { … } ``` Someone's state in a voice channel. ## Fields ### `member: Member` Who. ### `channel: Channel` The voice channel. ### `joined: bool` They joined it now. ### `left: Option` They left it now: why, and where to, when a moderator moved them. ### `mute: Option` Their mute and deafen state; `None` when they left. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/events/struct.VoiceState.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-client/type-alias-result/ --- # Type alias Result > `Result` with `Error`. `zaun_client::Result` · Type alias ```rust pub type Result = Result; ``` `Result` with `Error`. [Full rustdoc page](/docs/api/rust/zaun-client/zaun_client/error/type.Result.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-client-ack_linger_ms/ --- # Constant client::ACK_LINGER_MS > How long a due `sync.ack` waits for a command to go with. A SimpleX connection sends one message at a time, so a command sent right after a lone ack would wait a relay round trip b `zaun_community_protocol::client::ACK_LINGER_MS` · Constant ```rust pub const ACK_LINGER_MS: u64 = 250; ``` How long a due `sync.ack` waits for a command to go with. A SimpleX connection sends one message at a time, so a command sent right after a lone ack would wait a relay round trip behind it; the cadence (8 frames or 30 s) has room for this. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/session/constant.ACK_LINGER_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-client-client_capabilities/ --- # Constant client::CLIENT_CAPABILITIES > Capabilities this client offers in `session.hello`: fragment reassembly. `zaun_community_protocol::client::CLIENT_CAPABILITIES` · Constant ```rust pub const CLIENT_CAPABILITIES: &[&str] = _; ``` Capabilities this client offers in `session.hello`: fragment reassembly. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/constant.CLIENT_CAPABILITIES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-client-default_text_budget/ --- # Constant client::DEFAULT_TEXT_BUDGET > Default per-message text budget in UTF-8 bytes. The real value is fixed by the transport adapter from `simplex_client::limits`; this crate never depends on it. `zaun_community_protocol::client::DEFAULT_TEXT_BUDGET` · Constant ```rust pub const DEFAULT_TEXT_BUDGET: usize = 12_000; ``` Default per-message text budget in UTF-8 bytes. The real value is fixed by the transport adapter from `simplex_client::limits`; this crate never depends on it. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/constant.DEFAULT_TEXT_BUDGET.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-client-events_batch_type/ --- # Constant client::EVENTS_BATCH_TYPE > `type` of the coalesced event batch envelope. `zaun_community_protocol::client::EVENTS_BATCH_TYPE` · Constant ```rust pub const EVENTS_BATCH_TYPE: &str = "events"; ``` `type` of the coalesced event batch envelope. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/constant.EVENTS_BATCH_TYPE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-client-member-invite_link_prefix/ --- # Constant client::member::INVITE_LINK_PREFIX > The link scheme and path. `zaun_community_protocol::client::member::INVITE_LINK_PREFIX` · Constant ```rust pub const INVITE_LINK_PREFIX: &str = "zaun://join/"; ``` The link scheme and path. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/link/constant.INVITE_LINK_PREFIX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-attachment-caption_prefix/ --- # Constant command::attachment::CAPTION_PREFIX > What every Zaun file transfer's caption starts with; the attachment id follows. `zaun_community_protocol::command::attachment::CAPTION_PREFIX` · Constant ```rust pub const CAPTION_PREFIX: &str = "zaun-attachment:"; ``` What every Zaun file transfer's caption starts with; the attachment id follows. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/attachment/constant.CAPTION_PREFIX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-bot-masked/ --- # Constant command::bot::MASKED > How a secret value is shown. `zaun_community_protocol::command::bot::MASKED` · Constant ```rust pub const MASKED: &str = "••••"; ``` How a secret value is shown. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/constant.MASKED.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-lockdown-newcomer_window_max_s/ --- # Constant command::lockdown::NEWCOMER_WINDOW_MAX_S > Largest `newcomer_window_s`: 30 days. `zaun_community_protocol::command::lockdown::NEWCOMER_WINDOW_MAX_S` · Constant ```rust pub const NEWCOMER_WINDOW_MAX_S: u64 = _; ``` Largest `newcomer_window_s`: 30 days. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/lockdown/constant.NEWCOMER_WINDOW_MAX_S.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-audit_actions/ --- # Constant command::object::AUDIT_ACTIONS > Every audit action of the protocol, expanded from its `a.b|c` notation. `zaun_community_protocol::command::object::AUDIT_ACTIONS` · Constant ```rust pub const AUDIT_ACTIONS: &[&str] = _; ``` Every audit action of the protocol, expanded from its `a.b|c` notation. SPEC: governance the protocol names the ban entry `member.banned`; the protocol's `member.ban` is used. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/audit/constant.AUDIT_ACTIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-bot_events-groups/ --- # Constant command::object::bot_events::GROUPS > The groups a manifest may name, with their event types. `zaun_community_protocol::command::object::bot_events::GROUPS` · Constant ```rust pub const GROUPS: &[(&str, &[&str])] = _; ``` The groups a manifest may name, with their event types. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/events/constant.GROUPS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-ephemeral/ --- # Constant command::object::flags::EPHEMERAL > Only the invoker sees it; never stored. `zaun_community_protocol::command::object::flags::EPHEMERAL` · Constant ```rust pub const EPHEMERAL: u32 = 64; ``` Only the invoker sees it; never stored. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/flags/constant.EPHEMERAL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-is_components_v2/ --- # Constant command::object::flags::IS_COMPONENTS_V2 > The message is laid out by components only. `zaun_community_protocol::command::object::flags::IS_COMPONENTS_V2` · Constant ```rust pub const IS_COMPONENTS_V2: u32 = 32_768; ``` The message is laid out by components only. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/flags/constant.IS_COMPONENTS_V2.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-loading/ --- # Constant command::object::flags::LOADING > A deferred reply still loading; set only by the host. `zaun_community_protocol::command::object::flags::LOADING` · Constant ```rust pub const LOADING: u32 = 128; ``` A deferred reply still loading; set only by the host. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/flags/constant.LOADING.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-settable/ --- # Constant command::object::flags::SETTABLE > What a sender may set. `zaun_community_protocol::command::object::flags::SETTABLE` · Constant ```rust pub const SETTABLE: u32 = _; ``` What a sender may set. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/flags/constant.SETTABLE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-suppress_embeds/ --- # Constant command::object::flags::SUPPRESS_EMBEDS > Embeds are not shown. `zaun_community_protocol::command::object::flags::SUPPRESS_EMBEDS` · Constant ```rust pub const SUPPRESS_EMBEDS: u32 = 4; ``` Embeds are not shown. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/flags/constant.SUPPRESS_EMBEDS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-object-flags-suppress_notifications/ --- # Constant command::object::flags::SUPPRESS_NOTIFICATIONS > Mentions do not notify. `zaun_community_protocol::command::object::flags::SUPPRESS_NOTIFICATIONS` · Constant ```rust pub const SUPPRESS_NOTIFICATIONS: u32 = 4_096; ``` Mentions do not notify. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/flags/constant.SUPPRESS_NOTIFICATIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-reserved_commands/ --- # Constant command::RESERVED_COMMANDS > The reserved governance commands of the protocol: answered with `UNSUPPORTED_FEATURE`. `zaun_community_protocol::command::RESERVED_COMMANDS` · Constant ```rust pub const RESERVED_COMMANDS: &[&str] = _; ``` The reserved governance commands of the protocol: answered with `UNSUPPORTED_FEATURE`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/reserved/constant.RESERVED_COMMANDS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-command-reserved_namespaces/ --- # Constant command::RESERVED_NAMESPACES > Reserved `type` namespaces of the protocol (prefixes including the dot): answered with `UNSUPPORTED_COMMAND`; v1 clients ignore events in them. `zaun_community_protocol::command::RESERVED_NAMESPACES` · Constant ```rust pub const RESERVED_NAMESPACES: &[&str] = _; ``` Reserved `type` namespaces of the protocol (prefixes including the dot): answered with `UNSUPPORTED_COMMAND`; v1 clients ignore events in them. SPEC: `signal.*` is reserved only "beyond the protocol", so `signal.typing` and `signal.presence` are known commands and every other `signal.` name is reserved. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/reserved/constant.RESERVED_NAMESPACES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-label/ --- # Constant crypto::LABEL > RFC 10073 `Label` for `id-MLDSA65-Ed25519-SHA512` (ASCII, 30 bytes); the ML-DSA context. `zaun_community_protocol::crypto::LABEL` · Constant ```rust pub const LABEL: &[u8; 30] = b"COMPSIG-MLDSA65-Ed25519-SHA512"; ``` RFC 10073 `Label` for `id-MLDSA65-Ed25519-SHA512` (ASCII, 30 bytes); the ML-DSA context. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/constant.LABEL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-prefix/ --- # Constant crypto::PREFIX > RFC 10073 `Prefix` (ASCII, 32 bytes). `zaun_community_protocol::crypto::PREFIX` · Constant ```rust pub const PREFIX: &[u8; 32] = b"CompositeAlgorithmSignatures2025"; ``` RFC 10073 `Prefix` (ASCII, 32 bytes). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/constant.PREFIX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-secret_key_len/ --- # Constant crypto::SECRET_KEY_LEN > Length of SecretKey: `mldsaSeed` (32) ‖ `edSK` (32). `zaun_community_protocol::crypto::SECRET_KEY_LEN` · Constant ```rust pub const SECRET_KEY_LEN: usize = 64; ``` Length of [`SecretKey`]: `mldsaSeed` (32) ‖ `edSK` (32). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/secret/constant.SECRET_KEY_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-base_key_len/ --- # Constant crypto::voice::BASE_KEY_LEN > An SFrame base key: 32 bytes. `zaun_community_protocol::crypto::voice::BASE_KEY_LEN` · Constant ```rust pub const BASE_KEY_LEN: usize = 32; ``` An SFrame base key: 32 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.BASE_KEY_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-frames_per_key/ --- # Constant crypto::voice::FRAMES_PER_KEY > Frames one base key may seal before the sender must rekey (2^32: far beyond a session's length at 50 frames a second, and well inside AES-GCM's limits for distinct nonces). `zaun_community_protocol::crypto::voice::FRAMES_PER_KEY` · Constant ```rust pub const FRAMES_PER_KEY: u64 = _; ``` Frames one base key may seal before the sender must rekey (2^32: far beyond a session's length at 50 frames a second, and well inside AES-GCM's limits for distinct nonces). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/constant.FRAMES_PER_KEY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-header_max/ --- # Constant crypto::voice::HEADER_MAX > Longest header: config byte, 8-byte KID, 8-byte CTR. `zaun_community_protocol::crypto::voice::HEADER_MAX` · Constant ```rust pub const HEADER_MAX: usize = 17; ``` Longest header: config byte, 8-byte KID, 8-byte CTR. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/constant.HEADER_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-kem_ciphertext_len/ --- # Constant crypto::voice::KEM_CIPHERTEXT_LEN > X-Wing ciphertext (HPKE `enc`) length. `zaun_community_protocol::crypto::voice::KEM_CIPHERTEXT_LEN` · Constant ```rust pub const KEM_CIPHERTEXT_LEN: usize = 1120; ``` X-Wing ciphertext (HPKE `enc`) length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.KEM_CIPHERTEXT_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-kem_public_len/ --- # Constant crypto::voice::KEM_PUBLIC_LEN > X-Wing encapsulation (public) key length. `zaun_community_protocol::crypto::voice::KEM_PUBLIC_LEN` · Constant ```rust pub const KEM_PUBLIC_LEN: usize = 1216; ``` X-Wing encapsulation (public) key length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.KEM_PUBLIC_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-key_package_bytes_len/ --- # Constant crypto::voice::KEY_PACKAGE_BYTES_LEN > Canonical bytes of a key package (all fields are fixed width): 1 306 bytes. `zaun_community_protocol::crypto::voice::KEY_PACKAGE_BYTES_LEN` · Constant ```rust pub const KEY_PACKAGE_BYTES_LEN: usize = _; ``` Canonical bytes of a key package (all fields are fixed width): 1 306 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.KEY_PACKAGE_BYTES_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-key_package_wire_len/ --- # Constant crypto::voice::KEY_PACKAGE_WIRE_LEN > A key package on the wire: canonical bytes ‖ composite signature, 4 680 bytes. `zaun_community_protocol::crypto::voice::KEY_PACKAGE_WIRE_LEN` · Constant ```rust pub const KEY_PACKAGE_WIRE_LEN: usize = _; ``` A key package on the wire: canonical bytes ‖ composite signature, 4 680 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.KEY_PACKAGE_WIRE_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-max_recipients/ --- # Constant crypto::voice::MAX_RECIPIENTS > Most recipients one sender-keys message names (a mesh of 32 participants). `zaun_community_protocol::crypto::voice::MAX_RECIPIENTS` · Constant ```rust pub const MAX_RECIPIENTS: usize = 31; ``` Most recipients one sender-keys message names (a mesh of 32 participants). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.MAX_RECIPIENTS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-recipient_entry_len/ --- # Constant crypto::voice::RECIPIENT_ENTRY_LEN > One recipient entry: member id ‖ voice session ‖ SHA3-256 of the wrapped key. `zaun_community_protocol::crypto::voice::RECIPIENT_ENTRY_LEN` · Constant ```rust pub const RECIPIENT_ENTRY_LEN: usize = _; ``` One recipient entry: member id ‖ voice session ‖ SHA3-256 of the wrapped key. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.RECIPIENT_ENTRY_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-replay_window/ --- # Constant crypto::voice::REPLAY_WINDOW > Counters a receiver accepts behind the highest one seen (out-of-order delivery). `zaun_community_protocol::crypto::voice::REPLAY_WINDOW` · Constant ```rust pub const REPLAY_WINDOW: u64 = 128; ``` Counters a receiver accepts behind the highest one seen (out-of-order delivery). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/constant.REPLAY_WINDOW.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sender_keys_bytes_max/ --- # Constant crypto::voice::SENDER_KEYS_BYTES_MAX > Largest canonical sender-keys message: 2 090 bytes. `zaun_community_protocol::crypto::voice::SENDER_KEYS_BYTES_MAX` · Constant ```rust pub const SENDER_KEYS_BYTES_MAX: usize = _; ``` Largest canonical sender-keys message: 2 090 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.SENDER_KEYS_BYTES_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sender_keys_fixed_len/ --- # Constant crypto::voice::SENDER_KEYS_FIXED_LEN > Canonical bytes of a sender-keys message without its recipients. `zaun_community_protocol::crypto::voice::SENDER_KEYS_FIXED_LEN` · Constant ```rust pub const SENDER_KEYS_FIXED_LEN: usize = _; ``` Canonical bytes of a sender-keys message without its recipients. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.SENDER_KEYS_FIXED_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sender_keys_wire_max/ --- # Constant crypto::voice::SENDER_KEYS_WIRE_MAX > Largest sender-keys message on the wire: `u32` length ‖ bytes ‖ signature, 5 468 bytes. `zaun_community_protocol::crypto::voice::SENDER_KEYS_WIRE_MAX` · Constant ```rust pub const SENDER_KEYS_WIRE_MAX: usize = _; ``` Largest sender-keys message on the wire: `u32` length ‖ bytes ‖ signature, 5 468 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.SENDER_KEYS_WIRE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sframe_cipher_suite/ --- # Constant crypto::voice::SFRAME_CIPHER_SUITE > The SFrame cipher suite: `AES_256_GCM_SHA512_128`. `zaun_community_protocol::crypto::voice::SFRAME_CIPHER_SUITE` · Constant ```rust pub const SFRAME_CIPHER_SUITE: u16 = 0x0005; ``` The SFrame cipher suite: `AES_256_GCM_SHA512_128`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/constant.SFRAME_CIPHER_SUITE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-sframe_overhead_max/ --- # Constant crypto::voice::SFRAME_OVERHEAD_MAX > Most bytes SFrame adds to a frame: the longest header and the tag. `zaun_community_protocol::crypto::voice::SFRAME_OVERHEAD_MAX` · Constant ```rust pub const SFRAME_OVERHEAD_MAX: usize = _; ``` Most bytes SFrame adds to a frame: the longest header and the tag. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/constant.SFRAME_OVERHEAD_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-suite_v1/ --- # Constant crypto::voice::SUITE_V1 > The voice suite of protocol version 1: X-Wing KEM, HPKE (HKDF-SHA256, AES-256-GCM), SFrame `AES_256_GCM_SHA512_128`. Unknown suites are rejected (ADR-0011 agility rules). `zaun_community_protocol::crypto::voice::SUITE_V1` · Constant ```rust pub const SUITE_V1: u8 = 0x01; ``` The voice suite of protocol version 1: X-Wing KEM, HPKE (HKDF-SHA256, AES-256-GCM), SFrame `AES_256_GCM_SHA512_128`. Unknown suites are rejected (ADR-0011 agility rules). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.SUITE_V1.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-tag_len/ --- # Constant crypto::voice::TAG_LEN > AES-256-GCM tag length (HPKE and SFrame). `zaun_community_protocol::crypto::voice::TAG_LEN` · Constant ```rust pub const TAG_LEN: usize = 16; ``` AES-256-GCM tag length (HPKE and SFrame). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.TAG_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-crypto-voice-wrapped_key_len/ --- # Constant crypto::voice::WRAPPED_KEY_LEN > A wrapped sender key: `enc ‖ AES-256-GCM(base key) ‖ tag`, 1 168 bytes. `zaun_community_protocol::crypto::voice::WRAPPED_KEY_LEN` · Constant ```rust pub const WRAPPED_KEY_LEN: usize = _; ``` A wrapped sender key: `enc ‖ AES-256-GCM(base key) ‖ tag`, 1 168 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/constant.WRAPPED_KEY_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-envelope-events_type/ --- # Constant envelope::EVENTS_TYPE > The `type` of a batch envelope: a frame type, not an event type. `zaun_community_protocol::envelope::EVENTS_TYPE` · Constant ```rust pub const EVENTS_TYPE: &str = "events"; ``` The `type` of a batch envelope: a frame type, not an event type. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/events_batch/constant.EVENTS_TYPE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-envelope-max_json_integer/ --- # Constant envelope::MAX_JSON_INTEGER > Largest integer a JSON number may carry here (`2^53 − 1`, the protocol). `zaun_community_protocol::envelope::MAX_JSON_INTEGER` · Constant ```rust pub const MAX_JSON_INTEGER: u64 = _; ``` Largest integer a JSON number may carry here (`2^53 − 1`, the protocol). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/event_envelope/constant.MAX_JSON_INTEGER.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-envelope-response_type/ --- # Constant envelope::RESPONSE_TYPE > The `type` of every response envelope. `zaun_community_protocol::envelope::RESPONSE_TYPE` · Constant ```rust pub const RESPONSE_TYPE: &str = "response"; ``` The `type` of every response envelope. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/constant.RESPONSE_TYPE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-app_data-data_tag/ --- # Constant framing::app_data::DATA_TAG > The content type of a frame message (`MsgContent` `type`). `zaun_community_protocol::framing::app_data::DATA_TAG` · Constant ```rust pub const DATA_TAG: &str = "zaun"; ``` The content type of a frame message (`MsgContent` `type`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/app_data/constant.DATA_TAG.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-app_data-fallback_text/ --- # Constant framing::app_data::FALLBACK_TEXT > What an app that does not know `DATA_TAG` shows. Fixed: it never carries frame content. `zaun_community_protocol::framing::app_data::FALLBACK_TEXT` · Constant ```rust pub const FALLBACK_TEXT: &str = "Zaun community data (open it in a Zaun app)"; ``` What an app that does not know `DATA_TAG` shows. Fixed: it never carries frame content. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/app_data/constant.FALLBACK_TEXT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-app_data-frame_key/ --- # Constant framing::app_data::FRAME_KEY > The data key holding the frame message text. `zaun_community_protocol::framing::app_data::FRAME_KEY` · Constant ```rust pub const FRAME_KEY: &str = "f"; ``` The data key holding the frame message text. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/app_data/constant.FRAME_KEY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-frag_id_chars/ --- # Constant framing::FRAG_ID_CHARS > Length of an encoded `FragId` (8 bytes, base64url without padding). `zaun_community_protocol::framing::FRAG_ID_CHARS` · Constant ```rust pub const FRAG_ID_CHARS: usize = 11; ``` Length of an encoded `FragId` (8 bytes, base64url without padding). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/constant.FRAG_ID_CHARS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-fragment_prefix/ --- # Constant framing::FRAGMENT_PREFIX > Prefix of a fragment message. `zaun_community_protocol::framing::FRAGMENT_PREFIX` · Constant ```rust pub const FRAGMENT_PREFIX: &str = "zaun:1f:"; ``` Prefix of a fragment message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/constant.FRAGMENT_PREFIX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-min_budget/ --- # Constant framing::MIN_BUDGET > The smallest accepted per-message budget: a fragment header plus one character at its largest escaped (six bytes, `escaped_len`). `zaun_community_protocol::framing::MIN_BUDGET` · Constant ```rust pub const MIN_BUDGET: usize = _; ``` The smallest accepted per-message budget: a fragment header plus one character at its largest escaped (six bytes, `escaped_len`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/encode/constant.MIN_BUDGET.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-protocol_prefix/ --- # Constant framing::PROTOCOL_PREFIX > Prefix shared by every protocol message; text without it is not a protocol message. `zaun_community_protocol::framing::PROTOCOL_PREFIX` · Constant ```rust pub const PROTOCOL_PREFIX: &str = "zaun:"; ``` Prefix shared by every protocol message; text without it is not a protocol message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/constant.PROTOCOL_PREFIX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-framing-whole_prefix/ --- # Constant framing::WHOLE_PREFIX > Prefix of a whole-envelope message. `zaun_community_protocol::framing::WHOLE_PREFIX` · Constant ```rust pub const WHOLE_PREFIX: &str = "zaun:1:"; ``` Prefix of a whole-envelope message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/constant.WHOLE_PREFIX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-keys-ed25519_pk_len/ --- # Constant keys::ED25519_PK_LEN > Ed25519 public key length. `zaun_community_protocol::keys::ED25519_PK_LEN` · Constant ```rust pub const ED25519_PK_LEN: usize = 32; ``` Ed25519 public key length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/constant.ED25519_PK_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-keys-ed25519_sig_len/ --- # Constant keys::ED25519_SIG_LEN > Ed25519 signature length. `zaun_community_protocol::keys::ED25519_SIG_LEN` · Constant ```rust pub const ED25519_SIG_LEN: usize = 64; ``` Ed25519 signature length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/constant.ED25519_SIG_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-keys-mldsa65_pk_len/ --- # Constant keys::MLDSA65_PK_LEN > ML-DSA-65 public key length. `zaun_community_protocol::keys::MLDSA65_PK_LEN` · Constant ```rust pub const MLDSA65_PK_LEN: usize = 1_952; ``` ML-DSA-65 public key length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/constant.MLDSA65_PK_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-keys-mldsa65_sig_len/ --- # Constant keys::MLDSA65_SIG_LEN > ML-DSA-65 signature length. `zaun_community_protocol::keys::MLDSA65_SIG_LEN` · Constant ```rust pub const MLDSA65_SIG_LEN: usize = 3_309; ``` ML-DSA-65 signature length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/constant.MLDSA65_SIG_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-keys-public_key_len/ --- # Constant keys::PUBLIC_KEY_LEN > Encoded `PublicKey` length. `zaun_community_protocol::keys::PUBLIC_KEY_LEN` · Constant ```rust pub const PUBLIC_KEY_LEN: usize = _; ``` Encoded `PublicKey` length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/constant.PUBLIC_KEY_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-keys-signature_len/ --- # Constant keys::SIGNATURE_LEN > Encoded `Signature` length. `zaun_community_protocol::keys::SIGNATURE_LEN` · Constant ```rust pub const SIGNATURE_LEN: usize = _; ``` Encoded `Signature` length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/constant.SIGNATURE_LEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-ack_channels/ --- # Constant limits::ACK_CHANNELS > `sync.ack` channels. `zaun_community_protocol::limits::ACK_CHANNELS` · Constant ```rust pub const ACK_CHANNELS: usize = 100; ``` `sync.ack` channels. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ACK_CHANNELS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-activity_max/ --- # Constant limits::ACTIVITY_MAX > Presence `activity`, maximum scalars. `zaun_community_protocol::limits::ACTIVITY_MAX` · Constant ```rust pub const ACTIVITY_MAX: usize = 128; ``` Presence `activity`, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ACTIVITY_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_choice_text/ --- # Constant limits::APP_CHOICE_TEXT > Choice `name` and string `value`, scalars. `zaun_community_protocol::limits::APP_CHOICE_TEXT` · Constant ```rust pub const APP_CHOICE_TEXT: (usize, usize) = _; ``` Choice `name` and string `value`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_CHOICE_TEXT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_description/ --- # Constant limits::APP_COMMAND_DESCRIPTION > Command and option `description` (`CHAT_INPUT`), scalars. `zaun_community_protocol::limits::APP_COMMAND_DESCRIPTION` · Constant ```rust pub const APP_COMMAND_DESCRIPTION: (usize, usize) = _; ``` Command and option `description` (`CHAT_INPUT`), scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_COMMAND_DESCRIPTION.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_name/ --- # Constant limits::APP_COMMAND_NAME > Command and option `name`, scalars. `zaun_community_protocol::limits::APP_COMMAND_NAME` · Constant ```rust pub const APP_COMMAND_NAME: (usize, usize) = _; ``` Command and option `name`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_COMMAND_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_options/ --- # Constant limits::APP_COMMAND_OPTIONS > Options per command or subcommand, and choices per option. `zaun_community_protocol::limits::APP_COMMAND_OPTIONS` · Constant ```rust pub const APP_COMMAND_OPTIONS: usize = 25; ``` Options per command or subcommand, and choices per option. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_COMMAND_OPTIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_command_text_total/ --- # Constant limits::APP_COMMAND_TEXT_TOTAL > All names, descriptions, choice names and values of one command, scalars. `zaun_community_protocol::limits::APP_COMMAND_TEXT_TOTAL` · Constant ```rust pub const APP_COMMAND_TEXT_TOTAL: usize = 8_000; ``` All names, descriptions, choice names and values of one command, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_COMMAND_TEXT_TOTAL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_commands/ --- # Constant limits::APP_COMMANDS > Application commands per bot: `CHAT_INPUT`, `USER`, `MESSAGE`. `zaun_community_protocol::limits::APP_COMMANDS` · Constant ```rust pub const APP_COMMANDS: (usize, usize, usize) = _; ``` Application commands per bot: `CHAT_INPUT`, `USER`, `MESSAGE`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_COMMANDS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_localizations/ --- # Constant limits::APP_LOCALIZATIONS > Localized names per field. `zaun_community_protocol::limits::APP_LOCALIZATIONS` · Constant ```rust pub const APP_LOCALIZATIONS: usize = 50; ``` Localized names per field. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_LOCALIZATIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-app_option_length_max/ --- # Constant limits::APP_OPTION_LENGTH_MAX > String option `min_length` / `max_length` bound. `zaun_community_protocol::limits::APP_OPTION_LENGTH_MAX` · Constant ```rust pub const APP_OPTION_LENGTH_MAX: u32 = 6_000; ``` String option `min_length` / `max_length` bound. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.APP_OPTION_LENGTH_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-attachment_mime_max/ --- # Constant limits::ATTACHMENT_MIME_MAX > Attachment media type, bytes. `zaun_community_protocol::limits::ATTACHMENT_MIME_MAX` · Constant ```rust pub const ATTACHMENT_MIME_MAX: usize = 127; ``` Attachment media type, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ATTACHMENT_MIME_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-attachment_name/ --- # Constant limits::ATTACHMENT_NAME > Attachment file name, scalars. `zaun_community_protocol::limits::ATTACHMENT_NAME` · Constant ```rust pub const ATTACHMENT_NAME: (usize, usize) = _; ``` Attachment file name, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ATTACHMENT_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-attachment_size_max/ --- # Constant limits::ATTACHMENT_SIZE_MAX > Largest attachment the protocol allows, in bytes (XFTP's 1 GiB); hosts set lower limits. `zaun_community_protocol::limits::ATTACHMENT_SIZE_MAX` · Constant ```rust pub const ATTACHMENT_SIZE_MAX: u64 = _; ``` Largest attachment the protocol allows, in bytes (XFTP's 1 GiB); hosts set lower limits. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ATTACHMENT_SIZE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-attachments_per_message/ --- # Constant limits::ATTACHMENTS_PER_MESSAGE > Attachments per message. `zaun_community_protocol::limits::ATTACHMENTS_PER_MESSAGE` · Constant ```rust pub const ATTACHMENTS_PER_MESSAGE: usize = 10; ``` Attachments per message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ATTACHMENTS_PER_MESSAGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-autocomplete_choices/ --- # Constant limits::AUTOCOMPLETE_CHOICES > Autocomplete choices. `zaun_community_protocol::limits::AUTOCOMPLETE_CHOICES` · Constant ```rust pub const AUTOCOMPLETE_CHOICES: usize = 25; ``` Autocomplete choices. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.AUTOCOMPLETE_CHOICES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-ban_delete_window_max_ms/ --- # Constant limits::BAN_DELETE_WINDOW_MAX_MS > Ban message-deletion window upper bound in milliseconds (7 days). `zaun_community_protocol::limits::BAN_DELETE_WINDOW_MAX_MS` · Constant ```rust pub const BAN_DELETE_WINDOW_MAX_MS: u64 = _; ``` Ban message-deletion window upper bound in milliseconds (7 days). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BAN_DELETE_WINDOW_MAX_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_component_max/ --- # Constant limits::BOT_COMPONENT_MAX > The WebAssembly component inside a bot package, bytes. `zaun_community_protocol::limits::BOT_COMPONENT_MAX` · Constant ```rust pub const BOT_COMPONENT_MAX: usize = _; ``` The WebAssembly component inside a bot package, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_COMPONENT_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_config_keys/ --- # Constant limits::BOT_CONFIG_KEYS > Settings a bot may declare (`config`). `zaun_community_protocol::limits::BOT_CONFIG_KEYS` · Constant ```rust pub const BOT_CONFIG_KEYS: usize = 32; ``` Settings a bot may declare (`config`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_CONFIG_KEYS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_config_value_max/ --- # Constant limits::BOT_CONFIG_VALUE_MAX > A setting's value or default, bytes. `zaun_community_protocol::limits::BOT_CONFIG_VALUE_MAX` · Constant ```rust pub const BOT_CONFIG_VALUE_MAX: usize = 4_096; ``` A setting's value or default, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_CONFIG_VALUE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_description_max/ --- # Constant limits::BOT_DESCRIPTION_MAX > A bot's `description`, scalars. `zaun_community_protocol::limits::BOT_DESCRIPTION_MAX` · Constant ```rust pub const BOT_DESCRIPTION_MAX: usize = 400; ``` A bot's `description`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_DESCRIPTION_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_header_max/ --- # Constant limits::BOT_HEADER_MAX > Bot package header, manifest and component sizes, bytes. `zaun_community_protocol::limits::BOT_HEADER_MAX` · Constant ```rust pub const BOT_HEADER_MAX: usize = 4_096; ``` Bot package header, manifest and component sizes, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_HEADER_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_local_network/ --- # Constant limits::BOT_LOCAL_NETWORK > `local_network` addresses a bot may ask for. `zaun_community_protocol::limits::BOT_LOCAL_NETWORK` · Constant ```rust pub const BOT_LOCAL_NETWORK: usize = 8; ``` `local_network` addresses a bot may ask for. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_LOCAL_NETWORK.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_manifest_max/ --- # Constant limits::BOT_MANIFEST_MAX > The manifest JSON inside a bot package, bytes. `zaun_community_protocol::limits::BOT_MANIFEST_MAX` · Constant ```rust pub const BOT_MANIFEST_MAX: usize = 65_536; ``` The manifest JSON inside a bot package, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_MANIFEST_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_network_hosts/ --- # Constant limits::BOT_NETWORK_HOSTS > Network hosts a bot may ask for. `zaun_community_protocol::limits::BOT_NETWORK_HOSTS` · Constant ```rust pub const BOT_NETWORK_HOSTS: usize = 32; ``` Network hosts a bot may ask for. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_NETWORK_HOSTS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bot_storage_max/ --- # Constant limits::BOT_STORAGE_MAX > A bot's key-value storage quota, bytes. `zaun_community_protocol::limits::BOT_STORAGE_MAX` · Constant ```rust pub const BOT_STORAGE_MAX: u64 = _; ``` A bot's key-value storage quota, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOT_STORAGE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bots_per_community/ --- # Constant limits::BOTS_PER_COMMUNITY > Bots per community. `zaun_community_protocol::limits::BOTS_PER_COMMUNITY` · Constant ```rust pub const BOTS_PER_COMMUNITY: usize = 50; ``` Bots per community. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BOTS_PER_COMMUNITY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-bulk_delete_max/ --- # Constant limits::BULK_DELETE_MAX > Most message ids in one `messages.bulk_deleted` event. `zaun_community_protocol::limits::BULK_DELETE_MAX` · Constant ```rust pub const BULK_DELETE_MAX: usize = 1_000; ``` Most message ids in one `messages.bulk_deleted` event. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BULK_DELETE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-button_label_max/ --- # Constant limits::BUTTON_LABEL_MAX > Button `label`, scalars. `zaun_community_protocol::limits::BUTTON_LABEL_MAX` · Constant ```rust pub const BUTTON_LABEL_MAX: usize = 80; ``` Button `label`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.BUTTON_LABEL_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-capabilities/ --- # Constant limits::CAPABILITIES > `session.hello` capabilities: count and bytes each. `zaun_community_protocol::limits::CAPABILITIES` · Constant ```rust pub const CAPABILITIES: (usize, usize) = _; ``` `session.hello` capabilities: count and bytes each. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.CAPABILITIES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-channel_name/ --- # Constant limits::CHANNEL_NAME > Channel name length. `zaun_community_protocol::limits::CHANNEL_NAME` · Constant ```rust pub const CHANNEL_NAME: (usize, usize) = _; ``` Channel name length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.CHANNEL_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-channel_topic_max/ --- # Constant limits::CHANNEL_TOPIC_MAX > Channel topic, maximum scalars. `zaun_community_protocol::limits::CHANNEL_TOPIC_MAX` · Constant ```rust pub const CHANNEL_TOPIC_MAX: usize = 1_024; ``` Channel topic, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.CHANNEL_TOPIC_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-channels_per_community/ --- # Constant limits::CHANNELS_PER_COMMUNITY > Channels per community, including categories. `zaun_community_protocol::limits::CHANNELS_PER_COMMUNITY` · Constant ```rust pub const CHANNELS_PER_COMMUNITY: usize = 500; ``` Channels per community, including categories. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.CHANNELS_PER_COMMUNITY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-checkbox_options/ --- # Constant limits::CHECKBOX_OPTIONS > Checkbox group options. `zaun_community_protocol::limits::CHECKBOX_OPTIONS` · Constant ```rust pub const CHECKBOX_OPTIONS: (usize, usize) = _; ``` Checkbox group options. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.CHECKBOX_OPTIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-color_max/ --- # Constant limits::COLOR_MAX > Largest role colour, `0xFFFFFF`. `zaun_community_protocol::limits::COLOR_MAX` · Constant ```rust pub const COLOR_MAX: u32 = 0x00FF_FFFF; ``` Largest role colour, `0xFFFFFF`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COLOR_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-community_description_max/ --- # Constant limits::COMMUNITY_DESCRIPTION_MAX > Community description, maximum scalars. `zaun_community_protocol::limits::COMMUNITY_DESCRIPTION_MAX` · Constant ```rust pub const COMMUNITY_DESCRIPTION_MAX: usize = 1_000; ``` Community description, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COMMUNITY_DESCRIPTION_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-community_name/ --- # Constant limits::COMMUNITY_NAME > Community name length (scalars). `zaun_community_protocol::limits::COMMUNITY_NAME` · Constant ```rust pub const COMMUNITY_NAME: (usize, usize) = _; ``` Community name length (scalars). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COMMUNITY_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-component_custom_id/ --- # Constant limits::COMPONENT_CUSTOM_ID > Component `custom_id`, bytes. `zaun_community_protocol::limits::COMPONENT_CUSTOM_ID` · Constant ```rust pub const COMPONENT_CUSTOM_ID: (usize, usize) = _; ``` Component `custom_id`, bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COMPONENT_CUSTOM_ID.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-component_row_buttons/ --- # Constant limits::COMPONENT_ROW_BUTTONS > Buttons per action row. `zaun_community_protocol::limits::COMPONENT_ROW_BUTTONS` · Constant ```rust pub const COMPONENT_ROW_BUTTONS: usize = 5; ``` Buttons per action row. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COMPONENT_ROW_BUTTONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-component_rows/ --- # Constant limits::COMPONENT_ROWS > Top-level action rows of a message without `IS_COMPONENTS_V2`. `zaun_community_protocol::limits::COMPONENT_ROWS` · Constant ```rust pub const COMPONENT_ROWS: usize = 5; ``` Top-level action rows of a message without `IS_COMPONENTS_V2`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COMPONENT_ROWS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-components_total/ --- # Constant limits::COMPONENTS_TOTAL > Components in one message, counting nested ones. `zaun_community_protocol::limits::COMPONENTS_TOTAL` · Constant ```rust pub const COMPONENTS_TOTAL: usize = 40; ``` Components in one message, counting nested ones. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.COMPONENTS_TOTAL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-day_ms/ --- # Constant limits::DAY_MS > One day in milliseconds. `zaun_community_protocol::limits::DAY_MS` · Constant ```rust pub const DAY_MS: u64 = 86_400_000; ``` One day in milliseconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.DAY_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-display_name/ --- # Constant limits::DISPLAY_NAME > Member display name length. `zaun_community_protocol::limits::DISPLAY_NAME` · Constant ```rust pub const DISPLAY_NAME: (usize, usize) = _; ``` Member display name length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.DISPLAY_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-dm_opens_per_minute/ --- # Constant limits::DM_OPENS_PER_MINUTE > New DMs one bot may open per minute. `zaun_community_protocol::limits::DM_OPENS_PER_MINUTE` · Constant ```rust pub const DM_OPENS_PER_MINUTE: usize = 10; ``` New DMs one bot may open per minute. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.DM_OPENS_PER_MINUTE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-dm_unanswered_per_hour/ --- # Constant limits::DM_UNANSWERED_PER_HOUR > Messages a bot may write into a DM per hour while the member has never written in it. `zaun_community_protocol::limits::DM_UNANSWERED_PER_HOUR` · Constant ```rust pub const DM_UNANSWERED_PER_HOUR: usize = 5; ``` Messages a bot may write into a DM per hour while the member has never written in it. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.DM_UNANSWERED_PER_HOUR.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_author_name/ --- # Constant limits::EMBED_AUTHOR_NAME > Embed `author.name`, scalars. `zaun_community_protocol::limits::EMBED_AUTHOR_NAME` · Constant ```rust pub const EMBED_AUTHOR_NAME: (usize, usize) = _; ``` Embed `author.name`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_AUTHOR_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_description/ --- # Constant limits::EMBED_DESCRIPTION > Embed `description`, scalars. `zaun_community_protocol::limits::EMBED_DESCRIPTION` · Constant ```rust pub const EMBED_DESCRIPTION: (usize, usize) = _; ``` Embed `description`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_DESCRIPTION.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_field_name/ --- # Constant limits::EMBED_FIELD_NAME > Embed field `name`, scalars. `zaun_community_protocol::limits::EMBED_FIELD_NAME` · Constant ```rust pub const EMBED_FIELD_NAME: (usize, usize) = _; ``` Embed field `name`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_FIELD_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_field_value/ --- # Constant limits::EMBED_FIELD_VALUE > Embed field `value`, scalars. `zaun_community_protocol::limits::EMBED_FIELD_VALUE` · Constant ```rust pub const EMBED_FIELD_VALUE: (usize, usize) = _; ``` Embed field `value`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_FIELD_VALUE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_fields/ --- # Constant limits::EMBED_FIELDS > Fields per embed. `zaun_community_protocol::limits::EMBED_FIELDS` · Constant ```rust pub const EMBED_FIELDS: usize = 25; ``` Fields per embed. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_FIELDS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_footer_text/ --- # Constant limits::EMBED_FOOTER_TEXT > Embed `footer.text`, scalars. `zaun_community_protocol::limits::EMBED_FOOTER_TEXT` · Constant ```rust pub const EMBED_FOOTER_TEXT: (usize, usize) = _; ``` Embed `footer.text`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_FOOTER_TEXT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_text_total/ --- # Constant limits::EMBED_TEXT_TOTAL > The text of all of a message's embeds together (titles, descriptions, field names and values, author names, footer texts), scalars. `zaun_community_protocol::limits::EMBED_TEXT_TOTAL` · Constant ```rust pub const EMBED_TEXT_TOTAL: usize = 6_000; ``` The text of all of a message's embeds together (titles, descriptions, field names and values, author names, footer texts), scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_TEXT_TOTAL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_title/ --- # Constant limits::EMBED_TITLE > Embed `title`, scalars. `zaun_community_protocol::limits::EMBED_TITLE` · Constant ```rust pub const EMBED_TITLE: (usize, usize) = _; ``` Embed `title`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_TITLE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embed_url_max/ --- # Constant limits::EMBED_URL_MAX > Embed `url` and `author.url`, maximum bytes. `zaun_community_protocol::limits::EMBED_URL_MAX` · Constant ```rust pub const EMBED_URL_MAX: usize = 2_048; ``` Embed `url` and `author.url`, maximum bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBED_URL_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-embeds_per_message/ --- # Constant limits::EMBEDS_PER_MESSAGE > Embeds per message. `zaun_community_protocol::limits::EMBEDS_PER_MESSAGE` · Constant ```rust pub const EMBEDS_PER_MESSAGE: usize = 10; ``` Embeds per message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMBEDS_PER_MESSAGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-emoji_max_bytes/ --- # Constant limits::EMOJI_MAX_BYTES > Emoji, maximum bytes. `zaun_community_protocol::limits::EMOJI_MAX_BYTES` · Constant ```rust pub const EMOJI_MAX_BYTES: usize = 64; ``` Emoji, maximum bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.EMOJI_MAX_BYTES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-file_upload_max/ --- # Constant limits::FILE_UPLOAD_MAX > Files in one file upload. `zaun_community_protocol::limits::FILE_UPLOAD_MAX` · Constant ```rust pub const FILE_UPLOAD_MAX: u32 = 10; ``` Files in one file upload. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.FILE_UPLOAD_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-fragment_timeout_ms/ --- # Constant limits::FRAGMENT_TIMEOUT_MS > Milliseconds from the first to the last fragment before a reassembly is discarded. `zaun_community_protocol::limits::FRAGMENT_TIMEOUT_MS` · Constant ```rust pub const FRAGMENT_TIMEOUT_MS: u64 = 60_000; ``` Milliseconds from the first to the last fragment before a reassembly is discarded. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.FRAGMENT_TIMEOUT_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-ice_field_max/ --- # Constant limits::ICE_FIELD_MAX > Longest ICE server URL, username or credential, in bytes. `zaun_community_protocol::limits::ICE_FIELD_MAX` · Constant ```rust pub const ICE_FIELD_MAX: usize = 256; ``` Longest ICE server URL, username or credential, in bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ICE_FIELD_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-ice_servers_max/ --- # Constant limits::ICE_SERVERS_MAX > Most ICE servers a host lists in `voice.join`. `zaun_community_protocol::limits::ICE_SERVERS_MAX` · Constant ```rust pub const ICE_SERVERS_MAX: usize = 8; ``` Most ICE servers a host lists in `voice.join`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ICE_SERVERS_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-icon_max/ --- # Constant limits::ICON_MAX > Descriptor icon, maximum bytes (PNG or WebP). `zaun_community_protocol::limits::ICON_MAX` · Constant ```rust pub const ICON_MAX: usize = 49_152; ``` Descriptor icon, maximum bytes (PNG or WebP). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ICON_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-idempotency_retention_ms/ --- # Constant limits::IDEMPOTENCY_RETENTION_MS > Idempotency record retention lower bound in milliseconds. `zaun_community_protocol::limits::IDEMPOTENCY_RETENTION_MS` · Constant ```rust pub const IDEMPOTENCY_RETENTION_MS: u64 = DAY_MS; ``` Idempotency record retention lower bound in milliseconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.IDEMPOTENCY_RETENTION_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-in_flight_default/ --- # Constant limits::IN_FLIGHT_DEFAULT > Default in-flight window in SMP messages per member. `zaun_community_protocol::limits::IN_FLIGHT_DEFAULT` · Constant ```rust pub const IN_FLIGHT_DEFAULT: u32 = 48; ``` Default in-flight window in SMP messages per member. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.IN_FLIGHT_DEFAULT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-in_flight_max/ --- # Constant limits::IN_FLIGHT_MAX > Highest configurable in-flight window (half the 128-message SMP queue stays free). `zaun_community_protocol::limits::IN_FLIGHT_MAX` · Constant ```rust pub const IN_FLIGHT_MAX: u32 = 64; ``` Highest configurable in-flight window (half the 128-message SMP queue stays free). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.IN_FLIGHT_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-in_flight_min/ --- # Constant limits::IN_FLIGHT_MIN > Lowest configurable in-flight window (the largest frame must fit). `zaun_community_protocol::limits::IN_FLIGHT_MIN` · Constant ```rust pub const IN_FLIGHT_MIN: u32 = 32; ``` Lowest configurable in-flight window (the largest frame must fit). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.IN_FLIGHT_MIN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-interaction_answer_ms/ --- # Constant limits::INTERACTION_ANSWER_MS > Interaction answer deadline, ms. `zaun_community_protocol::limits::INTERACTION_ANSWER_MS` · Constant ```rust pub const INTERACTION_ANSWER_MS: u64 = 3_000; ``` Interaction answer deadline, ms. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.INTERACTION_ANSWER_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-interaction_followups/ --- # Constant limits::INTERACTION_FOLLOWUPS > Follow-ups per interaction. `zaun_community_protocol::limits::INTERACTION_FOLLOWUPS` · Constant ```rust pub const INTERACTION_FOLLOWUPS: usize = 10; ``` Follow-ups per interaction. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.INTERACTION_FOLLOWUPS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-interaction_lifetime_ms/ --- # Constant limits::INTERACTION_LIFETIME_MS > Follow-ups, edits and modal submits are accepted this long after the interaction, ms. `zaun_community_protocol::limits::INTERACTION_LIFETIME_MS` · Constant ```rust pub const INTERACTION_LIFETIME_MS: u64 = _; ``` Follow-ups, edits and modal submits are accepted this long after the interaction, ms. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.INTERACTION_LIFETIME_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-invite_expiry_max_ms/ --- # Constant limits::INVITE_EXPIRY_MAX_MS > Invite expiry upper bound in milliseconds (30 days). `zaun_community_protocol::limits::INVITE_EXPIRY_MAX_MS` · Constant ```rust pub const INVITE_EXPIRY_MAX_MS: u64 = _; ``` Invite expiry upper bound in milliseconds (30 days). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.INVITE_EXPIRY_MAX_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-invite_max_uses/ --- # Constant limits::INVITE_MAX_USES > Invite `max_uses` upper bound (0 means unlimited). `zaun_community_protocol::limits::INVITE_MAX_USES` · Constant ```rust pub const INVITE_MAX_USES: u32 = 100_000; ``` Invite `max_uses` upper bound (0 means unlimited). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.INVITE_MAX_USES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-label_text/ --- # Constant limits::LABEL_TEXT > Label `label` and `description`, scalars. `zaun_community_protocol::limits::LABEL_TEXT` · Constant ```rust pub const LABEL_TEXT: (usize, usize) = _; ``` Label `label` and `description`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.LABEL_TEXT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-last_n/ --- # Constant limits::LAST_N > `last_n` history bounds. `zaun_community_protocol::limits::LAST_N` · Constant ```rust pub const LAST_N: (u32, u32) = _; ``` `last_n` history bounds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.LAST_N.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-lockdown_ms/ --- # Constant limits::LOCKDOWN_MS > Lockdown duration bounds in milliseconds per `enable` (60 s – 7 days). `zaun_community_protocol::limits::LOCKDOWN_MS` · Constant ```rust pub const LOCKDOWN_MS: (u64, u64) = _; ``` Lockdown duration bounds in milliseconds per `enable` (60 s – 7 days). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.LOCKDOWN_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-max_canonical_field/ --- # Constant limits::MAX_CANONICAL_FIELD > Unlisted variable-length fields in canonical encodings. `zaun_community_protocol::limits::MAX_CANONICAL_FIELD` · Constant ```rust pub const MAX_CANONICAL_FIELD: usize = 65_536; ``` Unlisted variable-length fields in canonical encodings. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MAX_CANONICAL_FIELD.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-max_command/ --- # Constant limits::MAX_COMMAND > Maximum command envelope, except `community.create` and `community.descriptor.publish`. `zaun_community_protocol::limits::MAX_COMMAND` · Constant ```rust pub const MAX_COMMAND: usize = 65_536; ``` Maximum command envelope, except `community.create` and `community.descriptor.publish`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MAX_COMMAND.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-max_fragments/ --- # Constant limits::MAX_FRAGMENTS > Fragments per frame. `zaun_community_protocol::limits::MAX_FRAGMENTS` · Constant ```rust pub const MAX_FRAGMENTS: usize = 32; ``` Fragments per frame. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MAX_FRAGMENTS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-max_frame/ --- # Constant limits::MAX_FRAME > Maximum reassembled envelope in bytes. `zaun_community_protocol::limits::MAX_FRAME` · Constant ```rust pub const MAX_FRAME: usize = 131_072; ``` Maximum reassembled envelope in bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MAX_FRAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-max_open_reassemblies/ --- # Constant limits::MAX_OPEN_REASSEMBLIES > Open reassemblies per connection; a further one discards the oldest. `zaun_community_protocol::limits::MAX_OPEN_REASSEMBLIES` · Constant ```rust pub const MAX_OPEN_REASSEMBLIES: usize = 4; ``` Open reassemblies per connection; a further one discards the oldest. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MAX_OPEN_REASSEMBLIES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-media_description_max/ --- # Constant limits::MEDIA_DESCRIPTION_MAX > Media description, scalars. `zaun_community_protocol::limits::MEDIA_DESCRIPTION_MAX` · Constant ```rust pub const MEDIA_DESCRIPTION_MAX: usize = 1_024; ``` Media description, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MEDIA_DESCRIPTION_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-media_gallery_items/ --- # Constant limits::MEDIA_GALLERY_ITEMS > Media gallery items. `zaun_community_protocol::limits::MEDIA_GALLERY_ITEMS` · Constant ```rust pub const MEDIA_GALLERY_ITEMS: (usize, usize) = _; ``` Media gallery items. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MEDIA_GALLERY_ITEMS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-mention_members/ --- # Constant limits::MENTION_MEMBERS > Member mentions per message. `zaun_community_protocol::limits::MENTION_MEMBERS` · Constant ```rust pub const MENTION_MEMBERS: usize = 50; ``` Member mentions per message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MENTION_MEMBERS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-mention_roles/ --- # Constant limits::MENTION_ROLES > Role mentions per message. `zaun_community_protocol::limits::MENTION_ROLES` · Constant ```rust pub const MENTION_ROLES: usize = 20; ``` Role mentions per message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MENTION_ROLES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-message_content/ --- # Constant limits::MESSAGE_CONTENT > Message content length. The content may be empty when the message has an attachment or an embed. `zaun_community_protocol::limits::MESSAGE_CONTENT` · Constant ```rust pub const MESSAGE_CONTENT: (usize, usize) = _; ``` Message content length. The content may be empty when the message has an attachment or an embed. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MESSAGE_CONTENT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-message_json_max/ --- # Constant limits::MESSAGE_JSON_MAX > A message's `content` and `embeds` together, as JSON bytes the host writes them (`message_json_len`), so that every message, message event and report fits a page. One `message.send `zaun_community_protocol::limits::MESSAGE_JSON_MAX` · Constant ```rust pub const MESSAGE_JSON_MAX: usize = 65_536; ``` A message's `content` and `embeds` together, as JSON bytes the host writes them (`message_json_len`), so that every message, message event and report fits a page. One `message.send` never exceeds it (its envelope is at most `MAX_COMMAND`); an edit that adds long content beside large stored embeds can. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MESSAGE_JSON_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-modal_items/ --- # Constant limits::MODAL_ITEMS > Top-level modal items. `zaun_community_protocol::limits::MODAL_ITEMS` · Constant ```rust pub const MODAL_ITEMS: (usize, usize) = _; ``` Top-level modal items. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MODAL_ITEMS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-modal_title/ --- # Constant limits::MODAL_TITLE > Modal `title`, scalars. `zaun_community_protocol::limits::MODAL_TITLE` · Constant ```rust pub const MODAL_TITLE: (usize, usize) = _; ``` Modal `title`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.MODAL_TITLE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-newcomer_window_max_s/ --- # Constant limits::NEWCOMER_WINDOW_MAX_S > Largest lockdown `newcomer_window_s`: 30 days, in seconds. `zaun_community_protocol::limits::NEWCOMER_WINDOW_MAX_S` · Constant ```rust pub const NEWCOMER_WINDOW_MAX_S: u64 = _; ``` Largest lockdown `newcomer_window_s`: 30 days, in seconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.NEWCOMER_WINDOW_MAX_S.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-overrides_per_channel/ --- # Constant limits::OVERRIDES_PER_CHANNEL > Overrides per channel. `zaun_community_protocol::limits::OVERRIDES_PER_CHANNEL` · Constant ```rust pub const OVERRIDES_PER_CHANNEL: usize = 100; ``` Overrides per channel. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.OVERRIDES_PER_CHANNEL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-page_bytes/ --- # Constant limits::PAGE_BYTES > The items of one paged response (`message.history` messages, `sync.events` events, `report.list` reports; for `sync.resume`, the whole body), as JSON bytes: below `MAX_FRAME` by en `zaun_community_protocol::limits::PAGE_BYTES` · Constant ```rust pub const PAGE_BYTES: usize = _; ``` The items of one paged response (`message.history` messages, `sync.events` events, `report.list` reports; for `sync.resume`, the whole body), as JSON bytes: below `MAX_FRAME` by enough for the envelope, so a page always fits one frame. A host stops before it would exceed this and signals the rest (`has_more`, `next`); it always keeps the first item, except in `sync.resume`, whose streams continue with `sync.events`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.PAGE_BYTES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-page_large/ --- # Constant limits::PAGE_LARGE > Page size: `member.list`, `sync.events`. `zaun_community_protocol::limits::PAGE_LARGE` · Constant ```rust pub const PAGE_LARGE: usize = 200; ``` Page size: `member.list`, `sync.events`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.PAGE_LARGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-page_small/ --- # Constant limits::PAGE_SMALL > Page size: `message.history`, `audit.list`, `invite.list`, `invite.uses`, `member.bans`, `membership.pending`, `report.list`. `zaun_community_protocol::limits::PAGE_SMALL` · Constant ```rust pub const PAGE_SMALL: usize = 100; ``` Page size: `message.history`, `audit.list`, `invite.list`, `invite.uses`, `member.bans`, `membership.pending`, `report.list`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.PAGE_SMALL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-pending_expiry_max_ms/ --- # Constant limits::PENDING_EXPIRY_MAX_MS > Pending expiry upper bound in milliseconds (30 days); default 7 days. `zaun_community_protocol::limits::PENDING_EXPIRY_MAX_MS` · Constant ```rust pub const PENDING_EXPIRY_MAX_MS: u64 = _; ``` Pending expiry upper bound in milliseconds (30 days); default 7 days. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.PENDING_EXPIRY_MAX_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-pending_per_community/ --- # Constant limits::PENDING_PER_COMMUNITY > Pending members per community. `zaun_community_protocol::limits::PENDING_PER_COMMUNITY` · Constant ```rust pub const PENDING_PER_COMMUNITY: usize = 1_000; ``` Pending members per community. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.PENDING_PER_COMMUNITY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-protocol_version/ --- # Constant limits::PROTOCOL_VERSION > Protocol version defined by this crate. `zaun_community_protocol::limits::PROTOCOL_VERSION` · Constant ```rust pub const PROTOCOL_VERSION: u16 = 1; ``` Protocol version defined by this crate. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.PROTOCOL_VERSION.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-radio_options/ --- # Constant limits::RADIO_OPTIONS > Radio group options. `zaun_community_protocol::limits::RADIO_OPTIONS` · Constant ```rust pub const RADIO_OPTIONS: (usize, usize) = _; ``` Radio group options. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.RADIO_OPTIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-reactions_per_message/ --- # Constant limits::REACTIONS_PER_MESSAGE > Distinct reaction emoji per message. `zaun_community_protocol::limits::REACTIONS_PER_MESSAGE` · Constant ```rust pub const REACTIONS_PER_MESSAGE: usize = 20; ``` Distinct reaction emoji per message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REACTIONS_PER_MESSAGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-reason_max/ --- # Constant limits::REASON_MAX > Moderation reason, maximum scalars. `zaun_community_protocol::limits::REASON_MAX` · Constant ```rust pub const REASON_MAX: usize = 512; ``` Moderation reason, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REASON_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-report_description_max/ --- # Constant limits::REPORT_DESCRIPTION_MAX > Report description, maximum scalars. `zaun_community_protocol::limits::REPORT_DESCRIPTION_MAX` · Constant ```rust pub const REPORT_DESCRIPTION_MAX: usize = 2_000; ``` Report description, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REPORT_DESCRIPTION_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-report_evidence_max/ --- # Constant limits::REPORT_EVIDENCE_MAX > Report evidence, maximum messages. `zaun_community_protocol::limits::REPORT_EVIDENCE_MAX` · Constant ```rust pub const REPORT_EVIDENCE_MAX: usize = 20; ``` Report evidence, maximum messages. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REPORT_EVIDENCE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-report_note_max/ --- # Constant limits::REPORT_NOTE_MAX > Report resolution `note`, maximum scalars. `zaun_community_protocol::limits::REPORT_NOTE_MAX` · Constant ```rust pub const REPORT_NOTE_MAX: usize = 512; ``` Report resolution `note`, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REPORT_NOTE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-report_snapshot_bytes/ --- # Constant limits::REPORT_SNAPSHOT_BYTES > The evidence snapshots (content and embeds as JSON) one rendered report carries; the first snapshot always goes, and `evidence_next` names where the rest continue. `zaun_community_protocol::limits::REPORT_SNAPSHOT_BYTES` · Constant ```rust pub const REPORT_SNAPSHOT_BYTES: usize = MESSAGE_JSON_MAX; ``` The evidence snapshots (content and embeds as JSON) one rendered report carries; the first snapshot always goes, and `evidence_next` names where the rest continue. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REPORT_SNAPSHOT_BYTES.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-request_note_max/ --- # Constant limits::REQUEST_NOTE_MAX > Membership request note, maximum scalars. `zaun_community_protocol::limits::REQUEST_NOTE_MAX` · Constant ```rust pub const REQUEST_NOTE_MAX: usize = 500; ``` Membership request note, maximum scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.REQUEST_NOTE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-resume_channels/ --- # Constant limits::RESUME_CHANNELS > `sync.resume`: channels per request. `zaun_community_protocol::limits::RESUME_CHANNELS` · Constant ```rust pub const RESUME_CHANNELS: usize = 100; ``` `sync.resume`: channels per request. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.RESUME_CHANNELS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-resume_events_per_stream/ --- # Constant limits::RESUME_EVENTS_PER_STREAM > `sync.resume`: events per stream. `zaun_community_protocol::limits::RESUME_EVENTS_PER_STREAM` · Constant ```rust pub const RESUME_EVENTS_PER_STREAM: usize = 50; ``` `sync.resume`: events per stream. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.RESUME_EVENTS_PER_STREAM.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-role_name/ --- # Constant limits::ROLE_NAME > Role name length. `zaun_community_protocol::limits::ROLE_NAME` · Constant ```rust pub const ROLE_NAME: (usize, usize) = _; ``` Role name length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ROLE_NAME.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-roles_per_community/ --- # Constant limits::ROLES_PER_COMMUNITY > Roles per community, including `@everyone`. `zaun_community_protocol::limits::ROLES_PER_COMMUNITY` · Constant ```rust pub const ROLES_PER_COMMUNITY: usize = 250; ``` Roles per community, including `@everyone`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ROLES_PER_COMMUNITY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-roles_per_member/ --- # Constant limits::ROLES_PER_MEMBER > Roles per member. `zaun_community_protocol::limits::ROLES_PER_MEMBER` · Constant ```rust pub const ROLES_PER_MEMBER: usize = 250; ``` Roles per member. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ROLES_PER_MEMBER.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-rotations_page/ --- # Constant limits::ROTATIONS_PAGE > Page size: `community.rotations`. `zaun_community_protocol::limits::ROTATIONS_PAGE` · Constant ```rust pub const ROTATIONS_PAGE: usize = 4; ``` Page size: `community.rotations`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.ROTATIONS_PAGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-section_texts/ --- # Constant limits::SECTION_TEXTS > Section text displays. `zaun_community_protocol::limits::SECTION_TEXTS` · Constant ```rust pub const SECTION_TEXTS: (usize, usize) = _; ``` Section text displays. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SECTION_TEXTS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-select_option_text/ --- # Constant limits::SELECT_OPTION_TEXT > Select option `label`, `value`, `description`, scalars. `zaun_community_protocol::limits::SELECT_OPTION_TEXT` · Constant ```rust pub const SELECT_OPTION_TEXT: usize = 100; ``` Select option `label`, `value`, `description`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SELECT_OPTION_TEXT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-select_options/ --- # Constant limits::SELECT_OPTIONS > Select options. `zaun_community_protocol::limits::SELECT_OPTIONS` · Constant ```rust pub const SELECT_OPTIONS: usize = 25; ``` Select options. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SELECT_OPTIONS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-select_placeholder_max/ --- # Constant limits::SELECT_PLACEHOLDER_MAX > Select `placeholder`, scalars. `zaun_community_protocol::limits::SELECT_PLACEHOLDER_MAX` · Constant ```rust pub const SELECT_PLACEHOLDER_MAX: usize = 150; ``` Select `placeholder`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SELECT_PLACEHOLDER_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-signal_interval_ms/ --- # Constant limits::SIGNAL_INTERVAL_MS > Minimum interval between signals per member per channel, in milliseconds. `zaun_community_protocol::limits::SIGNAL_INTERVAL_MS` · Constant ```rust pub const SIGNAL_INTERVAL_MS: u64 = 3_000; ``` Minimum interval between signals per member per channel, in milliseconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SIGNAL_INTERVAL_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-slowmode_max_s/ --- # Constant limits::SLOWMODE_MAX_S > Slowmode upper bound in seconds. `zaun_community_protocol::limits::SLOWMODE_MAX_S` · Constant ```rust pub const SLOWMODE_MAX_S: u32 = 21_600; ``` Slowmode upper bound in seconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SLOWMODE_MAX_S.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-snapshot_page/ --- # Constant limits::SNAPSHOT_PAGE > `sync.snapshot` page. `zaun_community_protocol::limits::SNAPSHOT_PAGE` · Constant ```rust pub const SNAPSHOT_PAGE: usize = 100; ``` `sync.snapshot` page. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SNAPSHOT_PAGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-suspension_max_ms/ --- # Constant limits::SUSPENSION_MAX_MS > Suspension upper bound in milliseconds (90 days), or until restored. `zaun_community_protocol::limits::SUSPENSION_MAX_MS` · Constant ```rust pub const SUSPENSION_MAX_MS: u64 = _; ``` Suspension upper bound in milliseconds (90 days), or until restored. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.SUSPENSION_MAX_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-text_display_total/ --- # Constant limits::TEXT_DISPLAY_TOTAL > All text displays of one message or modal together, scalars. `zaun_community_protocol::limits::TEXT_DISPLAY_TOTAL` · Constant ```rust pub const TEXT_DISPLAY_TOTAL: usize = 4_000; ``` All text displays of one message or modal together, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.TEXT_DISPLAY_TOTAL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-text_input_max/ --- # Constant limits::TEXT_INPUT_MAX > Text input value and length bounds, scalars. `zaun_community_protocol::limits::TEXT_INPUT_MAX` · Constant ```rust pub const TEXT_INPUT_MAX: u32 = 4_000; ``` Text input value and length bounds, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.TEXT_INPUT_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-text_input_placeholder_max/ --- # Constant limits::TEXT_INPUT_PLACEHOLDER_MAX > Text input `placeholder`, scalars. `zaun_community_protocol::limits::TEXT_INPUT_PLACEHOLDER_MAX` · Constant ```rust pub const TEXT_INPUT_PLACEHOLDER_MAX: usize = 100; ``` Text input `placeholder`, scalars. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.TEXT_INPUT_PLACEHOLDER_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-timeout_max_ms/ --- # Constant limits::TIMEOUT_MAX_MS > Timeout upper bound in milliseconds (28 days). `zaun_community_protocol::limits::TIMEOUT_MAX_MS` · Constant ```rust pub const TIMEOUT_MAX_MS: u64 = _; ``` Timeout upper bound in milliseconds (28 days). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.TIMEOUT_MAX_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-typing_count_cap/ --- # Constant limits::TYPING_COUNT_CAP > The largest `count` of an anonymous `signal.typing`: 3 means "three or more", so a larger channel never learns exactly how many are typing. `zaun_community_protocol::limits::TYPING_COUNT_CAP` · Constant ```rust pub const TYPING_COUNT_CAP: u32 = 3; ``` The largest `count` of an anonymous `signal.typing`: 3 means "three or more", so a larger channel never learns exactly how many are typing. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.TYPING_COUNT_CAP.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-unbound_deadline_ms/ --- # Constant limits::UNBOUND_DEADLINE_MS > Unbound connection deadline (default) in milliseconds. `zaun_community_protocol::limits::UNBOUND_DEADLINE_MS` · Constant ```rust pub const UNBOUND_DEADLINE_MS: u64 = _; ``` Unbound connection deadline (default) in milliseconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.UNBOUND_DEADLINE_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-voice_key_package_max/ --- # Constant limits::VOICE_KEY_PACKAGE_MAX > Largest `key_package` of `voice.join`, decoded bytes (opaque to the host; the media layer's packages are 4 680 bytes). `zaun_community_protocol::limits::VOICE_KEY_PACKAGE_MAX` · Constant ```rust pub const VOICE_KEY_PACKAGE_MAX: usize = 6_144; ``` Largest `key_package` of `voice.join`, decoded bytes (opaque to the host; the media layer's packages are 4 680 bytes). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.VOICE_KEY_PACKAGE_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-voice_mesh_max/ --- # Constant limits::VOICE_MESH_MAX > The most participants a voice channel can have on any host (`mesh_max` ≤ this). Every participant's key package is in the `voice.join` response, which must fit in `MAX_FRAME` (9 ba `zaun_community_protocol::limits::VOICE_MESH_MAX` · Constant ```rust pub const VOICE_MESH_MAX: u32 = 10; ``` The most participants a voice channel can have on any host (`mesh_max` ≤ this). Every participant's key package is in the `voice.join` response, which must fit in `MAX_FRAME` (9 base64 packages of `VOICE_KEY_PACKAGE_MAX` bytes are about 74 KiB), and one `voice.keys` for the whole mesh must fit in `MAX_COMMAND`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.VOICE_MESH_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-voice_sender_keys_max/ --- # Constant limits::VOICE_SENDER_KEYS_MAX > Largest `sender_keys` of `voice.keys`, decoded bytes: the sender's signed message for one epoch, the same for every recipient (the media layer's are at most 5 468 bytes). `zaun_community_protocol::limits::VOICE_SENDER_KEYS_MAX` · Constant ```rust pub const VOICE_SENDER_KEYS_MAX: usize = 6_144; ``` Largest `sender_keys` of `voice.keys`, decoded bytes: the sender's signed message for one epoch, the same for every recipient (the media layer's are at most 5 468 bytes). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.VOICE_SENDER_KEYS_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-voice_signal_max/ --- # Constant limits::VOICE_SIGNAL_MAX > Largest `data` of `voice.signal` (WebRTC SDP or ICE), decoded bytes. `zaun_community_protocol::limits::VOICE_SIGNAL_MAX` · Constant ```rust pub const VOICE_SIGNAL_MAX: usize = 8_192; ``` Largest `data` of `voice.signal` (WebRTC SDP or ICE), decoded bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.VOICE_SIGNAL_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-voice_user_limit/ --- # Constant limits::VOICE_USER_LIMIT > `user_limit` of a voice channel. `zaun_community_protocol::limits::VOICE_USER_LIMIT` · Constant ```rust pub const VOICE_USER_LIMIT: (u32, u32) = _; ``` `user_limit` of a voice channel. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.VOICE_USER_LIMIT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-limits-voice_wrapped_key_max/ --- # Constant limits::VOICE_WRAPPED_KEY_MAX > Largest `wrapped` key of one `voice.keys` entry, decoded bytes (the media layer's are 1 168 bytes). `zaun_community_protocol::limits::VOICE_WRAPPED_KEY_MAX` · Constant ```rust pub const VOICE_WRAPPED_KEY_MAX: usize = 1_536; ``` Largest `wrapped` key of one `voice.keys` entry, decoded bytes (the media layer's are 1 168 bytes). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/constant.VOICE_WRAPPED_KEY_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-all/ --- # Constant permissions::ALL > `ALL` means every known bit, never `u64::MAX` (permissions the protocol). `zaun_community_protocol::permissions::ALL` · Constant ```rust pub const ALL: Permissions = Permissions::KNOWN; ``` `ALL` means every known bit, never `u64::MAX` (permissions the protocol). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/constant.ALL.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-dm_grants/ --- # Constant permissions::DM_GRANTS > What both participants of a `dm` channel may always do. `zaun_community_protocol::permissions::DM_GRANTS` · Constant ```rust pub const DM_GRANTS: Permissions = _; ``` What both participants of a `dm` channel may always do. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/restrict/constant.DM_GRANTS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-dm_if_granted/ --- # Constant permissions::DM_IF_GRANTED > What a participant may do in a `dm` channel only when its roles grant it in the community. `zaun_community_protocol::permissions::DM_IF_GRANTED` · Constant ```rust pub const DM_IF_GRANTED: Permissions = _; ``` What a participant may do in a `dm` channel only when its roles grant it in the community. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/restrict/constant.DM_IF_GRANTED.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-expensive_history_depth/ --- # Constant permissions::EXPENSIVE_HISTORY_DEPTH > `restrict_expensive`: a restricted member reads only the newest this-many sequences of a channel, `sequence > head − EXPENSIVE_HISTORY_DEPTH`. One full `message.history` page. `zaun_community_protocol::permissions::EXPENSIVE_HISTORY_DEPTH` · Constant ```rust pub const EXPENSIVE_HISTORY_DEPTH: u64 = 100; ``` `restrict_expensive`: a restricted member reads only the newest this-many sequences of a channel, `sequence > head − EXPENSIVE_HISTORY_DEPTH`. One full `message.history` page. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/lockdown/constant.EXPENSIVE_HISTORY_DEPTH.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-expensive_member_page/ --- # Constant permissions::EXPENSIVE_MEMBER_PAGE > `restrict_expensive`: the most members one `member.list` page returns to a restricted member, who gets only the first page. `zaun_community_protocol::permissions::EXPENSIVE_MEMBER_PAGE` · Constant ```rust pub const EXPENSIVE_MEMBER_PAGE: u32 = 50; ``` `restrict_expensive`: the most members one `member.list` page returns to a restricted member, who gets only the first page. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/lockdown/constant.EXPENSIVE_MEMBER_PAGE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-lock_mask/ --- # Constant permissions::LOCK_MASK > Bits the channel `locked` flag removes (step 7d). `zaun_community_protocol::permissions::LOCK_MASK` · Constant ```rust pub const LOCK_MASK: Permissions = _; ``` Bits the channel `locked` flag removes (step 7d). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/constant.LOCK_MASK.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-pending_allowed/ --- # Constant permissions::PENDING_ALLOWED > Commands a `Pending` member may issue. `verification.*` (P2, reserved) is not listed. `zaun_community_protocol::permissions::PENDING_ALLOWED` · Constant ```rust pub const PENDING_ALLOWED: &[&str] = _; ``` Commands a `Pending` member may issue. `verification.*` (P2, reserved) is not listed. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/constant.PENDING_ALLOWED.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-safety-newcomer_forbidden/ --- # Constant permissions::safety::NEWCOMER_FORBIDDEN > Bits `newcomer_restrictions` must never contain: newcomers always see and read. `zaun_community_protocol::permissions::safety::NEWCOMER_FORBIDDEN` · Constant ```rust pub const NEWCOMER_FORBIDDEN: Permissions = _; ``` Bits `newcomer_restrictions` must never contain: newcomers always see and read. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/safety/constant.NEWCOMER_FORBIDDEN.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-suspended_allowed/ --- # Constant permissions::SUSPENDED_ALLOWED > Commands a `Suspended` member may issue: the same as `Pending`. `zaun_community_protocol::permissions::SUSPENDED_ALLOWED` · Constant ```rust pub const SUSPENDED_ALLOWED: &[&str] = PENDING_ALLOWED; ``` Commands a `Suspended` member may issue: the same as `Pending`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/constant.SUSPENDED_ALLOWED.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-table/ --- # Constant permissions::TABLE > Every command of the table with its requirement, in specification order. `zaun_community_protocol::permissions::TABLE` · Constant ```rust pub const TABLE: &[(&str, Requirement)] = _; ``` Every command of the table with its requirement, in specification order. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/table/constant.TABLE.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-timeout_keep/ --- # Constant permissions::TIMEOUT_KEEP > Bits a timed-out member keeps (step 7a). `zaun_community_protocol::permissions::TIMEOUT_KEEP` · Constant ```rust pub const TIMEOUT_KEEP: Permissions = _; ``` Bits a timed-out member keeps (step 7a). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/constant.TIMEOUT_KEEP.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-unbound_allowed/ --- # Constant permissions::UNBOUND_ALLOWED > Commands an unbound (negotiated) connection may send: `community.rotations` too, naming the community in the envelope's `community_id` (the chain is public and signed; a client nee `zaun_community_protocol::permissions::UNBOUND_ALLOWED` · Constant ```rust pub const UNBOUND_ALLOWED: &[&str] = _; ``` Commands an unbound (negotiated) connection may send: `community.rotations` too, naming the community in the envelope's `community_id` (the chain is public and signed; a client needs it to verify a welcome before it can bind). SPEC: the protocol and the the protocol `community_id` row still list only the other commands; the protocol and permissions.md the protocol allow unbound `community.rotations`, and are followed here. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/constant.UNBOUND_ALLOWED.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-unbound_only/ --- # Constant permissions::UNBOUND_ONLY > Commands that only make sense unbound; a bound connection gets `CONFLICT`. `zaun_community_protocol::permissions::UNBOUND_ONLY` · Constant ```rust pub const UNBOUND_ONLY: &[&str] = _; ``` Commands that only make sense unbound; a bound connection gets `CONFLICT`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/constant.UNBOUND_ONLY.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-permissions-waiting_mask/ --- # Constant permissions::WAITING_MASK > Bits the admission policy's waiting period withholds: posting, reacting and creating invitations. `zaun_community_protocol::permissions::WAITING_MASK` · Constant ```rust pub const WAITING_MASK: Permissions = _; ``` Bits the admission policy's waiting period withholds: posting, reacting and creating invitations. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/restrict/constant.WAITING_MASK.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-app_id_max/ --- # Constant signed::APP_ID_MAX > Bytes of `app_id` (3–64). `zaun_community_protocol::signed::APP_ID_MAX` · Constant ```rust pub const APP_ID_MAX: usize = 64; ``` Bytes of `app_id` (3–64). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/constant.APP_ID_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-clock_skew_ms/ --- # Constant signed::CLOCK_SKEW_MS > Clock-skew allowance on delegation validity windows (rule 4), in milliseconds. `zaun_community_protocol::signed::CLOCK_SKEW_MS` · Constant ```rust pub const CLOCK_SKEW_MS: u64 = 300_000; ``` Clock-skew allowance on delegation validity windows (rule 4), in milliseconds. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/validity/constant.CLOCK_SKEW_MS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-entry_name_max/ --- # Constant signed::ENTRY_NAME_MAX > Bytes per chunk name. `zaun_community_protocol::signed::ENTRY_NAME_MAX` · Constant ```rust pub const ENTRY_NAME_MAX: usize = 128; ``` Bytes per chunk name. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/export_manifest/constant.ENTRY_NAME_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-export_format/ --- # Constant signed::EXPORT_FORMAT > The bundle format this manifest describes. `zaun_community_protocol::signed::EXPORT_FORMAT` · Constant ```rust pub const EXPORT_FORMAT: &str = "zaun-export/v1"; ``` The bundle format this manifest describes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/export_manifest/constant.EXPORT_FORMAT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-format_v1/ --- # Constant signed::FORMAT_V1 > The `format` byte of every v1 signed object. `zaun_community_protocol::signed::FORMAT_V1` · Constant ```rust pub const FORMAT_V1: u8 = 0x01; ``` The `format` byte of every v1 signed object. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/object/constant.FORMAT_V1.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-manifest_entries_max/ --- # Constant signed::MANIFEST_ENTRIES_MAX > At most this many chunks. `zaun_community_protocol::signed::MANIFEST_ENTRIES_MAX` · Constant ```rust pub const MANIFEST_ENTRIES_MAX: usize = _; ``` At most this many chunks. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/export_manifest/constant.MANIFEST_ENTRIES_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-package_format/ --- # Constant signed::PACKAGE_FORMAT > The package format this header describes. `zaun_community_protocol::signed::PACKAGE_FORMAT` · Constant ```rust pub const PACKAGE_FORMAT: &str = "zaun-bot/v1"; ``` The package format this header describes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/constant.PACKAGE_FORMAT.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-package_magic/ --- # Constant signed::PACKAGE_MAGIC > The file's first four bytes. `zaun_community_protocol::signed::PACKAGE_MAGIC` · Constant ```rust pub const PACKAGE_MAGIC: &[u8; 4] = b"ZBOT"; ``` The file's first four bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/constant.PACKAGE_MAGIC.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-package_version/ --- # Constant signed::PACKAGE_VERSION > The container version byte after the magic. `zaun_community_protocol::signed::PACKAGE_VERSION` · Constant ```rust pub const PACKAGE_VERSION: u8 = 0x01; ``` The container version byte after the magic. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/constant.PACKAGE_VERSION.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-supported_worlds/ --- # Constant signed::SUPPORTED_WORLDS > The `zaun:bot` worlds a host built from this crate runs; a package for any other is refused at install and update (it could never load). Kept equal to the bot runtime's list. `zaun_community_protocol::signed::SUPPORTED_WORLDS` · Constant ```rust pub const SUPPORTED_WORLDS: &[&str] = _; ``` The `zaun:bot` worlds a host built from this crate runs; a package for any other is refused at install and update (it could never load). Kept equal to the bot runtime's list. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/rules/constant.SUPPORTED_WORLDS.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-version_max/ --- # Constant signed::VERSION_MAX > Bytes of `version`. `zaun_community_protocol::signed::VERSION_MAX` · Constant ```rust pub const VERSION_MAX: usize = 64; ``` Bytes of `version`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/constant.VERSION_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/constant-signed-world_max/ --- # Constant signed::WORLD_MAX > Bytes of `world`. `zaun_community_protocol::signed::WORLD_MAX` · Constant ```rust pub const WORLD_MAX: usize = 64; ``` Bytes of `world`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/constant.WORLD_MAX.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-builderror/ --- # Enum client::BuildError > An owner or member object (descriptor, delegation, registration, body) could not be built. `zaun_community_protocol::client::BuildError` · Enum ```rust pub enum BuildError { … } ``` An owner or member object (descriptor, delegation, registration, body) could not be built. ## Variants ### `HostId` The advertised host key does not derive the advertised `HostId`. ### `WrongRootKey` The signing key is not the descriptor's current root key. ### `OwnerKey` The member key is not the descriptor's `owner_member_key`. ### `Signed(SignedError)` A field breaks its rule, or signing failed. ### `Body(BodyError)` The command body breaks a state-free rule. ## Trait implementations `Clone`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/error/enum.BuildError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-clienterror/ --- # Enum client::ClientError > A command could not be prepared or the session refuses to send it. `zaun_community_protocol::client::ClientError` · Enum ```rust pub enum ClientError { … } ``` A command could not be prepared or the session refuses to send it. ## Variants ### `InvalidBody(BodyError)` The body breaks a state-free rule; nothing was sent. ### `Serialize` The body or envelope failed to serialise (never expected for this crate's types). ### `Frame(EncodeError)` The envelope exceeds its size limit or cannot be framed. ### `TooLarge { len, limit }` The envelope exceeds the command limit for its type. ### `Rng(RngError)` The OS random number generator failed. ### `NotReady` No verified `session.welcome` yet: call `super::Session::hello` and wait. ### `Failed(WelcomeError)` The welcome failed verification; the session MUST NOT send commands. ### `WrongCommunity` `community_id` differs from the session's binding. ### `WrongKind(&'static str)` `super::Session::send_signal` with a non-signal body, or `send` with a signal. ## Trait implementations `Clone`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/error/enum.ClientError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-clientevent/ --- # Enum client::ClientEvent > One outcome for the application. `zaun_community_protocol::client::ClientEvent` · Enum ```rust pub enum ClientEvent { … } ``` One outcome for the application. ## Variants ### `Welcome(Box)` The welcome verified: commands may be sent. ### `WelcomeRejected(WelcomeError)` The welcome failed verification; the session is dead and SHOULD alert the user. ### `Response(Response)` A final response to a command. ### `Retrying { request_id, kind, error, retry_at_ms }` A transient error (`BUSY`, `RATE_LIMITED`, `SLOWMODE_ACTIVE`, `INTERNAL`): the same request is resent at `retry_at_ms`. For the session's own `sync.ack` refused with `RATE_LIMITED` (`kind` `"sync.ack"`, a `request_id` the application never saw) a new ack with the cursors current at `retry_at_ms` is sent instead; nothing needs doing. ### `GaveUp { request_id, kind }` No response within the give-up time (24 h, the protocol); the request is abandoned. ### `Event(Box)` A catalogue event applied in stream order. ### `Gap(Gap)` A sequence gap; the session has sent `sync.resume` to repair it. ### `ResyncRequired { stream, channel_id }` A stream is older than the host's retention: take a snapshot (member stream) or page `message.history` (channel), then reset its cursor. ### `ProtocolError(ProtocolError)` Something was received and ignored safely. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/event/enum.ClientEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-expectedhost/ --- # Enum client::ExpectedHost > The host the client expects to reach. The welcome's host key must match. `zaun_community_protocol::client::ExpectedHost` · Enum ```rust pub enum ExpectedHost { … } ``` The host the client expects to reach. The welcome's host key must match. ## Variants ### `Key(PublicKey)` A known host key (from a delegation the owner signed, or a stored session). ### `Id(HostId)` A host id (from an invitation link or the host's advertised info). ## Methods ### `matches` ```rust pub fn matches(&self, key: &PublicKey) -> bool ``` Whether `key` is this host. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/config/enum.ExpectedHost.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-member-linkerror/ --- # Enum client::member::LinkError > A link that is not a valid invitation. Carries no part of the input. `zaun_community_protocol::client::member::LinkError` · Enum ```rust pub enum LinkError { … } ``` A link that is not a valid invitation. Carries no part of the input. ## Variants ### `Prefix` Not `zaun://join/…`. ### `Encoding` Not strict base64url. ### `Payload` Not a canonical `InvitePayload`. ### `Field` The host address is empty or too long, or the version range is invalid. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/link/enum.LinkError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-protocolerror/ --- # Enum client::ProtocolError > Input ignored safely. `zaun_community_protocol::client::ProtocolError` · Enum ```rust pub enum ProtocolError { … } ``` Input ignored safely. ## Variants ### `NotProtocol` Text without the `zaun:` prefix. ### `UnknownPrefix` An unknown frame prefix (`zaun:2:` …). ### `MalformedFragment` A malformed fragment header. ### `FragmentDiscarded(DiscardReason)` A fragment reassembly was discarded. ### `TooLarge` An envelope above `max_frame`. ### `MalformedEnvelope` Not a valid response, event or batch envelope. ### `BadBatch` A batch inside a batch, or a batch element for another community. ### `WrongVersion(u16)` An event whose `v` is not the negotiated version (dropped, the protocol). ### `WrongCommunity` An event for another community than the session's. ### `MalformedEvent(String)` A known event type with a malformed body; its cursor still advances. ### `UncorrelatedError(ErrorBody)` An error response with `request_id: null`. ### `NotReady` An event before a verified welcome or after a failed one (dropped). ### `BindingMismatch` A binding response names another community than the one requested; not bound. ### `AutoSend(ClientError)` An automatic `sync.resume` or `sync.ack` could not be prepared. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/event/enum.ProtocolError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-sessionstate/ --- # Enum client::SessionState > Where the session is in its lifecycle. `zaun_community_protocol::client::SessionState` · Enum ```rust pub enum SessionState { … } ``` Where the session is in its lifecycle. ## Variants ### `Idle` No `session.hello` sent yet. ### `AwaitingWelcome` `session.hello` sent; commands wait for the welcome. ### `Ready` The welcome verified; commands flow. ### `Failed(WelcomeError)` The welcome failed verification; nothing more may be sent on this session. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/session/enum.SessionState.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-client-welcomeerror/ --- # Enum client::WelcomeError > Why a `session.welcome` was rejected. `zaun_community_protocol::client::WelcomeError` · Enum ```rust pub enum WelcomeError { … } ``` Why a `session.welcome` was rejected. ## Variants ### `Malformed` The welcome body is not a valid `session.welcome`. ### `Version { version, offered }` The negotiated version is outside the range this client offered. ### `Host` The host key or id is not the expected host. ### `HostId` The welcome's `host_id` does not derive from its `host_public_key`. ### `MissingCommunity` A community was expected but the welcome carries no descriptor, delegation or proof naming it. ### `Binding` The welcome binds the connection to another community. ### `Pair(ValidityError)` The descriptor/delegation pair is not valid. ### `Delegation` The delegation does not name this host or lacks `OPERATE`. ### `ChainIncomplete` The rotation chain is longer than the client knows; fetch `community.rotations`. ### `Proof(SessionProofError)` The host session proof failed. ### `Challenge` The proof's challenge differs from the welcome's. ### `Refused` The host answered `session.hello` with an error (for example `UNSUPPORTED_VERSION`). ## Trait implementations `Clone`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/error/enum.WelcomeError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-bodyerror/ --- # Enum command::BodyError > A body that cannot be accepted. Each variant maps to one error code of the protocol; the envelope layer adds `request_id`, the message text and the extra fields. `zaun_community_protocol::command::BodyError` · Enum ```rust pub enum BodyError { … } ``` A body that cannot be accepted. Each variant maps to one error code of the protocol; the envelope layer adds `request_id`, the message text and the extra fields. SPEC: the protocol lets an over-limit field be either `BAD_REQUEST` ("value out of range") or `PAYLOAD_TOO_LARGE` ("an envelope or field exceeds the protocol"). This crate applies one rule: a text, byte string or list **longer** than a the protocol maximum is `BodyError::PayloadTooLarge`; every other violation (missing, ill-typed, below a minimum, numeric range, rule) is `BodyError::BadRequest`. ## Variants ### `BadRequest { field, detail }` `BAD_REQUEST{field?}`: malformed, missing, ill-typed or out-of-range value. ### `UnsupportedCommand` `UNSUPPORTED_COMMAND`: unknown `type`, or a reserved namespace. ### `UnsupportedFeature { feature }` `UNSUPPORTED_FEATURE{feature}`: a known name or value not implemented in v1. ### `PayloadTooLarge { field, limit }` `PAYLOAD_TOO_LARGE{limit}`: a field longer than its the protocol maximum. ## Methods ### `code` ```rust pub const fn code(&self) -> ErrorCode ``` The the protocol error code to answer with. ### `field` ```rust pub fn field(&self) -> Option<&str> ``` The field at fault, when one is known. ### `bad` ```rust pub fn bad>(field: &str, detail: impl Into) -> Self ``` `BAD_REQUEST` blaming `field`. ### `too_large` ```rust pub fn too_large(field: &str, limit: usize) -> Self ``` `PAYLOAD_TOO_LARGE` for `field` with `limit`. ### `unsupported` ```rust pub fn unsupported(feature: &str) -> Self ``` `UNSUPPORTED_FEATURE` for `feature`. ## Trait implementations `Clone`, `Debug`, `Display`, `Eq`, `Error`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/error/enum.BodyError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-command/ --- # Enum command::Command > A decoded command body: one variant per command of the protocol `zaun_community_protocol::command::Command` · Enum ```rust pub enum Command { … } ``` A decoded command body: one variant per command of the protocol ## Variants ### `SessionHello(Hello)` `session.hello` ### `CommunityCreate(Create)` `community.create` ### `CommunityGet(Get)` `community.get` ### `CommunityIconGet(IconGet)` `community.icon.get` ### `CommunityRotations(Rotations)` `community.rotations` ### `CommunityUpdate(Update)` `community.update` ### `CommunityDescriptorPublish(DescriptorPublish)` `community.descriptor.publish` ### `CommunityLeave(Leave)` `community.leave` ### `ChannelCreate(Create)` `channel.create` ### `ChannelUpdate(Update)` `channel.update` ### `ChannelDelete(Delete)` `channel.delete` ### `ChannelReorder(Reorder)` `channel.reorder` ### `ChannelPermissionsUpdate(PermissionsUpdate)` `channel.permissions.update` ### `MemberList(List)` `member.list` ### `MemberGet(Get)` `member.get` ### `MemberUpdate(Update)` `member.update` ### `MemberRolesUpdate(RolesUpdate)` `member.roles.update` ### `MemberKick(Kick)` `member.kick` ### `MemberBan(BanMember)` `member.ban` ### `MemberUnban(Unban)` `member.unban` ### `MemberBans(Bans)` `member.bans` ### `MemberTimeout(Timeout)` `member.timeout` ### `MemberStatusSet(StatusSet)` `member.status.set` ### `RoleCreate(Create)` `role.create` ### `RoleUpdate(Update)` `role.update` ### `RoleDelete(Delete)` `role.delete` ### `RoleReorder(Reorder)` `role.reorder` ### `MessageSend(Send)` `message.send` ### `MessageEdit(Edit)` `message.edit` ### `MessageDelete(Delete)` `message.delete` ### `MessageHistory(History)` `message.history` ### `ReactionAdd(ReactionAdd)` `reaction.add` ### `ReactionRemove(ReactionRemove)` `reaction.remove` ### `AttachmentUpload(Upload)` `attachment.upload` ### `AttachmentDownload(Download)` `attachment.download` ### `InviteCreate(Create)` `invite.create` ### `InviteRedeem(Redeem)` `invite.redeem` ### `InviteRevoke(Revoke)` `invite.revoke` ### `InviteList(List)` `invite.list` ### `InviteUses(Uses)` `invite.uses` ### `AuditList(List)` `audit.list` ### `SyncSnapshot(Snapshot)` `sync.snapshot` ### `SyncEvents(Events)` `sync.events` ### `SyncResume(Resume)` `sync.resume` ### `SyncAck(Ack)` `sync.ack` ### `MembershipRequest(Request)` `membership.request` ### `MembershipApprove(Approve)` `membership.approve` ### `MembershipReject(Reject)` `membership.reject` ### `MembershipSuspend(Suspend)` `membership.suspend` ### `MembershipRestore(Restore)` `membership.restore` ### `MembershipPending(Pending)` `membership.pending` ### `AdmissionPolicyGet(PolicyGet)` `admission.policy.get` ### `AdmissionPolicyUpdate(PolicyUpdate)` `admission.policy.update` ### `LockdownGet(Get)` `moderation.lockdown.get` ### `LockdownEnable(Enable)` `moderation.lockdown.enable` ### `LockdownDisable(Disable)` `moderation.lockdown.disable` ### `ReportCreate(Create)` `report.create` ### `ReportList(List)` `report.list` ### `ReportGet(Get)` `report.get` ### `ReportReview(Review)` `report.review` ### `ReportResolve(Resolve)` `report.resolve` ### `VoiceJoin(Join)` `voice.join` ### `VoiceLeave(Leave)` `voice.leave` ### `VoiceUpdate(Update)` `voice.update` ### `VoiceSignal(Signal)` `voice.signal` ### `VoiceKeys(Keys)` `voice.keys` ### `VoiceModerate(Moderate)` `voice.moderate` ### `SignalTyping(Typing)` `signal.typing` ### `SignalPresence(Presence)` `signal.presence` ### `PresenceList(List)` `presence.list` ### `MigrationReauth(Reauth)` `migration.reauth` ### `BotInstall(Install)` `bot.install` ### `BotUpdate(Update)` `bot.update` ### `BotGrant(Grant)` `bot.grant` ### `BotEnable(Enable)` `bot.enable` ### `BotDisable(Disable)` `bot.disable` ### `BotRemove(Remove)` `bot.remove` ### `BotRegister(Register)` `bot.register` ### `BotConfigure(Configure)` `bot.configure` ### `BotList(List)` `bot.list` ### `BotGet(Target)` `bot.get` ### `CommandSet(Set)` `command.set` ### `CommandList(List)` `command.list` ### `InteractionCreate(Create)` `interaction.create` ### `InteractionRespond(Respond)` `interaction.respond` ### `InteractionFollowup(Followup)` `interaction.followup` ### `InteractionOriginalEdit(OriginalEdit)` `interaction.original.edit` ### `InteractionOriginalDelete(OriginalDelete)` `interaction.original.delete` ### `DmOpen(Open)` `dm.open` ### `DmClose(Close)` `dm.close` ### `DmList(List)` `dm.list` ### `MemberSettingsGet(SettingsGet)` `member.settings.get` ### `MemberSettingsUpdate(SettingsUpdate)` `member.settings.update` ## Methods ### `is_channel_scoped` ```rust pub fn is_channel_scoped(&self) -> bool ``` Whether the command needs a channel: the envelope's `channel_id` or the body's (`Command::channel_id`). `invite.create` and `sync.events` name an optional or stream-dependent channel in the body only and are not listed. ### `channel_id` ```rust pub const fn channel_id(&self) -> Option ``` The `channel_id` carried in the body, for commands whose the protocol/the protocol body lists one. When both the envelope and the body carry one they must be equal (envelope layer). ### `is_mutating` ```rust pub fn is_mutating(&self) -> bool ``` Whether the command is mutating, hence idempotency-recorded; the same rule as `crate::envelope::is_mutating` on the command's wire name. ### `validate_at` ```rust pub fn validate_at(&self, now_ms: u64) -> Result<(), BodyError> ``` `Command::validate` plus the bounds relative to the host's clock: `member.timeout` `until` ≤ now + 28 days and `membership.suspend` `until` ≤ now + 90 days. SPEC: whether an `until` in the past is an error is not said; it is accepted here (the engine treats it as already elapsed). # Errors As `Command::validate`, or `BAD_REQUEST{field: "until"}`. ### `name` ```rust pub const fn name(&self) -> &'static str ``` The wire name (`type`). ### `validate` ```rust pub fn validate(&self) -> Result<(), BodyError> ``` Runs the body's state-free checks. # Errors The first violated rule. ### `visit` ```rust pub fn visit(&self, visitor: V) -> ::Output ``` Calls `visitor` with the typed body (to send a command known only at run time). ### `parse` ```rust pub fn parse(type_: &str, body: &str) -> Result ``` Decodes `body` (the envelope's raw `body` JSON) as the command `type_` and runs its state-free checks. # Errors - `type_` unknown or in a the protocol namespace → `BodyError::UnsupportedCommand`; - a the protocol reserved command → `BodyError::UnsupportedFeature` naming it; - a malformed body → `BodyError::BadRequest` (with the top-level field when known); - a failed check → whatever `Command::validate` returns. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/enum.Command.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-interaction-createdata/ --- # Enum command::interaction::CreateData > `interaction.create` data, by type. `zaun_community_protocol::command::interaction::CreateData` · Enum ```rust pub enum CreateData { … } ``` `interaction.create` data, by type. ## Variants ### `Command { command_id, options, target_id }` Types 2 and 4. ### `Component { message_id, custom_id, values }` Type 3. ### `Modal { modal_id, custom_id, components }` Type 5. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/enum.CreateData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-interaction-responsedata/ --- # Enum command::interaction::ResponseData > Response data, by type. `zaun_community_protocol::command::interaction::ResponseData` · Enum ```rust pub enum ResponseData { … } ``` Response data, by type. ## Variants ### `Message(Box)` Types 4 and 7. ### `Deferred { flags }` Type 5: only `EPHEMERAL` may be set. ### `None` Type 6. ### `Autocomplete { choices }` Type 8. ### `Modal { custom_id, title, components }` Type 9. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/enum.ResponseData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-interaction-responsetype/ --- # Enum command::interaction::ResponseType > Interaction response types (Discord's callback numbers). `zaun_community_protocol::command::interaction::ResponseType` · Enum ```rust pub enum ResponseType { … } ``` Interaction response types (Discord's callback numbers). ## Variants ### `ChannelMessage` 4: a message. ### `DeferredChannelMessage` 5: a loading message, edited later. ### `DeferredUpdateMessage` 6: acknowledge a component without a visible change yet. ### `UpdateMessage` 7: edit the component's message. ### `AutocompleteResult` 8: autocomplete choices. ### `Modal` 9: open a modal. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `From`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `TryFrom` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/enum.ResponseType.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-activitytype/ --- # Enum command::object::ActivityType > What the member is doing. `zaun_community_protocol::command::object::ActivityType` · Enum ```rust pub enum ActivityType { … } ``` What the member is doing. ## Variants ### `Playing` "Playing {name}". ### `Streaming` "Streaming {name}", with a link. ### `Listening` "Listening to {name}". ### `Watching` "Watching {name}". ### `Competing` "Competing in {name}". ### `Custom` `{emoji} {name}`: free text. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/presence/enum.ActivityType.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-admissionvia/ --- # Enum command::object::AdmissionVia > `admission.via`. SPEC: a plain string (`"invite" | "request"`), not `{t}`. `zaun_community_protocol::command::object::AdmissionVia` · Enum ```rust pub enum AdmissionVia { … } ``` `admission.via`. SPEC: a plain string (`"invite" | "request"`), not `{t}`. ## Variants ### `Invite` `invite.redeem`. ### `Request` `membership.request`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/member/enum.AdmissionVia.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-availability/ --- # Enum command::object::Availability > `availability`. SPEC: a plain string, as written in the spec. `zaun_community_protocol::command::object::Availability` · Enum ```rust pub enum Availability { … } ``` `availability`. SPEC: a plain string, as written in the spec. ## Variants ### `Stored` The host holds the bytes. ### `Expired` Retention expired. ### `Removed` Removed by moderation or the author. ### `Failed` The upload never reached the host, or arrived different from its declaration; the attachment is gone and `failure` says why (only in `attachment.updated`). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/message/enum.Availability.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-botkind/ --- # Enum command::object::BotKind > `kind` of a bot. `zaun_community_protocol::command::object::BotKind` · Enum ```rust pub enum BotKind { … } ``` `kind` of a bot. ## Variants ### `Hosted` A WebAssembly component the host runs. ### `External` A member connecting over SimpleX that the owner marked as a bot. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/enum.BotKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-botstate/ --- # Enum command::object::BotState > `state` of an installed bot. `zaun_community_protocol::command::object::BotState` · Enum ```rust pub enum BotState { … } ``` `state` of an installed bot. ## Variants ### `Enabled` Running. ### `Disabled` Stopped by the owner or the operator. ### `PendingApproval` An update waits for the owner to grant more. ### `Crashed` Stopped after repeated crashes. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/enum.BotState.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-buttonstyle/ --- # Enum command::object::ButtonStyle > Button `style`: 1 primary, 2 secondary, 3 success, 4 danger, 5 link. `zaun_community_protocol::command::object::ButtonStyle` · Enum ```rust pub enum ButtonStyle { … } ``` Button `style`: 1 primary, 2 secondary, 3 success, 4 danger, 5 link. ## Variants ### `Primary` 1. ### `Secondary` 2. ### `Success` 3. ### `Danger` 4. ### `Link` 5: opens `url` after the reader confirms; sends no interaction. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `From`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `TryFrom` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/enum.ButtonStyle.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-choicevalue/ --- # Enum command::object::ChoiceValue > A choice `value`: a string or a number. `zaun_community_protocol::command::object::ChoiceValue` · Enum ```rust pub enum ChoiceValue { … } ``` A choice `value`: a string or a number. ## Variants ### `String(String)` For `STRING` options. ### `Number(f64)` For `INTEGER` and `NUMBER` options. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/enum.ChoiceValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-commandtype/ --- # Enum command::object::CommandType > `type` of a command: 1 `CHAT_INPUT` (a slash command), 2 `USER`, 3 `MESSAGE` (context menus). `zaun_community_protocol::command::object::CommandType` · Enum ```rust pub enum CommandType { … } ``` `type` of a command: 1 `CHAT_INPUT` (a slash command), 2 `USER`, 3 `MESSAGE` (context menus). ## Variants ### `ChatInput` 1. ### `User` 2: on a member. ### `Message` 3: on a message. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `From`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq`, `TryFrom` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/enum.CommandType.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-component/ --- # Enum command::object::Component > One component. The variant is the wire `type` number. `zaun_community_protocol::command::object::Component` · Enum ```rust pub enum Component { … } ``` One component. The variant is the wire `type` number. ## Variants ### `ActionRow(ActionRow)` 1: a row of up to five buttons or one select. ### `Button(Button)` 2. ### `StringSelect(StringSelect)` 3. ### `TextInput(TextInput)` 4: modal only, inside a label. ### `UserSelect(EntitySelect)` 5. ### `RoleSelect(EntitySelect)` 6. ### `MentionableSelect(EntitySelect)` 7: members and roles. ### `ChannelSelect(EntitySelect)` 8. ### `Section(Section)` 9: text with a button or thumbnail beside it (V2). ### `TextDisplay(TextDisplay)` 10: markdown text (V2, modal). ### `Thumbnail(Thumbnail)` 11: a small picture, only as a section's accessory. ### `MediaGallery(MediaGallery)` 12: up to ten pictures (V2). ### `File(FileComponent)` 13: one attached file (V2). ### `Separator(Separator)` 14: space or a line between components (V2). ### `Container(Container)` 17: a box around other components (V2). ### `Label(Label)` 18: a modal field's label around one input. ### `FileUpload(FileUpload)` 19: files the invoker uploads in a modal. ### `RadioGroup(RadioGroup)` 21: one choice among options, in a modal. ### `CheckboxGroup(CheckboxGroup)` 22: several choices, in a modal. ### `Checkbox(Checkbox)` 23: one yes/no box, in a modal. ## Methods ### `kind` ```rust pub const fn kind(&self) -> u8 ``` The wire `type` number. ### `custom_id` ```rust pub fn custom_id(&self) -> Option<&str> ``` The component's `custom_id`, for the kinds that send interactions or carry input. ### `children` ```rust pub fn children(&self) -> Vec<&Self> ``` The nested components, in order (children, then a section's accessory, then a label's input). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/enum.Component.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-defaultvaluekind/ --- # Enum command::object::DefaultValueKind > `default_values` entry kind of an entity select. `zaun_community_protocol::command::object::DefaultValueKind` · Enum ```rust pub enum DefaultValueKind { … } ``` `default_values` entry kind of an entity select. ## Variants ### `User` A member id. ### `Role` A role id. ### `Channel` A channel id. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/enum.DefaultValueKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-icepolicy/ --- # Enum command::object::IcePolicy > Which ICE candidates clients may use. `zaun_community_protocol::command::object::IcePolicy` · Enum ```rust pub enum IcePolicy { … } ``` Which ICE candidates clients may use. Peer-to-peer media shows each participant's IP address to the others. Only `relay` hides it: every packet goes through a TURN server, which sees addresses but not media. ## Variants ### `Relay` TURN relays only (`iceTransportPolicy: "relay"`): no participant learns another's address. ### `All` Relays and direct paths: direct paths reveal addresses to other participants. ### `Direct` The host has no TURN server: media can only go peer to peer, which reveals each participant's IP address to the others. Clients must ask the user before joining. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/voice/enum.IcePolicy.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-interactiondata/ --- # Enum command::object::InteractionData > `data` of an interaction, by type. `zaun_community_protocol::command::object::InteractionData` · Enum ```rust pub enum InteractionData { … } ``` `data` of an interaction, by type. ## Variants ### `Command { command_id, name, kind, options, resolved, target_id }` Types 2 and 4. ### `Component { custom_id, component_type, values, resolved }` Type 3. ### `Modal { custom_id, components, resolved }` Type 5. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/enum.InteractionData.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-interactiontype/ --- # Enum command::object::InteractionType > `type` of an interaction (Discord's numbers; `PING` is not used). `zaun_community_protocol::command::object::InteractionType` · Enum ```rust pub enum InteractionType { … } ``` `type` of an interaction (Discord's numbers; `PING` is not used). ## Variants ### `ApplicationCommand` 2: a slash, user or message command. ### `MessageComponent` 3: a button or select. ### `Autocomplete` 4: partial input of an autocomplete option. ### `ModalSubmit` 5: a submitted modal. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `From`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `TryFrom` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/enum.InteractionType.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-invitecreation/ --- # Enum command::object::InviteCreation > `invite_creation`. `zaun_community_protocol::command::object::InviteCreation` · Enum ```rust pub enum InviteCreation { … } ``` `invite_creation`. ## Variants ### `Permission` Anyone with `CREATE_INVITE`. ### `Active` Active members with `CREATE_INVITE`. ### `Moderators` Only members with `MANAGE_INVITES`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/admission/enum.InviteCreation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-lockdownview/ --- # Enum command::object::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_SAF `zaun_community_protocol::command::object::LockdownView` · Enum ```rust pub enum 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. ## Variants ### `Full(Lockdown)` For `MANAGE_SAFETY` holders. ### `Public(LockdownPublic)` For everyone else. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/lockdown/enum.LockdownView.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-optiontype/ --- # Enum command::object::OptionType > `type` of an option (Discord's numbers 1–11). `zaun_community_protocol::command::object::OptionType` · Enum ```rust pub enum OptionType { … } ``` `type` of an option (Discord's numbers 1–11). ## Variants ### `SubCommand` 1. ### `SubCommandGroup` 2. ### `String` 3. ### `Integer` 4: |x| < 2^53. ### `Boolean` 5. ### `User` 6: a member. ### `Channel` 7. ### `Role` 8. ### `Mentionable` 9: a member or a role. ### `Number` 10: a double. ### `Attachment` 11: an attachment the invoker uploaded. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `From`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `TryFrom` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/enum.OptionType.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-optionvaluekind/ --- # Enum command::object::OptionValueKind > An option value as the invoker gave it: a string, number, boolean or id. `zaun_community_protocol::command::object::OptionValueKind` · Enum ```rust pub enum OptionValueKind { … } ``` An option value as the invoker gave it: a string, number, boolean or id. ## Variants ### `Bool(bool)` Booleans. ### `Number(f64)` Integers and numbers. ### `String(String)` Strings and ids (base64url). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/enum.OptionValueKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-outcome/ --- # Enum command::object::Outcome > `outcome`. `zaun_community_protocol::command::object::Outcome` · Enum ```rust pub enum Outcome { … } ``` `outcome`. ## Variants ### `ActionTaken` A moderation action was taken separately. ### `NoAction` No action. ### `Duplicate` Duplicate of another report. ### `Invalid` Not a valid report. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/enum.Outcome.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-overridetarget/ --- # Enum command::object::OverrideTarget > The subject of an override: `{"t":"role","c":RoleId}` or `{"t":"member","c":MemberId}`. `zaun_community_protocol::command::object::OverrideTarget` · Enum ```rust pub enum OverrideTarget { … } ``` The subject of an override: `{"t":"role","c":RoleId}` or `{"t":"member","c":MemberId}`. ## Variants ### `Role(RoleId)` A role (including `@everyone`). ### `Member(MemberId)` A single member. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/channel/enum.OverrideTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-policylevel/ --- # Enum command::object::PolicyLevel > `level`. `zaun_community_protocol::command::object::PolicyLevel` · Enum ```rust pub enum PolicyLevel { … } ``` `level`. ## Variants ### `None` No friction beyond infrastructure limits. ### `Low` Low. ### `Medium` Medium (public default). ### `High` High. ### `Highest` Highest. ### `Custom` Edited fields. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/admission/enum.PolicyLevel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-policyview/ --- # Enum command::object::PolicyView > The full policy or the public summary, by the viewer's permissions (`admission.policy.updated` body, the protocol). The full form is tried first. `zaun_community_protocol::command::object::PolicyView` · Enum ```rust pub enum PolicyView { … } ``` The full policy or the public summary, by the viewer's permissions (`admission.policy.updated` body, the protocol). The full form is tried first. ## Variants ### `Full(AdmissionPolicy)` For `MANAGE_SAFETY` holders. ### `Summary(PolicySummary)` For everyone else. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/admission/enum.PolicyView.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-reportcategory/ --- # Enum command::object::ReportCategory > `category`. `zaun_community_protocol::command::object::ReportCategory` · Enum ```rust pub enum ReportCategory { … } ``` `category`. ## Variants ### `Spam` Spam. ### `Harassment` Harassment. ### `Illegal` Illegal content. ### `Exploitation` Exploitation. ### `Rules` Community rules. ### `Other` Anything else. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/enum.ReportCategory.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-reportstatus/ --- # Enum command::object::ReportStatus > `status`: a plain string, exactly `"open"|"reviewing"|"resolved"`. `zaun_community_protocol::command::object::ReportStatus` · Enum ```rust pub enum ReportStatus { … } ``` `status`: a plain string, exactly `"open"|"reviewing"|"resolved"`. ## Variants ### `Open` New. ### `Reviewing` A moderator is reviewing it. ### `Resolved` Resolved. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/enum.ReportStatus.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-reporttarget/ --- # Enum command::object::ReportTarget > `target: {t: "member"|"message", c}`. `zaun_community_protocol::command::object::ReportTarget` · Enum ```rust pub enum ReportTarget { … } ``` `target: {t: "member"|"message", c}`. ## Variants ### `Member(MemberId)` A member. ### `Message(MessageId)` A message. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/enum.ReportTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-restriction/ --- # Enum command::object::Restriction > One lockdown restriction. `zaun_community_protocol::command::object::Restriction` · Enum ```rust pub enum Restriction { … } ``` One lockdown restriction. ## Variants ### `PauseJoins` No new memberships. ### `DisableInviteRedeem` `invite.redeem` refused. ### `DisableInviteCreate` `invite.create` refused. ### `RequireApproval` Every join starts `pending`. ### `RestrictNewcomers` The newcomer mask applies to members admitted within `newcomer_window_s`. ### `DisableAttachments` No attachments. ### `DisableLinks` No links in content. ### `DisableMassMentions` No mass mentions. ### `RestrictVoice` No voice. ### `RestrictExpensive` Expensive operations blocked. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/lockdown/enum.Restriction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-stream/ --- # Enum command::object::Stream > An event stream. SPEC: a plain string, as in the the protocol `stream` field and the the protocol example (`"stream": "channel"`), not `{t}`. `zaun_community_protocol::command::object::Stream` · Enum ```rust pub enum Stream { … } ``` An event stream. SPEC: a plain string, as in the the protocol `stream` field and the the protocol example (`"stream": "channel"`), not `{t}`. ## Variants ### `Channel` Per channel, `channel_seq`. ### `Member` Per member, `member_seq`. ### `Live` Not sequenced, not recoverable. ## Methods ### `as_str` ```rust pub const fn as_str(self) -> &'static str ``` The wire string. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/enum.Stream.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-textinputstyle/ --- # Enum command::object::TextInputStyle > Text input `style`: 1 short, 2 paragraph. `zaun_community_protocol::command::object::TextInputStyle` · Enum ```rust pub enum TextInputStyle { … } ``` Text input `style`: 1 short, 2 paragraph. ## Variants ### `Short` 1: one line. ### `Paragraph` 2: several lines. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `From`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `TryFrom` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/enum.TextInputStyle.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-object-uploadfailure/ --- # Enum command::object::UploadFailure > `failure` of an upload: why the host does not hold it. `zaun_community_protocol::command::object::UploadFailure` · Enum ```rust pub enum UploadFailure { … } ``` `failure` of an upload: why the host does not hold it. ## Variants ### `FileServer` The file went to an XFTP server the host does not download from. A member uploads only to the servers `session.welcome.attachments.file_servers` lists. ### `Transfer` The host's download failed or was cancelled. ### `Mismatch` The bytes that arrived differ in size or SHA3-256 from the declaration. ### `NotReceived` No file arrived before `expires_at`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/message/enum.UploadFailure.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-signal-noresponse/ --- # Enum command::signal::NoResponse > A signal has no response. Uninhabited. `zaun_community_protocol::command::signal::NoResponse` · Enum ```rust pub enum NoResponse { … } ``` A signal has no response. Uninhabited. ## Variants ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/signal/enum.NoResponse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-signal-presencestatus/ --- # Enum command::signal::PresenceStatus > Presence status, in the the protocol tagged form. A client sends `online`, `idle`, `dnd` or `invisible` (`offline` from a client means `invisible`); others only ever see `online`, `zaun_community_protocol::command::signal::PresenceStatus` · Enum ```rust pub enum PresenceStatus { … } ``` Presence status, in the the protocol tagged form. A client sends `online`, `idle`, `dnd` or `invisible` (`offline` from a client means `invisible`); others only ever see `online`, `idle`, `dnd` and `offline` (invisible members and members without a connection). ## Variants ### `Online` Active. ### `Idle` Away. ### `Dnd` Do not disturb. ### `Invisible` Shown as offline to everyone else, while connected. ### `Offline` Not connected (or invisible, as others see it). ## Methods ### `public` ```rust pub const fn public(self) -> Self ``` How others see it: `invisible` (and a client's `offline`) is `offline`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/signal/enum.PresenceStatus.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-sync-snapshotitem/ --- # Enum command::sync::SnapshotItem > One snapshot item; the variant follows the requested part. `zaun_community_protocol::command::sync::SnapshotItem` · Enum ```rust pub enum SnapshotItem { … } ``` One snapshot item; the variant follows the requested part. ## Variants ### `Channel(Box)` `part: "channels"`. ### `Role(Role)` `part: "roles"`. ### `Community(Box)` `part: "community"`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/response/enum.SnapshotItem.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-sync-snapshotpart/ --- # Enum command::sync::SnapshotPart > `part`. SPEC: a plain string, as in the the protocol request. `zaun_community_protocol::command::sync::SnapshotPart` · Enum ```rust pub enum SnapshotPart { … } ``` `part`. SPEC: a plain string, as in the the protocol request. ## Variants ### `Community` Profile, descriptor, delegation and the member's own member object. ### `Roles` Role objects. ### `Channels` Visible channel objects with `head_seq`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/enum.SnapshotPart.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-command-typeclass/ --- # Enum command::TypeClass > What a command `type` string is to a v1 host. `zaun_community_protocol::command::TypeClass` · Enum ```rust pub enum TypeClass { … } ``` What a command `type` string is to a v1 host. ## Variants ### `Known` A v1 command (`Command::NAMES`). ### `ReservedNamed` A named reserved command: `UNSUPPORTED_FEATURE{feature: type}`. ### `ReservedNamespace` In a reserved namespace: `UNSUPPORTED_COMMAND`. ### `Unknown` Anything else: `UNSUPPORTED_COMMAND`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/reserved/enum.TypeClass.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-crypto-context/ --- # Enum crypto::Context > An RFC 10073 `ctx` value of this protocol. The verifier always supplies the context of the object type it expects; it is never read from the input. `zaun_community_protocol::crypto::Context` · Enum ```rust pub enum Context { … } ``` An RFC 10073 `ctx` value of this protocol. The verifier always supplies the context of the object type it expects; it is never read from the input. ## Variants ### `Descriptor` `CommunityDescriptor`, signed by the root key. ### `Delegation` `HostDelegation`, signed by the root key. ### `RootRotation` `RootRotation`, signed by the old and the new root key. ### `MemberKey` `MemberKeyRegistration`, signed by the member key. ### `HostSession` `HostSessionProof`, signed by the host key. ### `Checkpoint` `PublicCheckpoint`, signed by the host key. Experimental. ### `MemberReauth` `MemberReauth`, signed by the member key (migration). ### `ExportManifest` `ExportManifest`, signed by the host key (ADR-0013). ### `Verification` `VerificationAssertion`, signed by a verifier key. Reserved. ### `VoiceKeyPackage` `VoiceKeyPackage`, signed by the member key (ADR-0018). Experimental. ### `VoiceSenderKeys` `VoiceSenderKeys`, signed by the member key (ADR-0018). Experimental. ### `BotPackage` `BotPackage`, signed by a publisher key (ADR-0019, the protocol). ## Methods ### `as_bytes` ```rust pub const fn as_bytes(self) -> &'static [u8] ``` The ASCII `ctx` bytes. ### `status` ```rust pub const fn status(self) -> ContextStatus ``` The status column of the the protocol table. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/context/enum.Context.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-crypto-contextstatus/ --- # Enum crypto::ContextStatus > Whether a context is part of v1 conformance. `zaun_community_protocol::crypto::ContextStatus` · Enum ```rust pub enum ContextStatus { … } ``` Whether a context is part of v1 conformance. ## Variants ### `V1` Defined and used by protocol version 1. ### `Experimental` Experimental (Appendix A); not part of v1 conformance. ### `Reserved` Reserved for a later milestone; v1 implementations do not produce it. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/context/enum.ContextStatus.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-crypto-signerror/ --- # Enum crypto::SignError > Signing failed. `zaun_community_protocol::crypto::SignError` · Enum ```rust pub enum SignError { … } ``` Signing failed. ## Variants ### `Rng(RngError)` The OS CSPRNG failed while drawing the hedging randomness. ### `ContextTooLong` The context is longer than 255 bytes (never for a `super::Context`). ### `MlDsa` ML-DSA signing failed (deterministic variant only; FIPS 204 rejection-sampling bound). ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/error/enum.SignError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-crypto-verifyerror/ --- # Enum crypto::VerifyError > Verification failed. Callers map every variant to `INVALID_SIGNATURE`; the variants exist for tests and diagnostics only. `zaun_community_protocol::crypto::VerifyError` · Enum ```rust pub enum VerifyError { … } ``` Verification failed. Callers map every variant to `INVALID_SIGNATURE`; the variants exist for tests and diagnostics only. ## Variants ### `SuiteMismatch { key, sig }` The key's and the signature's suite bytes differ. ### `SuiteBelowMinimum { suite, min_suite }` The suite is below the community's `min_suite`. ### `ContextTooLong` The context is longer than 255 bytes. ### `Malformed` The raw key or signature components have the wrong length. ### `MlDsa` The ML-DSA-65 component did not verify. ### `Ed25519` The Ed25519 component did not verify strictly. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/error/enum.VerifyError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-crypto-voice-voiceerror/ --- # Enum crypto::voice::VoiceError > A voice key or frame operation failed. `zaun_community_protocol::crypto::voice::VoiceError` · Enum ```rust pub enum VoiceError { … } ``` A voice key or frame operation failed. ## Variants ### `Rng` The OS CSPRNG failed. ### `Encode(EncodeError)` A value breaks an encoding rule. ### `Decode(DecodeError)` Bytes are not a canonical encoding. ### `Signed(SignedError)` A member signature does not verify, or signing failed. ### `Length(&'static str)` The input has the wrong length. ### `UnknownSuite(u8)` The voice suite is not one this implementation knows. ### `PublicKey` The X-Wing public key is invalid. ### `Mismatch(&'static str)` A signed field does not match what the verifier expects. ### `Unwrap` HPKE failed: the wrapped key was not made for this recipient or was altered. ### `WrappedHash` The wrapped key's hash is not the one the sender signed for this recipient. ### `NotARecipient` The sender-keys message does not name this recipient. ### `Recipients` More recipients than `super::MAX_RECIPIENTS`, or the same one twice. ### `StaleEpoch` An epoch that is not newer than the one in use. ### `Exhausted` The sender has used every epoch or counter of this voice session; rejoin. ### `Header` The SFrame header is malformed or not minimally encoded. ### `UnknownKid` No key for the frame's KID. ### `Replay` The frame's counter was already seen or is older than the replay window. ### `Open` The frame does not authenticate. ### `KidCollision` Two participants' KIDs collide; the newer one rejoins with a new voice session. ### `UnknownPeer` The participant is not known (no verified key package). ### `NoSenderKey` No sender key is active yet. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/error/enum.VoiceError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-encoding-decodeerror/ --- # Enum encoding::DecodeError > The input is not a canonical encoding. `zaun_community_protocol::encoding::DecodeError` · Enum ```rust pub enum DecodeError { … } ``` The input is not a canonical encoding. ## Variants ### `Truncated { needed, remaining }` A fixed field, length or count needs more bytes than remain. ### `TrailingBytes(usize)` Bytes after the top-level object. ### `InvalidBool(u8)` A `bool` byte other than `0x00` or `0x01`. ### `InvalidOptionTag(u8)` An `option` tag other than `0x00` or `0x01`. ### `OverLimit { len, max }` A length or count above the field's limit. ### `InvalidUtf8` A `string` that is not valid UTF-8. ### `UnknownFormat(u8)` An unknown `format` byte. ### `UnknownSuite(u8)` An unknown `suite` byte (`0x00`, `0x02`–`0xFF`). ### `Invalid(&'static str)` A field breaks a rule of its object (the field name). ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/error/enum.DecodeError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-encoding-encodeerror/ --- # Enum encoding::EncodeError > A value cannot be encoded canonically: it would not decode. `zaun_community_protocol::encoding::EncodeError` · Enum ```rust pub enum EncodeError { … } ``` A value cannot be encoded canonically: it would not decode. ## Variants ### `OverLimit { len, max }` A length or count above the field's limit. ### `Invalid(&'static str)` A field breaks a rule of its object (the field name). ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/error/enum.EncodeError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-batcherror/ --- # Enum envelope::BatchError > A batch that breaks the rules of the protocol Indices count from 0 in `body.events`. `zaun_community_protocol::envelope::BatchError` · Enum ```rust pub enum BatchError { … } ``` A batch that breaks the rules of the protocol Indices count from 0 in `body.events`. ## Variants ### `Malformed` Not JSON, not an object, `type` is not `events`, or `body.events` is missing. ### `Element(usize)` An element is not a valid the protocol event envelope. ### `Nested(usize)` An element is itself a batch or a response; batches do not nest. ### `Mismatch(usize)` An element's `community_id` or `v` differs from the batch's. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/events_batch/enum.BatchError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-eventerror/ --- # Enum envelope::EventError > An event envelope that breaks the rules of the protocol `zaun_community_protocol::envelope::EventError` · Enum ```rust pub enum EventError { … } ``` An event envelope that breaks the rules of the protocol ## Variants ### `SequenceMissing` A channel- or member-stream event without `sequence`. ### `SequenceOnLive` A live event with a `sequence`. ### `ChannelIdMissing` A channel-stream event without `channel_id`. ### `IntegerTooLarge` `timestamp` or `sequence` at or above `2^53`. ### `NotAnEvent` `type` is `response`, or `body` is not an object. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/event_envelope/enum.EventError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-idempotencykey/ --- # Enum envelope::IdempotencyKey > The key an idempotency record is stored under. `C` is the host's opaque connection id, used only for unbound connections. `zaun_community_protocol::envelope::IdempotencyKey` · Enum ```rust pub enum IdempotencyKey { … } ``` The key an idempotency record is stored under. `C` is the host's opaque connection id, used only for unbound connections. ## Variants ### `Bound { community_id, member_id, request_id }` A bound connection: `(community_id, member_id, request_id)`. ### `Unbound { connection, request_id }` An unbound connection: `(connection, request_id)`. ## Trait implementations `Clone`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/idempotency/enum.IdempotencyKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-outcome/ --- # Enum envelope::Outcome > The result carried by a response. `zaun_community_protocol::envelope::Outcome` · Enum ```rust pub enum Outcome { … } ``` The result carried by a response. ## Variants ### `Ok(Box)` `"ok": true` with the command's response body. ### `Err(ErrorBody)` `"ok": false` with an error object. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/response/enum.Outcome.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-ratecategory/ --- # Enum envelope::RateCategory > `RATE_LIMITED` category. `zaun_community_protocol::envelope::RateCategory` · Enum ```rust pub enum RateCategory { … } ``` `RATE_LIMITED` category. ## Variants ### `Commands` `commands`. ### `MembershipRequest` `membership_request`. ### `InviteRedeem` `invite_redeem`. ### `Messages` `messages`. ### `Attachments` `attachments`. ### `History` `history`. ### `Sync` `sync`. ### `Reactions` `reactions`. ### `Mentions` `mentions`. ### `Voice` `voice`. ### `CommunityCreate` `community_create`. ### `Reports` `reports`. ### `Dms` `dms`: opening direct messages, and a bot writing into one nobody answered. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/error_enums/enum.RateCategory.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-ratescope/ --- # Enum envelope::RateScope > `RATE_LIMITED` scope. `zaun_community_protocol::envelope::RateScope` · Enum ```rust pub enum RateScope { … } ``` `RATE_LIMITED` scope. ## Variants ### `Connection` `connection`. ### `Member` `member`. ### `Invite` `invite`. ### `Channel` `channel`. ### `Community` `community`. ### `Host` `host`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/error_enums/enum.RateScope.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-reason/ --- # Enum envelope::Reason > `FORBIDDEN` and `CONFLICT` reasons. `zaun_community_protocol::envelope::Reason` · Enum ```rust pub enum Reason { … } ``` `FORBIDDEN` and `CONFLICT` reasons. ## Variants ### `Hierarchy` `FORBIDDEN`: a management-hierarchy check failed. ### `Probation` `FORBIDDEN`: newcomer restrictions (probation, waiting period). ### `Lockdown` `FORBIDDEN`: an emergency lockdown restriction. ### `RequestIdReused` `CONFLICT`: a `request_id` reused with another `type` or body. ### `AlreadyMember` `CONFLICT`: already a member. ### `AlreadyHosted` `CONFLICT`: the community is already hosted. ### `OwnerCannotLeave` `CONFLICT`: the owner cannot leave. ### `StaleRevision` `CONFLICT`: a signed object's revision is stale. ### `AlreadyBound` `CONFLICT`: the connection is already bound. ### `LimitReached` `CONFLICT`: a count limit was reached. ### `InvalidState` `CONFLICT`: the subject is in a state the command does not apply to (suspending a `pending` member, restoring one that is not `suspended`, reviewing a closed report). ### `Ceiling` `FORBIDDEN`: grants beyond the operator's ceiling or the manifest's request. ### `Publisher` `FORBIDDEN`: a bot update signed by another publisher. ### `AlreadyInstalled` `CONFLICT`: the bot's `app_id` is installed already. ### `DmsClosed` `FORBIDDEN`: the member does not take direct messages from bots, or closed this one. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/error_enums/enum.Reason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-replay/ --- # Enum envelope::Replay > What to do with a command whose key matches a stored record. `zaun_community_protocol::envelope::Replay` · Enum ```rust pub enum Replay { … } ``` What to do with a command whose key matches a stored record. ## Variants ### `Resend` Same `type` and body hash: send the stored response again; execute nothing. ### `Conflict` Different `type` or body hash: answer `CONFLICT{reason: "request_id_reused"}` (`ErrorBody::conflict(Reason::RequestIdReused)`). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/idempotency/enum.Replay.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-envelope-stream/ --- # Enum envelope::Stream > An event stream; also the `stream` of `RESYNC_REQUIRED`. `zaun_community_protocol::envelope::Stream` · Enum ```rust pub enum Stream { … } ``` An event stream; also the `stream` of `RESYNC_REQUIRED`. ## Variants ### `Channel` A channel's gapless `channel_seq` stream. ### `Member` The member's gapless `member_seq` stream. ### `Live` Unsequenced live events (signals, `member.removed`, …). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/enum.Stream.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-error_code-errorcode/ --- # Enum error_code::ErrorCode > A response error code. Clients branch on this, never on the message text. `zaun_community_protocol::error_code::ErrorCode` · Enum ```rust pub enum ErrorCode { … } ``` A response error code. Clients branch on this, never on the message text. ## Variants ### `BadRequest` ### `PayloadTooLarge` ### `UnsupportedVersion` ### `UnsupportedCommand` ### `UnsupportedFeature` ### `HelloRequired` ### `NotBound` ### `WrongCommunity` ### `HostNotAuthorized` ### `Forbidden` ### `PendingApproval` ### `Suspended` ### `AdmissionClosed` ### `NotFound` ### `Conflict` ### `InvalidSignature` ### `InviteInvalid` ### `SlowmodeActive` ### `RateLimited` ### `TimedOut` ### `Banned` ### `Busy` ### `ResyncRequired` ### `Internal` ## Methods ### `is_recorded` ```rust pub const fn is_recorded(self) -> bool ``` Whether a response with this code is stored as the idempotency record: every error except the transient ones, which may be retried with the same `request_id`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/error_code/enum.ErrorCode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-ephemeralop/ --- # Enum event::EphemeralOp > `op` of `interaction.message`. `zaun_community_protocol::event::EphemeralOp` · Enum ```rust pub enum EphemeralOp { … } ``` `op` of `interaction.message`. ## Variants ### `Created` A new ephemeral message. ### `Updated` It changed. ### `Deleted` It is gone. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/enum.EphemeralOp.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-event/ --- # Enum event::Event > A decoded event body: one variant per event of the the protocol catalogue. `zaun_community_protocol::event::Event` · Enum ```rust pub enum Event { … } ``` A decoded event body: one variant per event of the the protocol catalogue. ## Variants ### `MessageCreated(MessageCreated)` `message.created` ### `MessageUpdated(MessageUpdated)` `message.updated` ### `MessageDeleted(MessageDeleted)` `message.deleted` ### `MessagesBulkDeleted(MessagesBulkDeleted)` `messages.bulk_deleted` ### `ReactionAdded(ReactionChanged)` `reaction.added` ### `ReactionRemoved(ReactionChanged)` `reaction.removed` ### `CommunityUpdated(CommunityProfile)` `community.updated` ### `DescriptorUpdated(DescriptorUpdated)` `community.descriptor_updated` ### `ChannelCreated(Box)` `channel.created` ### `ChannelUpdated(Box)` `channel.updated` ### `ChannelDeleted(ChannelDeleted)` `channel.deleted` ### `ChannelReordered(ChannelsReordered)` `channel.reordered` ### `RoleCreated(Role)` `role.created` ### `RoleUpdated(Role)` `role.updated` ### `RoleDeleted(RoleDeleted)` `role.deleted` ### `RoleReordered(RolesReordered)` `role.reordered` ### `MemberRolesUpdated(MemberRolesUpdated)` `member.roles_updated` ### `MemberTimedOut(MemberTimedOut)` `member.timed_out` ### `MemberJoined(Member)` `member.joined` ### `MemberLeft(MemberLeft)` `member.left` ### `MemberUpdated(Member)` `member.updated` ### `MemberRemoved(MemberRemoved)` `member.removed` ### `MembershipRequested(Member)` `membership.requested` ### `MembershipUpdated(MembershipUpdated)` `membership.updated` ### `AdmissionPolicyUpdated(PolicyView)` `admission.policy.updated` ### `LockdownUpdated(LockdownView)` `moderation.lockdown.updated` ### `AttachmentUpdated(Attachment)` `attachment.updated` ### `ReportCreated(Box)` `report.created` ### `ReportUpdated(Box)` `report.updated` ### `VoiceJoined(VoiceJoined)` `voice.joined` ### `VoiceLeft(VoiceLeft)` `voice.left` ### `VoiceUpdated(VoiceUpdated)` `voice.updated` ### `VoiceSignal(VoiceSignal)` `voice.signal` ### `VoiceKeys(VoiceKeys)` `voice.keys` ### `SignalTyping(TypingSignal)` `signal.typing` ### `SignalPresence(PresenceSignal)` `signal.presence` ### `BotUpdated(Box)` `bot.updated` ### `BotRemoved(BotRemoved)` `bot.removed` ### `CommandUpdated(CommandsUpdated)` `command.updated` ### `InteractionCreated(Box)` `interaction.created` ### `InteractionMessage(InteractionMessage)` `interaction.message` ### `InteractionModal(InteractionModal)` `interaction.modal` ### `InteractionAutocomplete(InteractionAutocomplete)` `interaction.autocomplete` ### `InteractionFailed(InteractionFailed)` `interaction.failed` ### `DmCreated(Box)` `dm.created` ### `DmClosed(DmClosed)` `dm.closed` ## Methods ### `name` ```rust pub const fn name(&self) -> &'static str ``` The wire name (`type`). ### `streams` ```rust pub const fn streams(&self) -> &'static [Stream] ``` The streams the event travels on, primary first. ### `streams_of` ```rust pub fn streams_of(type_: &str) -> Option<&'static [Stream]> ``` The streams of the event named `type_`, or `None` if unknown. ### `parse` ```rust pub fn parse(type_: &str, body: &str) -> Result ``` Decodes an event body. Unknown types are `Parsed::Unknown`, never an error. # Errors A known event whose body is malformed, or a `messages.bulk_deleted` above 1 000 ids. ### `stream` ```rust pub const fn stream(&self) -> Stream ``` The primary stream: the first of `Event::streams`. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/enum.Event.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-failreason/ --- # Enum event::FailReason > Why an interaction failed. `zaun_community_protocol::event::FailReason` · Enum ```rust pub enum FailReason { … } ``` Why an interaction failed. ## Variants ### `Timeout` No answer within 3 s. ### `BotError` The bot trapped or answered with an error. ### `BotUnavailable` The bot is disabled, crashed or not connected. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/enum.FailReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-parsed/ --- # Enum event::Parsed > The result of decoding an event: known, or an unknown `type` that the client ignores while still advancing the stream's cursor by its `sequence`. Events in reserved namespaces are `zaun_community_protocol::event::Parsed` · Enum ```rust pub enum Parsed { … } ``` The result of decoding an event: known, or an unknown `type` that the client ignores while still advancing the stream's cursor by its `sequence`. Events in reserved namespaces are unknown too. ## Variants ### `Known(Event)` A catalogue event. ### `Unknown` Not in the v1 catalogue: ignore. ## Trait implementations `Clone`, `Debug`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/enum.Parsed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-removalreason/ --- # Enum event::RemovalReason > `reason: {t: "kicked" | "banned" | "left" | "rejected" | "expired"}`. `zaun_community_protocol::event::RemovalReason` · Enum ```rust pub enum RemovalReason { … } ``` `reason: {t: "kicked" | "banned" | "left" | "rejected" | "expired"}`. ## Variants ### `Kicked` `member.kick`. ### `Banned` `member.ban`. ### `Left` `community.leave`. ### `Rejected` `membership.reject`. ### `Expired` Pending request expired. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/enum.RemovalReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-visibilityreason/ --- # Enum event::VisibilityReason > A visibility change. SPEC: a plain string (`"access_gained"`), as written. `zaun_community_protocol::event::VisibilityReason` · Enum ```rust pub enum VisibilityReason { … } ``` A visibility change. SPEC: a plain string (`"access_gained"`), as written. ## Variants ### `AccessGained` The member can now view the channel. ### `AccessLost` The member can no longer view the channel. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/enum.VisibilityReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-event-voiceleftreason/ --- # Enum event::VoiceLeftReason > Why a participant left a voice channel. `zaun_community_protocol::event::VoiceLeftReason` · Enum ```rust pub enum VoiceLeftReason { … } ``` Why a participant left a voice channel. ## Variants ### `Left` `voice.leave`, or a `voice.join` of another channel. ### `Disconnected` The member's connection closed or was replaced. ### `Disconnect` A moderator disconnected the member. ### `Moved` A moderator moved the member: `moved_to` names the channel to join. ### `Access` The member lost access: kicked, banned, suspended, timed out, lockdown, a lost `VIEW_CHANNEL` or `CONNECT`, or the channel was deleted. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/voice/enum.VoiceLeftReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-framing-discardreason/ --- # Enum framing::DiscardReason > Why a reassembly (or a fragment that would start one) was discarded. A discard produces no response; the sender's retry repairs it. `zaun_community_protocol::framing::DiscardReason` · Enum ```rust pub enum DiscardReason { … } ``` Why a reassembly (or a fragment that would start one) was discarded. A discard produces no response; the sender's retry repairs it. ## Variants ### `ConflictingChunk` The same index arrived again with different content. ### `ConflictingCount` The same `frag_id` arrived with a different `count`. ### `TooManyFragments` `count` exceeds `MAX_FRAGMENTS`. ### `TooLarge` The chunks received exceed `max_frame` bytes. ### `InvalidFragment` A hand-built `Fragment` with `count < 2` or `index ≥ count` (`super::classify` never yields one); it is dropped without touching any reassembly. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/reassembly/enum.DiscardReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-framing-encodeerror/ --- # Enum framing::EncodeError > Why an envelope cannot be framed. `zaun_community_protocol::framing::EncodeError` · Enum ```rust pub enum EncodeError { … } ``` Why an envelope cannot be framed. ## Variants ### `TooLarge { len, max }` The envelope JSON exceeds `max_frame`. ### `TooManyFragments { max }` The envelope needs more than `MAX_FRAGMENTS` fragments at this budget. ### `BudgetTooSmall { budget, min }` The budget cannot hold a fragment header plus one character. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/encode/enum.EncodeError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-framing-inbound/ --- # Enum framing::Inbound > What an inbound transport text is. `zaun_community_protocol::framing::Inbound` · Enum ```rust pub enum Inbound<'a> { … } ``` What an inbound transport text is. ## Variants ### `NotProtocol` Does not start with `zaun:`: not a protocol message. Never parse it as a command; count it against the command rate limit; on an unbound connection send one plain notice. ### `UnknownPrefix` Starts with `zaun:` but the frame prefix is unknown (`zaun:2:` …): answer `UNSUPPORTED_VERSION` when possible, otherwise ignore. ### `MalformedFragment` `zaun:1f:` with a malformed header (bad id, leading zeros, `index ≥ count`, …). ### `Whole(&'a str)` A whole envelope: its JSON text, to be parsed as an envelope. ### `Fragment(Fragment<'a>)` A fragment, to be pushed into the connection's reassembler. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/parse/enum.Inbound.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-framing-pushed/ --- # Enum framing::Pushed > The result of pushing one fragment. `zaun_community_protocol::framing::Pushed` · Enum ```rust pub enum Pushed { … } ``` The result of pushing one fragment. ## Variants ### `Complete(String)` The frame is complete: the envelope JSON text, to be parsed as an envelope. ### `Pending` Stored; more fragments are needed. ### `Duplicate` An identical repeat of a stored fragment; ignored. ### `Discarded(DiscardReason)` The fragment's whole reassembly was discarded. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/reassembly/enum.Pushed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-json-patch/ --- # Enum json::Patch > A field that distinguishes "absent" from "null" in update commands (`channel.update` with `"topic": null` clears the topic; no `topic` leaves it). `zaun_community_protocol::json::Patch` · Enum ```rust pub enum Patch { … } ``` A field that distinguishes "absent" from "null" in update commands (`channel.update` with `"topic": null` clears the topic; no `topic` leaves it). Use with `#[serde(default, skip_serializing_if = "Patch::is_keep")]`. ## Variants ### `Keep` The field was absent: keep the current value. ### `Clear` The field was `null`: clear it. ### `Set(T)` The field was present: set it. ## Methods ### `is_keep` ```rust pub const fn is_keep(&self) -> bool ``` Whether the field was absent. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/json/enum.Patch.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-keys-keyencodingerror/ --- # Enum keys::KeyEncodingError > The encoding is not a known suite or has the wrong length. `zaun_community_protocol::keys::KeyEncodingError` · Enum ```rust pub enum KeyEncodingError { … } ``` The encoding is not a known suite or has the wrong length. ## Variants ### `UnknownSuite(u8)` Suite byte `0x00` or `0x02`–`0xFF`. ### `Length(usize)` Wrong total length for the suite. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/enum.KeyEncodingError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-keys-suite/ --- # Enum keys::Suite > A signature suite. `0x00` and `0x02`–`0xFF` are rejected. `zaun_community_protocol::keys::Suite` · Enum ```rust pub enum Suite { … } ``` A signature suite. `0x00` and `0x02`–`0xFF` are rejected. ## Variants ### `MlDsa65Ed25519` RFC 10073 `id-MLDSA65-Ed25519-SHA512` (OID 1.3.6.1.5.5.7.6.48). ## Methods ### `from_byte` ```rust pub const fn from_byte(byte: u8) -> Option ``` Parses a suite byte. ### `byte` ```rust pub const fn byte(self) -> u8 ``` The suite byte. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/enum.Suite.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-model-channelkind/ --- # Enum model::ChannelKind > The kind of a channel (permissions the protocol, the protocol). `zaun_community_protocol::model::ChannelKind` · Enum ```rust pub enum ChannelKind { … } ``` The kind of a channel (permissions the protocol, the protocol). ## Variants ### `Category` Groups channels; its overrides apply to synced children. ### `Text` Text chat. ### `Announcement` Text chat where `@everyone` cannot post by default. ### `Forum` Reserved: forum posts (future). ### `Voice` Reserved: voice (future); has text chat. ### `Stage` Reserved: stage (future); has text chat. ### `Dm` A direct-message channel between one bot and one member; only its two participants can see it, whatever their roles. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/model/enum.ChannelKind.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-model-distributionmode/ --- # Enum model::DistributionMode > How accepted channel-stream events travel (ADR-0009, the protocol, Appendix A). `zaun_community_protocol::model::DistributionMode` · Enum ```rust pub enum DistributionMode { … } ``` How accepted channel-stream events travel (ADR-0009, the protocol, Appendix A). ## Variants ### `DirectSimplex` One SimpleX message per recipient over each member's control connection (v1). ### `NativePublicChannel` A native SimpleX public channel via chat relays. Experimental (ADR-0010). ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/model/enum.DistributionMode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-model-historyaccess/ --- # Enum model::HistoryAccess > How much channel history a member may read (ADR-0014, the protocol). Stamped on each message at send time. `zaun_community_protocol::model::HistoryAccess` · Enum ```rust pub enum HistoryAccess { … } ``` How much channel history a member may read (ADR-0014, the protocol). Stamped on each message at send time. ## Variants ### `None` Only messages sent while the member can see the channel live. ### `SinceJoined` Messages sent after the member gained access. ### `LastN(u32)` The last `n` messages before the member gained access (1 ≤ n ≤ 10 000), then live. ### `Full` Everything. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/model/enum.HistoryAccess.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-model-membershipstate/ --- # Enum model::MembershipState > A member's lifecycle state. Independent of roles. `zaun_community_protocol::model::MembershipState` · Enum ```rust pub enum MembershipState { … } ``` A member's lifecycle state. Independent of roles. ## Variants ### `Pending` Awaiting approval; may only read the community summary and leave. ### `Probation` Admitted with the admission policy's newcomer restrictions. ### `Active` A full member. ### `Suspended` Temporarily removed from participation; keeps the binding. ### `Banned` Banned; the binding is revoked. ### `Left` Left or kicked. ## Methods ### `is_bound` ```rust pub const fn is_bound(self) -> bool ``` Whether the member holds a live binding (may issue at least some commands). ### `is_admitted` ```rust pub const fn is_admitted(self) -> bool ``` Whether the member counts as admitted (receives channel events if permitted). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/model/enum.MembershipState.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-model-typingmode/ --- # Enum model::TypingMode > Who sees that someone is typing in a channel (`typing`, the protocol). A plain JSON string, as the specification writes it. `zaun_community_protocol::model::TypingMode` · Enum ```rust pub enum TypingMode { … } ``` Who sees that someone is typing in a channel (`typing`, the protocol). A plain JSON string, as the specification writes it. ## Variants ### `Named` `signal.typing` names the members typing (the default). ### `Anonymous` `signal.typing` carries only how many are typing (1, 2, or 3 for "several"), never who. ### `Off` The host drops typing signals in the channel; clients do not send them. ## Methods ### `is_named` ```rust pub const fn is_named(&self) -> bool ``` Whether this is the default, `TypingMode::Named`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/model/enum.TypingMode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-access/ --- # Enum permissions::Access > Who may send the command at all, before any bit is checked. `zaun_community_protocol::permissions::Access` · Enum ```rust pub enum Access { … } ``` Who may send the command at all, before any bit is checked. ## Variants ### `Any` Any connection, bound (in any state the gate lets through) or not: `session.hello`, `community.rotations`. ### `Unbound` An unbound connection only. ### `Bound` Any bound state the gate lets through, `Pending` and `Suspended` included. ### `Member` A `Probation` or `Active` member. ### `Owner` The owner only; no bit substitutes. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/requirement/enum.Access.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-conflictreason/ --- # Enum permissions::ConflictReason > Why a state transition does not apply (`CONFLICT`). `zaun_community_protocol::permissions::ConflictReason` · Enum ```rust pub enum ConflictReason { … } ``` Why a state transition does not apply (`CONFLICT`). ## Variants ### `AlreadyMember` The target is already an admitted member (`already_member`). ### `WrongState` The target is in another state the command does not apply to (`invalid_state`). ## Methods ### `wire` ```rust pub const fn wire(self) -> Option<&'static str> ``` The `reason` string of a `CONFLICT` body: `already_member` or `invalid_state`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/denial/enum.ConflictReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-denialreason/ --- # Enum permissions::DenialReason > Why a permission check failed, when a specific rule caused it (permissions the protocol). `zaun_community_protocol::permissions::DenialReason` · Enum ```rust pub enum DenialReason { … } ``` Why a permission check failed, when a specific rule caused it (permissions the protocol). ## Variants ### `Hierarchy` H1, H2 or H4 (the management hierarchy). ### `Probation` Step 7b: probation newcomer mask or the waiting period. ### `Lockdown` Step 7c: an active emergency lockdown. ### `ChannelLocked` Step 7d: the channel `locked` flag. ### `Timeout` Step 7a: the member is timed out. ## Methods ### `wire` ```rust pub const fn wire(self) -> Option<&'static str> ``` The `reason` string of a `FORBIDDEN` body, if any. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/denial/enum.DenialReason.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-gatedenial/ --- # Enum permissions::GateDenial > Why the gate refused a command. `zaun_community_protocol::permissions::GateDenial` · Enum ```rust pub enum GateDenial { … } ``` Why the gate refused a command. ## Variants ### `NotBound` `NOT_BOUND`: no binding (unbound connection, or a member that left). ### `AlreadyBound` `CONFLICT`: an unbound-only command on a bound connection. ### `PendingApproval` `PENDING_APPROVAL`. ### `Suspended` `SUSPENDED`. ### `Banned` `BANNED`. ## Methods ### `conflict_reason` ```rust pub const fn conflict_reason(self) -> Option<&'static str> ``` The `reason` of the `CONFLICT` body, for `GateDenial::AlreadyBound`. ### `error_code` ```rust pub const fn error_code(self) -> ErrorCode ``` The response code. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/enum.GateDenial.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-invalid/ --- # Enum permissions::Invalid > A malformed request (`BAD_REQUEST`). `zaun_community_protocol::permissions::Invalid` · Enum ```rust pub enum Invalid { … } ``` A malformed request (`BAD_REQUEST`). ## Variants ### `AllowDenyOverlap` An override has a bit in both `allow` and `deny`. ### `NotChannelScoped` An override holds a known bit that is not channel-scoped. ### `SetsUnknownBits` The command sets an unknown bit that was not already present. ### `NewcomerMaskHidesChannels` `newcomer_restrictions` contains `VIEW_CHANNEL` or `READ_MESSAGE_HISTORY`. ### `Everyone` `@everyone` was listed where it may not be (reorder, delete, assign). ### `DuplicateRole` A role appears twice in one request. ### `BadPosition` The resulting role positions are not unique, or a position is 0. ### `PreApprovedWithApproval` `pre_approved` together with `requires_approval`. ### `LooserAdmission` Invitation admission overrides are not stricter than the policy. ### `Duration` A duration is outside its bounds (timeout, lockdown). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `From`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/denial/enum.Invalid.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-invites-invitecreation/ --- # Enum permissions::invites::InviteCreation > The admission policy's `invite_creation` rule. `zaun_community_protocol::permissions::invites::InviteCreation` · Enum ```rust pub enum InviteCreation { … } ``` The admission policy's `invite_creation` rule. ## Variants ### `Permission` Anyone with `CREATE_INVITE`, `Probation` members included. ### `Active` `Active` members with `CREATE_INVITE`. ### `Moderators` Only members with `MANAGE_INVITES` (and `CREATE_INVITE`). ## Methods ### `from_wire` ```rust pub fn from_wire(tag: &str) -> Option ``` Parses the wire tag. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/invites/enum.InviteCreation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-overrides-overridesubject/ --- # Enum permissions::overrides::OverrideSubject > The target of an override as the hierarchy sees it. `zaun_community_protocol::permissions::overrides::OverrideSubject` · Enum ```rust pub enum OverrideSubject { … } ``` The target of an override as the hierarchy sees it. ## Variants ### `Role(u32)` A role at this position (`@everyone` is 0). ### `Member(Party)` A member. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/overrides/enum.OverrideSubject.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-overrides-overridewrite/ --- # Enum permissions::overrides::OverrideWrite > What the host does with a validated override. `zaun_community_protocol::permissions::overrides::OverrideWrite` · Enum ```rust pub enum OverrideWrite { … } ``` What the host does with a validated override. ## Variants ### `Store` Store the override. ### `Delete` `allow == 0 && deny == 0`: delete the override (tri-state `Inherit`). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/overrides/enum.OverrideWrite.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-overridetarget/ --- # Enum permissions::OverrideTarget > Whom an override applies to (permissions the protocol). `zaun_community_protocol::permissions::OverrideTarget` · Enum ```rust pub enum OverrideTarget { … } ``` Whom an override applies to (permissions the protocol). ## Variants ### `Role(RoleId)` Every holder of the role (`@everyone` included). ### `Member(MemberId)` One member. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/input/enum.OverrideTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-refusal/ --- # Enum permissions::Refusal > Every way a pure check can refuse a command. `zaun_community_protocol::permissions::Refusal` · Enum ```rust pub enum Refusal { … } ``` Every way a pure check can refuse a command. ## Variants ### `Forbidden(Denial)` `FORBIDDEN`, or `TIMED_OUT` (see `Denial::error_code`). ### `BadRequest(Invalid)` `BAD_REQUEST`. ### `Conflict(ConflictReason)` `CONFLICT`. ### `NotFound` `NOT_FOUND` (a listed role does not exist). ## Methods ### `error_code` ```rust pub const fn error_code(&self) -> ErrorCode ``` The response code. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `From`, `From`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/denial/enum.Refusal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-scope/ --- # Enum permissions::Scope > Where the required bits are evaluated. `zaun_community_protocol::permissions::Scope` · Enum ```rust pub enum Scope { … } ``` Where the required bits are evaluated. ## Variants ### `Community` `cp(A)`. ### `Channel` `chp(A, ch)` for the command's channel (for `channel.reorder`: each moved channel). ### `ChannelIfGiven` `chp` when the command names a channel, else `cp`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/requirement/enum.Scope.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-permissions-top/ --- # Enum permissions::Top > A member's top position. The owner is above every role. `zaun_community_protocol::permissions::Top` · Enum ```rust pub enum Top { … } ``` A member's top position. The owner is above every role. ## Variants ### `Position(u32)` The highest position among the member's roles; 0 with none. ### `Owner` The owner: +∞. ## Methods ### `of` ```rust pub fn of(is_owner: bool, roles: &[Role]) -> Self ``` `top(m)`: +∞ for the owner, else the highest role position (0 with no role). ### `above` ```rust pub const fn above(self, position: u32) -> bool ``` Whether a role at `position` is strictly below this top (H4's comparison). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/enum.Top.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-admissionmode/ --- # Enum signed::AdmissionMode > `AdmissionSummary.mode`. `zaun_community_protocol::signed::AdmissionMode` · Enum ```rust pub enum AdmissionMode { … } ``` `AdmissionSummary.mode`. ## Variants ### `InvitationOnly` `0x00`: invitation only. ### `ApprovalRequired` `0x01`: approval required. ### `Open` `0x02`: open. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Encode`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/descriptor/parts/enum.AdmissionMode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-discovery/ --- # Enum signed::Discovery > `discovery` (field 17). `zaun_community_protocol::signed::Discovery` · Enum ```rust pub enum Discovery { … } ``` `discovery` (field 17). ## Variants ### `Private` `0x00`: invitation only. ### `Unlisted` `0x01`: reachable by link. ### `Listed` `0x02`: may be submitted to directories. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Encode`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/descriptor/parts/enum.Discovery.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-packageerror/ --- # Enum signed::PackageError > A `.zbot` file that does not verify. `zaun_community_protocol::signed::PackageError` · Enum ```rust pub enum PackageError { … } ``` A `.zbot` file that does not verify. ## Variants ### `Malformed(DecodeError)` Not a package file: wrong magic or container version, a part over its limit, truncated or with trailing bytes, or a header that is not a canonical `BotPackage`. ### `Signature(SignedError)` The publisher signature does not verify (or is not a signature encoding). ### `Unsigned` The package is unsigned and the host does not accept unsigned packages. ### `ManifestHash` The manifest is not the one the header names. ### `ComponentHash` The component is not the one the header names. ### `Manifest` The manifest is not JSON with `app_id` and `version` equal to the header's. ## Trait implementations `Clone`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/enum.PackageError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-purpose/ --- # Enum signed::Purpose > Why a member key is registered (field 2). Other values are reserved and rejected. `zaun_community_protocol::signed::Purpose` · Enum ```rust pub enum Purpose { … } ``` Why a member key is registered (field 2). Other values are reserved and rejected. ## Variants ### `CreateCommunity` `0x01`: `community.create`. ### `JoinByInvitation` `0x02`: `invite.redeem`. ### `MembershipRequest` `0x03`: `membership.request`. ## Methods ### `from_byte` ```rust pub const fn from_byte(byte: u8) -> Option ``` Parses the purpose byte. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/member_key/enum.Purpose.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-registrationerror/ --- # Enum signed::RegistrationError > A `MemberKeyRegistration` is not acceptable to the host. `zaun_community_protocol::signed::RegistrationError` · Enum ```rust pub enum RegistrationError { … } ``` A `MemberKeyRegistration` is not acceptable to the host. ## Variants ### `Signed(SignedError)` The registration does not verify under the command's member key, or does not decode. ### `MemberKey` `member_public_key` differs from the command's key. ### `Purpose` The purpose differs from the command's. ### `Community` `community_id` differs from the command's. ### `Host` `host_id` is not this host. ### `Challenge` `host_challenge` is not the connection's current challenge. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/error/enum.RegistrationError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-rotationerror/ --- # Enum signed::RotationError > The rotation chain does not verify. `index` is 1-based. `zaun_community_protocol::signed::RotationError` · Enum ```rust pub enum RotationError { … } ``` The rotation chain does not verify. `index` is 1-based. ## Variants ### `Genesis` The genesis key does not derive the community id. ### `Signed { index, error }` A rotation's encoding or one of its signatures is invalid. ### `Community(u64)` A rotation names another community. ### `Sequence(u64)` `rotation_seq` is not the rotation's position. ### `OldRoot(u64)` `old_root` is not the previous key of the chain. ### `SuiteDowngrade(u64)` `new_suite` is below the previous suite. ### `TooLong` More rotations than `rotation_seq` can number. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/error/enum.RotationError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-sessionprooferror/ --- # Enum signed::SessionProofError > A `HostSessionProof` is not acceptable to the client. `zaun_community_protocol::signed::SessionProofError` · Enum ```rust pub enum SessionProofError { … } ``` A `HostSessionProof` is not acceptable to the client. ## Variants ### `Signed(SignedError)` The proof does not verify under the host key, or does not decode. ### `HostId` `host_id` does not derive from the host key. ### `Nonce` `client_nonce` is not the client's fresh nonce. ### `EpochPresence` `community_id` and `delegation_epoch` are not both some or both none. ### `MissingPair` A community is named but no valid pair was presented. ### `PairMismatch` The valid pair is for another community, host or epoch. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/error/enum.SessionProofError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-signederror/ --- # Enum signed::SignedError > Signing, verifying, encoding or decoding one signed object failed. `zaun_community_protocol::signed::SignedError` · Enum ```rust pub enum SignedError { … } ``` Signing, verifying, encoding or decoding one signed object failed. ## Variants ### `Encode(EncodeError)` The object breaks a field rule or limit and cannot be encoded. ### `Decode(DecodeError)` The verified bytes are not a canonical encoding of the expected type. ### `Signature(VerifyError)` The signature does not verify (checked before decoding). ### `SignatureEncoding(KeyEncodingError)` The signature bytes are not a valid `Signature` encoding. ### `Sign(SignError)` Signing failed. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `From`, `From`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/error/enum.SignedError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-validityerror/ --- # Enum signed::ValidityError > A (descriptor, delegation) pair is not valid. `zaun_community_protocol::signed::ValidityError` · Enum ```rust pub enum ValidityError { … } ``` A (descriptor, delegation) pair is not valid. ## Variants ### `Chain(RotationError)` Rule 1: the rotation chain does not verify. ### `Descriptor(SignedError)` Rule 1: the descriptor does not verify or decode. ### `Community` Rule 1: `community_id` is not the expected community. ### `RootKey` Rule 1: `root_public_key` is not the chain's last key. ### `EmbeddedRotation` Rule 1: the descriptor's latest rotation is not the chain's last rotation. ### `SuiteBelowMinimum` the protocol: the root key's suite is below the descriptor's `min_suite`. ### `NoDelegation` Rule 2: the descriptor authorises no host (suspended). ### `DelegationHash` Rule 2: `SHA3-256(delegation.bytes)` differs from `delegation_hash`. ### `Delegation(SignedError)` Rule 3: the delegation does not verify or decode. ### `DelegationEpoch` Rule 2: the delegation epoch differs from the reference. ### `DelegationCommunity` Rule 3: the delegation names another community. ### `NotYetValid` Rule 4: `now < not_before − 5 min`. ### `Expired` Rule 4: `now > expires_at + 5 min`. ### `RevisionRollback` Rule 5: a lower descriptor revision than accepted. ### `RevisionConflict` Rule 5: an equal revision with different bytes. ### `EpochRollback` Rule 5: a lower delegation epoch than accepted. ### `EpochConflict` Rule 5: an equal epoch with another `delegation_hash`. ### `ChainRollback` Rule 5: a shorter rotation chain than accepted. ### `RootKeyFork` Rule 5 (extended): the chain does not pass through the accepted root key. ### `MinSuiteRollback` Rule 5: a lower `min_suite` than accepted. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/error/enum.ValidityError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/enum-signed-verificationlevel/ --- # Enum signed::VerificationLevel > `AdmissionSummary.level`: verification level None … Highest (`governance.md`). `zaun_community_protocol::signed::VerificationLevel` · Enum ```rust pub enum VerificationLevel { … } ``` `AdmissionSummary.level`: verification level None … Highest (`governance.md`). ## Variants ### `None` `0x00`. ### `Low` `0x01`. ### `Medium` `0x02`. ### `High` `0x03`. ### `Highest` `0x04`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Encode`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/descriptor/parts/enum.VerificationLevel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-b64-bytes-deserialize/ --- # Function b64::bytes::deserialize > Deserializes strict base64url. `zaun_community_protocol::b64::bytes::deserialize` · Function ```rust pub fn deserialize<'de, D>(d: D) -> Result, ::Error> ``` Deserializes strict base64url. # Errors A non-canonical encoding. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/bytes/fn.deserialize.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-b64-bytes-serialize/ --- # Function b64::bytes::serialize > Serializes as base64url. `zaun_community_protocol::b64::bytes::serialize` · Function ```rust pub fn serialize(value: &[u8], s: S) -> Result<::Ok, ::Error> ``` Serializes as base64url. # Errors Never fails beyond the serializer's own errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/bytes/fn.serialize.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-b64-decode/ --- # Function b64::decode > Decodes canonical base64url without padding. `zaun_community_protocol::b64::decode` · Function ```rust pub fn decode(text: &str) -> Result, B64Error> ``` Decodes canonical base64url without padding. # Errors `B64Error` for padding, a foreign character or non-zero trailing bits. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/fn.decode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-b64-decode_array/ --- # Function b64::decode_array > Decodes exactly `N` bytes. `zaun_community_protocol::b64::decode_array` · Function ```rust pub fn decode_array(text: &str) -> Result<[u8; N], B64Error> ``` Decodes exactly `N` bytes. # Errors `B64Error` when the text is not canonical or decodes to another length. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/fn.decode_array.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-b64-encode/ --- # Function b64::encode > Encodes `bytes` as base64url without padding. `zaun_community_protocol::b64::encode` · Function ```rust pub fn encode(bytes: &[u8]) -> String ``` Encodes `bytes` as base64url without padding. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/fn.encode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-b64-encoded_len/ --- # Function b64::encoded_len > The length of the unpadded encoding of `n` bytes. `zaun_community_protocol::b64::encoded_len` · Function ```rust pub const fn encoded_len(n: usize) -> usize ``` The length of the unpadded encoding of `n` bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/fn.encoded_len.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-decode_response/ --- # Function client::decode_response > Decodes a successful response body as the response type of command `B`. `zaun_community_protocol::client::decode_response` · Function ```rust pub fn decode_response(body: &RawValue) -> Result<::Response> ``` Decodes a successful response body as the response type of command `B`. ```rust let sent = decode_response::(&raw)?; // message::Sent ``` # Errors The body does not match `B::Response`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/decode/fn.decode_response.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-member-generate_member_key/ --- # Function client::member::generate_member_key > Generates a fresh member key. Use one per community. `zaun_community_protocol::client::member::generate_member_key` · Function ```rust pub fn generate_member_key() -> Result ``` Generates a fresh member key. Use one per community. # Errors `RngError` when the OS CSPRNG fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/fn.generate_member_key.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-member-moved/ --- # Function client::member::moved > Checks a `community.descriptor_updated` event against the client's stored state and says whether the community moved to another host. `chain` is the rotation chain the client holds `zaun_community_protocol::client::member::moved` · Function ```rust pub fn moved(community_id: &CommunityId, event: &DescriptorUpdated, chain: &[SignedRootRotation], accepted: &AcceptedState, current_host: HostId, now_ms: u64) -> Result, ValidityError> ``` Checks a `community.descriptor_updated` event against the client's stored state and says whether the community moved to another host. `chain` is the rotation chain the client holds; a rotation embedded in the new descriptor extends it, as at the host. `Ok(None)`: valid, and still delegated to `current_host` (a descriptor edit). # Errors `ValidityError` for a pair that is not valid, or older than `accepted`. A descriptor without a delegation (suspension) is `ValidityError::NoDelegation`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/moved/fn.moved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-member-reauth_body/ --- # Function client::member::reauth_body > The `migration.reauth` body: a `MemberReauth` signed with the member's existing key. Send it with `target.community_id` as the envelope `community_id`. `zaun_community_protocol::client::member::reauth_body` · Function ```rust pub fn reauth_body(member: &SecretKey, target: ReauthTarget, now_ms: u64) -> Result ``` The `migration.reauth` body: a `MemberReauth` signed with the member's existing key. Send it with `target.community_id` as the envelope `community_id`. # Errors Signing errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/moved/fn.reauth_body.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-member-redeem_body/ --- # Function client::member::redeem_body > The `invite.redeem` body: the link's secret, the member key and its registration (purpose 2) for the link's community and host. Send it with the link's community as the envelope `c `zaun_community_protocol::client::member::redeem_body` · Function ```rust pub fn redeem_body>(invite: &InvitePayload, member: &SecretKey, host_challenge: Challenge, display_name: impl Into, now_ms: u64) -> Result ``` The `invite.redeem` body: the link's secret, the member key and its registration (purpose 2) for the link's community and host. Send it with the link's community as the envelope `community_id`. # Errors Signing or body errors (display name length). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/fn.redeem_body.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-member-registration/ --- # Function client::member::registration > Signs a `MemberKeyRegistration` with the member key itself. `zaun_community_protocol::client::member::registration` · Function ```rust pub fn registration(member: &SecretKey, purpose: Purpose, target: RegistrationTarget, now_ms: u64) -> Result, BuildError> ``` Signs a `MemberKeyRegistration` with the member key itself. # Errors Signing errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/fn.registration.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-member-request_body/ --- # Function client::member::request_body > The `membership.request` body with a purpose-3 registration. Send it with `target.community_id` as the envelope `community_id`. `zaun_community_protocol::client::member::request_body` · Function ```rust pub fn request_body>(target: RegistrationTarget, member: &SecretKey, display_name: impl Into, note: Option, now_ms: u64) -> Result ``` The `membership.request` body with a purpose-3 registration. Send it with `target.community_id` as the envelope `community_id`. # Errors Signing or body errors (display name, note length). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/fn.request_body.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-create_body/ --- # Function client::owner::create_body > The `community.create` body: the genesis pair, the owner's member key and its registration (purpose 1) for the host's current `host_challenge` (from the welcome). `zaun_community_protocol::client::owner::create_body` · Function ```rust pub fn create_body>(genesis: &Genesis, member: &SecretKey, host_challenge: Challenge, display_name: impl Into, now_ms: u64) -> Result ``` The `community.create` body: the genesis pair, the owner's member key and its registration (purpose 1) for the host's current `host_challenge` (from the welcome). # Errors `BuildError::OwnerKey` when `member` is not the owner binding; signing or body errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/genesis/fn.create_body.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-delegate/ --- # Function client::owner::delegate > Signs a delegation of every v1 scope to `host`, valid from `now_ms`. `zaun_community_protocol::client::owner::delegate` · Function ```rust pub fn delegate(root: &SecretKey, community_id: CommunityId, host: &HostInfo, epoch: u64, expires_at: Option, now_ms: u64) -> Result, BuildError> ``` Signs a delegation of every v1 scope to `host`, valid from `now_ms`. # Errors `BuildError::Signed` for a field rule (addresses) or a signing failure. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/genesis/fn.delegate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-generate_root_key/ --- # Function client::owner::generate_root_key > Generates a fresh root key: the community's identity. Store it sealed; it cannot be recovered (ADR-0011). `zaun_community_protocol::client::owner::generate_root_key` · Function ```rust pub fn generate_root_key() -> Result ``` Generates a fresh root key: the community's identity. Store it sealed; it cannot be recovered (ADR-0011). # Errors `RngError` when the OS CSPRNG fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/fn.generate_root_key.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-genesis/ --- # Function client::owner::genesis > Builds and signs the genesis pair: delegation epoch 1 to `host` (no expiry, ADR-0005), descriptor revision 1 naming it, with `owner_member_key` as the owner binding. `zaun_community_protocol::client::owner::genesis` · Function ```rust pub fn genesis(root: &SecretKey, owner_member_key: &PublicKey, content: DescriptorContent, host: &HostInfo, now_ms: u64) -> Result ``` Builds and signs the genesis pair: delegation epoch 1 to `host` (no expiry, ADR-0005), descriptor revision 1 naming it, with `owner_member_key` as the owner binding. # Errors `BuildError::Signed` for a field rule or a signing failure. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/genesis/fn.genesis.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-next_revision/ --- # Function client::owner::next_revision > A copy of `current` with the next revision and `issued_at = now_ms`, for the owner to edit and pass to `publish_body`. `zaun_community_protocol::client::owner::next_revision` · Function ```rust pub fn next_revision(current: &CommunityDescriptor, now_ms: u64) -> CommunityDescriptor ``` A copy of `current` with the next revision and `issued_at = now_ms`, for the owner to edit and pass to `publish_body`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/revise/fn.next_revision.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-publish_body/ --- # Function client::owner::publish_body > Signs `descriptor` with `root` (its current root key) and builds the `community.descriptor.publish` body. A given `delegation` is referenced by the descriptor (epoch and hash) and `zaun_community_protocol::client::owner::publish_body` · Function ```rust pub fn publish_body(descriptor: CommunityDescriptor, root: &SecretKey, delegation: Option<&Signed>, icon: Option>) -> Result<(Signed, DescriptorPublish), BuildError> ``` Signs `descriptor` with `root` (its current root key) and builds the `community.descriptor.publish` body. A given `delegation` is referenced by the descriptor (epoch and hash) and sent; a given `icon` sets the descriptor's icon hash and is sent. # Errors `BuildError::WrongRootKey`, field rule, signing or body (icon size) errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/revise/fn.publish_body.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-resign_delegation/ --- # Function client::owner::resign_delegation > Re-signs an existing delegation under a new root key. The bytes, hence the `delegation_hash` and epoch, are unchanged. `zaun_community_protocol::client::owner::resign_delegation` · Function ```rust pub fn resign_delegation(new_root: &SecretKey, delegation: &HostDelegation) -> Result, BuildError> ``` Re-signs an existing delegation under a new root key. The bytes, hence the `delegation_hash` and epoch, are unchanged. # Errors Signing errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/revise/fn.resign_delegation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-rotate_root/ --- # Function client::owner::rotate_root > Signs the rotation from the current root `old` to `new`: `rotation_seq` follows the descriptor's latest rotation, and both keys sign. `zaun_community_protocol::client::owner::rotate_root` · Function ```rust pub fn rotate_root(current: &CommunityDescriptor, old: &SecretKey, new: &SecretKey, now_ms: u64) -> Result ``` Signs the rotation from the current root `old` to `new`: `rotation_seq` follows the descriptor's latest rotation, and both keys sign. # Errors `BuildError::WrongRootKey` when `old` is not `current.root_public_key`; signing errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/revise/fn.rotate_root.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-client-owner-rotated_revision/ --- # Function client::owner::rotated_revision > The next revision after `rotation`: the new root key and `rotations = rotation`. Sign it with the **new** key via `publish_body`, together with resign_delegation: the delegation is `zaun_community_protocol::client::owner::rotated_revision` · Function ```rust pub fn rotated_revision(current: &CommunityDescriptor, rotation: SignedRootRotation, new_root: &PublicKey, now_ms: u64) -> CommunityDescriptor ``` The next revision after `rotation`: the new root key and `rotations = [rotation]`. Sign it with the **new** key via `publish_body`, together with [`resign_delegation`]: the delegation is verified under the current root. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/revise/fn.rotated_revision.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-attachment-caption/ --- # Function command::attachment::caption > The caption of the SimpleX file that carries attachment `id`, either way. `zaun_community_protocol::command::attachment::caption` · Function ```rust pub fn caption(id: AttachmentId) -> String ``` The caption of the SimpleX file that carries attachment `id`, either way. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/attachment/fn.caption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-attachment-parse_caption/ --- # Function command::attachment::parse_caption > The attachment a caption names, when it is a Zaun caption. `zaun_community_protocol::command::attachment::parse_caption` · Function ```rust pub fn parse_caption(text: &str) -> Option ``` The attachment a caption names, when it is a Zaun caption. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/attachment/fn.parse_caption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-bot-chosen/ --- # Function command::bot::chosen > Full grants from a choice and the manifest's request. `zaun_community_protocol::command::bot::chosen` · Function ```rust pub fn chosen(choice: Option<&GrantChoice>, request: &Grants) -> Grants ``` Full grants from a choice and the manifest's request. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/fn.chosen.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-classify/ --- # Function command::classify > Classifies a command `type`. Exact, case-sensitive matching. `zaun_community_protocol::command::classify` · Function ```rust pub fn classify(type_: &str) -> TypeClass ``` Classifies a command `type`. Exact, case-sensitive matching. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/reserved/fn.classify.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-max_envelope/ --- # Function command::max_envelope > The largest command envelope for `type_` in bytes: `max_frame` for `community.create` and `community.descriptor.publish`, else 65 536. `zaun_community_protocol::command::max_envelope` · Function ```rust pub fn max_envelope(type_: &str) -> usize ``` The largest command envelope for `type_` in bytes: `max_frame` for `community.create` and `community.descriptor.publish`, else 65 536. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/reserved/fn.max_envelope.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-allowed/ --- # Function command::object::bot_events::allowed > Whether the capabilities allow events of `kind`: member events need `members`, presence needs `presence`, DM events need `dms`; everything else is visible to any member anyway. `zaun_community_protocol::command::object::bot_events::allowed` · Function ```rust pub fn allowed(caps: &Capabilities, kind: &str) -> bool ``` Whether the capabilities allow events of `kind`: member events need `members`, presence needs `presence`, DM events need `dms`; everything else is visible to any member anyway. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/events/fn.allowed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-group_of/ --- # Function command::object::bot_events::group_of > The group an event type belongs to, if any. `zaun_community_protocol::command::object::bot_events::group_of` · Function ```rust pub fn group_of(kind: &str) -> Option<&'static str> ``` The group an event type belongs to, if any. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/events/fn.group_of.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-known/ --- # Function command::object::bot_events::known > Whether `name` is something a manifest's `events` may list. `zaun_community_protocol::command::object::bot_events::known` · Function ```rust pub fn known(name: &str) -> bool ``` Whether `name` is something a manifest's `events` may list. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/events/fn.known.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-bot_events-wants/ --- # Function command::object::bot_events::wants > Whether a bot subscribed to `events` (and holding `caps`) gets events of `kind`. `zaun_community_protocol::command::object::bot_events::wants` · Function ```rust pub fn wants(events: &[String], caps: &Capabilities, kind: &str) -> bool ``` Whether a bot subscribed to `events` (and holding `caps`) gets events of `kind`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/events/fn.wants.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-check_commands/ --- # Function command::object::check_commands > Every command's rules, the per-type counts and unique names; at most 8 000 scalars of text per command. `zaun_community_protocol::command::object::check_commands` · Function ```rust pub fn check_commands(commands: &[ApplicationCommand]) -> Result<(), BodyError> ``` Every command's rules, the per-type counts and unique names; at most 8 000 scalars of text per command. # Errors The first violated rule. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/check/fn.check_commands.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-check_embeds/ --- # Function command::object::check_embeds > The state-free rules of a message's embeds: at most 10, each valid and showing something, at most 6 000 scalars of text in all. With `attachments`, every picture an embed shows mus `zaun_community_protocol::command::object::check_embeds` · Function ```rust pub fn check_embeds(embeds: &[Embed], attachments: Option<&[AttachmentId]>) -> Result<(), BodyError> ``` The state-free rules of a message's embeds: 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`). # Errors `PAYLOAD_TOO_LARGE` for a text, link or list over its limit (`embeds` with limit 6 000 for the total text); `BAD_REQUEST` for any other broken rule. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/fn.check_embeds.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-check_message_components/ --- # Function command::object::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 `id`s and `custom_id`s. `zaun_community_protocol::command::object::check_message_components` · Function ```rust pub fn check_message_components(components: &[Component], v2: bool) -> Result<(), BodyError> ``` 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 `id`s and `custom_id`s. # Errors `BAD_REQUEST` naming the field, or `PAYLOAD_TOO_LARGE` for a count or text over its limit. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/check/fn.check_message_components.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-check_modal/ --- # Function command::object::check_modal > A modal (`MODAL` response): `custom_id`, `title` 1–45 and 1–5 labels or text displays. `zaun_community_protocol::command::object::check_modal` · Function ```rust pub fn check_modal(custom_id: &str, title: &str, components: &[Component]) -> Result<(), BodyError> ``` A modal (`MODAL` response): `custom_id`, `title` 1–45 and 1–5 labels or text displays. # Errors As `check_message_components`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/check/fn.check_modal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-check_pictures/ --- # Function command::object::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 `zaun_community_protocol::command::object::check_pictures` · Function ```rust pub fn check_pictures(embeds: &[Embed], attachments: &[AttachmentId]) -> Result<(), BodyError> ``` 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. # Errors `BAD_REQUEST` naming the field of the first picture that is not. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/fn.check_pictures.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-component_attachments/ --- # Function command::object::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. `zaun_community_protocol::command::object::component_attachments` · Function ```rust pub fn component_attachments(components: &[Component]) -> Vec<(&'static str, AttachmentId)> ``` Every attachment the components show (thumbnails, gallery pictures, files), with the field naming it; each must be an attachment of the same message. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/check/fn.component_attachments.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-config_key_ok/ --- # Function command::object::config_key_ok > A `config` key: `a-za-z0-9_{0,63}`. `zaun_community_protocol::command::object::config_key_ok` · Function ```rust pub fn config_key_ok(key: &str) -> bool ``` A `config` key: `[a-z][a-z0-9_]{0,63}`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/check/fn.config_key_ok.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-find_interactive/ --- # Function command::object::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. `zaun_community_protocol::command::object::find_interactive` · Function ```rust pub fn find_interactive<'a>(components: &'a [Component], custom_id: &str) -> Option<&'a Component> ``` 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. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/find/fn.find_interactive.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-host_pattern_ok/ --- # Function command::object::host_pattern_ok > A DNS name, optionally with one leading `*.` label: letters, digits and `-`, at least two labels, ≤ 253 bytes, lower case. `zaun_community_protocol::command::object::host_pattern_ok` · Function ```rust pub fn host_pattern_ok(host: &str) -> bool ``` A DNS name, optionally with one leading `*.` label: letters, digits and `-`, at least two labels, ≤ 253 bytes, lower case. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/check/fn.host_pattern_ok.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-local_address_ok/ --- # Function command::object::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. `zaun_community_protocol::command::object::local_address_ok` · Function ```rust pub fn local_address_ok(addr: &str) -> bool ``` 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. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/check/fn.local_address_ok.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-message_json_len/ --- # Function command::object::message_json_len > The bytes of a message's `content` and `embeds` as JSON, counted against `MESSAGE_JSON_MAX`. `zaun_community_protocol::command::object::message_json_len` · Function ```rust pub fn message_json_len(content: &str, embeds: &[Embed]) -> usize ``` The bytes of a message's `content` and `embeds` as JSON, counted against `MESSAGE_JSON_MAX`. Writing a parsed value never takes more bytes than the text it was read from (strings, numbers and keys come out in their shortest form, absent and default fields stay absent), so the content and embeds of one `message.send` are always within the limit. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/fn.message_json_len.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-message_json_len_with/ --- # Function command::object::message_json_len_with > `message_json_len` plus the message's components, which count against the same `MESSAGE_JSON_MAX`. `zaun_community_protocol::command::object::message_json_len_with` · Function ```rust pub fn message_json_len_with(content: &str, embeds: &[Embed], components: &[Component]) -> usize ``` `message_json_len` plus the message's components, which count against the same `MESSAGE_JSON_MAX`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/fn.message_json_len_with.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-command-object-modal_inputs/ --- # Function command::object::modal_inputs > The input components of a modal (everything inside its labels), in order. `zaun_community_protocol::command::object::modal_inputs` · Function ```rust pub fn modal_inputs(components: &[Component]) -> Vec<&Component> ``` The input components of a modal (everything inside its labels), in order. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/find/fn.modal_inputs.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-community_id/ --- # Function crypto::community_id > `CommunityId = SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root key)`, over the 1 985-byte encoding including the suite byte. Always the **genesis** key. `zaun_community_protocol::crypto::community_id` · Function ```rust pub fn community_id(genesis_root: &PublicKey) -> CommunityId ``` `CommunityId = SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root key)`, over the 1 985-byte encoding including the suite byte. Always the **genesis** key. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/hash/fn.community_id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-content_hash/ --- # Function crypto::content_hash > `SHA3-256(bytes)`: how signed objects are identified, deduplicated and chained (never by signature bytes, the protocol), for example a `delegation_hash`. `zaun_community_protocol::crypto::content_hash` · Function ```rust pub fn content_hash(bytes: &[u8]) -> [u8; 32] ``` `SHA3-256(bytes)`: how signed objects are identified, deduplicated and chained (never by signature bytes, the protocol), for example a `delegation_hash`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/hash/fn.content_hash.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-host_id/ --- # Function crypto::host_id > `HostId = SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key)`. `zaun_community_protocol::crypto::host_id` · Function ```rust pub fn host_id(host_public_key: &PublicKey) -> HostId ``` `HostId = SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key)`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/hash/fn.host_id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-message_prime/ --- # Function crypto::message_prime > `M' = Prefix ‖ Label ‖ len(ctx) u8 ‖ ctx ‖ SHA-512(M)`, or `None` when `ctx` exceeds 255 bytes. `zaun_community_protocol::crypto::message_prime` · Function ```rust pub fn message_prime(ctx: &[u8], message: &[u8]) -> Option> ``` `M' = Prefix ‖ Label ‖ len(ctx) u8 ‖ ctx ‖ SHA-512(M)`, or `None` when `ctx` exceeds 255 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/fn.message_prime.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-publisher_id/ --- # Function crypto::publisher_id > `PublisherId = SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher key)`. `zaun_community_protocol::crypto::publisher_id` · Function ```rust pub fn publisher_id(publisher_key: &PublicKey) -> PublisherId ``` `PublisherId = SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher key)`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/hash/fn.publisher_id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-sign/ --- # Function crypto::sign > Signs `message` (the canonical bytes `B`) with context `ctx`, hedged: ML-DSA draws 32 fresh bytes from the OS CSPRNG (FIPS 204 Algorithm 2 with the context prefix built here). `zaun_community_protocol::crypto::sign` · Function ```rust pub fn sign(sk: &SecretKey, ctx: Context, message: &[u8]) -> Result ``` Signs `message` (the canonical bytes `B`) with context `ctx`, hedged: ML-DSA draws 32 fresh bytes from the OS CSPRNG (FIPS 204 Algorithm 2 with the context prefix built here). # Errors `SignError::Rng` when the CSPRNG fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/fn.sign.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-sign_deterministic/ --- # Function crypto::sign_deterministic > Deterministic signing (FIPS 204 deterministic variant). **Golden test vectors only**; real signatures use `sign`. `zaun_community_protocol::crypto::sign_deterministic` · Function ```rust pub fn sign_deterministic(sk: &SecretKey, ctx: Context, message: &[u8]) -> Result ``` Deterministic signing (FIPS 204 deterministic variant). **Golden test vectors only**; real signatures use `sign`. # Errors `SignError::MlDsa` if ML-DSA signing fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/fn.sign_deterministic.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-verify/ --- # Function crypto::verify > Verifies `sig` over `message` with context `ctx` against `pk`. `zaun_community_protocol::crypto::verify` · Function ```rust pub fn verify(pk: &PublicKey, sig: &Signature, ctx: Context, message: &[u8], min_suite: u8) -> Result<(), VerifyError> ``` Verifies `sig` over `message` with context `ctx` against `pk`. `min_suite` is the community's minimum suite, or `0x01` outside a community. # Errors `VerifyError` on a suite mismatch or downgrade, or when either component fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/fn.verify.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-verify_raw/ --- # Function crypto::verify_raw > RFC 10073 `id-MLDSA65-Ed25519-SHA512` verification over raw components (no suite byte): `pk = mldsaPK ‖ edPK` (1 984 B), `sig = mldsaSig ‖ edSig` (3 373 B), any `ctx` ≤ 255 B. Both `zaun_community_protocol::crypto::verify_raw` · Function ```rust pub fn verify_raw(pk: &[u8], sig: &[u8], ctx: &[u8], message: &[u8]) -> Result<(), VerifyError> ``` RFC 10073 `id-MLDSA65-Ed25519-SHA512` verification over raw components (no suite byte): `pk = mldsaPK ‖ edPK` (1 984 B), `sig = mldsaSig ‖ edSig` (3 373 B), any `ctx` ≤ 255 B. Both components are always checked. Protocol code uses `verify`; this exists for the RFC test vectors, whose `ctx` is not a protocol context. # Errors `VerifyError` for malformed input or when either component fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/composite/fn.verify_raw.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-voice-derive_key_salt/ --- # Function crypto::voice::derive_key_salt > RFC 9605 the protocol `derive_key_salt` for suite `0x0005`. `zaun_community_protocol::crypto::voice::derive_key_salt` · Function ```rust pub fn derive_key_salt(kid: u64, base_key: &[u8]) -> (Zeroizing<[u8; 32]>, [u8; 12]) ``` RFC 9605 the protocol `derive_key_salt` for suite `0x0005`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/fn.derive_key_salt.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-crypto-voice-kid_for/ --- # Function crypto::voice::kid_for > The KID of a sender's epoch: the first 3 bytes of `SHA3-256("zaun/v1/voice-kid" ‖ session)` above the 32-bit epoch. `zaun_community_protocol::crypto::voice::kid_for` · Function ```rust pub fn kid_for(session: &VoiceSessionId, epoch: u32) -> u64 ``` The KID of a sender's epoch: the first 3 bytes of `SHA3-256("zaun/v1/voice-kid" ‖ session)` above the 32-bit epoch. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/fn.kid_for.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-encoding-from_bytes/ --- # Function encoding::from_bytes > Decodes a top-level value, rejecting trailing bytes. `zaun_community_protocol::encoding::from_bytes` · Function ```rust pub fn from_bytes(bytes: &[u8]) -> Result ``` Decodes a top-level value, rejecting trailing bytes. # Errors `DecodeError` for malformed input or trailing bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/fn.from_bytes.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-encoding-to_bytes/ --- # Function encoding::to_bytes > Encodes a top-level value. `zaun_community_protocol::encoding::to_bytes` · Function ```rust pub fn to_bytes(value: &T) -> Result, EncodeError> ``` Encodes a top-level value. # Errors `EncodeError` when a field breaks its limit or rule. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/fn.to_bytes.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-check_version/ --- # Function envelope::check_version > Checks an inbound envelope's `v` against the connection's negotiated version. `zaun_community_protocol::envelope::check_version` · Function ```rust pub fn check_version(v: u16, negotiated: Option) -> Result<(), ErrorBody> ``` Checks an inbound envelope's `v` against the connection's negotiated version. After negotiation `v` MUST equal it; otherwise `UNSUPPORTED_VERSION` with this crate's range (`VersionRange::CURRENT`). Before negotiation any `v` passes: only `session.hello` is answered then (anything else gets `HELLO_REQUIRED`), and its `versions` body decides. # Errors `UNSUPPORTED_VERSION` when `v` differs from the negotiated version. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/version/fn.check_version.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-command_limit/ --- # Function envelope::command_limit > The size limit of a command envelope of type `kind`: `MAX_COMMAND`, except `community.create` and `community.descriptor.publish`, which may use the whole `max_frame`. `zaun_community_protocol::envelope::command_limit` · Function ```rust pub fn command_limit(kind: &str) -> usize ``` The size limit of a command envelope of type `kind`: `MAX_COMMAND`, except `community.create` and `community.descriptor.publish`, which may use the whole `max_frame`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/inbound/fn.command_limit.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-is_mutating/ --- # Function envelope::is_mutating > Whether a command `type` is mutating, hence idempotent and recorded: every command except `session.hello`, `*.get`, `*.list`, `message.history`, `audit.list`, `member.bans`, `membe `zaun_community_protocol::envelope::is_mutating` · Function ```rust pub fn is_mutating(kind: &str) -> bool ``` Whether a command `type` is mutating, hence idempotent and recorded: every command except `session.hello`, `*.get`, `*.list`, `message.history`, `audit.list`, `member.bans`, `membership.pending`, `invite.uses`, `community.rotations`, `attachment.download`, `voice.signal`, `voice.keys`, `sync.*` and `signal.*`. `voice.signal` and `voice.keys` change nothing at the host: they are relayed live, and a retry is relayed again. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/idempotency/fn.is_mutating.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-is_recorded/ --- # Function envelope::is_recorded > Whether `response` is stored in the idempotency record; see `ResponseEnvelope::is_recorded`. `zaun_community_protocol::envelope::is_recorded` · Function ```rust pub fn is_recorded(response: &ResponseEnvelope) -> bool ``` Whether `response` is stored in the idempotency record; see `ResponseEnvelope::is_recorded`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/idempotency/fn.is_recorded.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-negotiate/ --- # Function envelope::negotiate > Chooses the highest version in both ranges (`session.hello`, the protocol). `zaun_community_protocol::envelope::negotiate` · Function ```rust pub fn negotiate(client: VersionRange, host: VersionRange) -> Result ``` Chooses the highest version in both ranges (`session.hello`, the protocol). # Errors `UNSUPPORTED_VERSION` carrying `host` when the ranges do not overlap (or `client` is empty, `min > max`). Send it as a version-1 envelope (`ResponseEnvelope::error` does); the connection stays unnegotiated. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/version/fn.negotiate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-parse_command/ --- # Function envelope::parse_command > Parses a whole or reassembled command envelope `text`. `zaun_community_protocol::envelope::parse_command` · Function ```rust pub fn parse_command(text: &str, negotiated: Option) -> Result ``` Parses a whole or reassembled command envelope `text`. `negotiated` is the connection's negotiated version, `None` before a successful `session.hello`. # Errors A `Rejection` with `BAD_REQUEST` (malformed JSON, missing or ill-typed field, bad id encoding, `request_id: null` outside `signal.*`), `UNSUPPORTED_VERSION` or `PAYLOAD_TOO_LARGE`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/inbound/fn.parse_command.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-envelope-replay/ --- # Function envelope::replay > Compares a retried command with the stored record for its key. `zaun_community_protocol::envelope::replay` · Function ```rust pub fn replay(stored_kind: &str, stored_hash: &BodyHash, kind: &str, hash: &BodyHash) -> Replay ``` Compares a retried command with the stored record for its key. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/idempotency/fn.replay.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-framing-app_data-data/ --- # Function framing::app_data::data > The application data that carries the frame message `frame`. `zaun_community_protocol::framing::app_data::data` · Function ```rust pub fn data(frame: &str) -> Map ``` The application data that carries the frame message `frame`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/app_data/fn.data.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-framing-app_data-frame/ --- # Function framing::app_data::frame > The frame message text in application data of content type `tag`, or `None` when it is not a Zaun frame. Keys other than `FRAME_KEY` are ignored, for later additions. `zaun_community_protocol::framing::app_data::frame` · Function ```rust pub fn frame<'a>(tag: &str, json: &'a Map) -> Option<&'a str> ``` The frame message text in application data of content type `tag`, or `None` when it is not a Zaun frame. Keys other than `FRAME_KEY` are ignored, for later additions. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/app_data/fn.frame.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-framing-classify/ --- # Function framing::classify > Classifies one inbound text message. The `zaun:1f:` prefix is tested before `zaun:1:` (they differ at the 7th byte, so the order is only for clarity). `zaun_community_protocol::framing::classify` · Function ```rust pub fn classify(text: &str) -> Inbound<'_> ``` Classifies one inbound text message. The `zaun:1f:` prefix is tested before `zaun:1:` (they differ at the 7th byte, so the order is only for clarity). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/parse/fn.classify.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-framing-encode/ --- # Function framing::encode > Frames the compact envelope JSON `json`. `zaun_community_protocol::framing::encode` · Function ```rust pub fn encode(json: &str, budget: usize, frag_id: FragId) -> Result ``` Frames the compact envelope JSON `json`. `budget` is the per-message budget of the **whole** message text, prefix and header included, measured as written inside a JSON string (`escaped_len`): each message is cut by what it really costs, so text with few quotes fills a message. The host derives the budget from `simplex_client::limits`; this crate never depends on `simplex-client`. A frame that fits in one message is sent whole; otherwise it is split greedily at UTF-8 character boundaries. `frag_id` is used only when fragmenting. # Errors `EncodeError` when the envelope is larger than `max_frame`, needs more than 32 fragments, or the budget is below `MIN_BUDGET`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/encode/fn.encode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-framing-escaped_len/ --- # Function framing::escaped_len > The bytes `text` takes written inside a JSON string, as a frame message travels in its application data: `"` and `\` take two, the control characters JSON writes as `\b`, `\t`, `\n `zaun_community_protocol::framing::escaped_len` · Function ```rust pub fn escaped_len(text: &str) -> usize ``` The bytes `text` takes written inside a JSON string, as a frame message travels in its application data: `"` and `\` take two, the control characters JSON writes as `\b`, `\t`, `\n`, `\f`, `\r` two, every other control character six (`\u00XX`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/encode/fn.escaped_len.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-ids-fill_random/ --- # Function ids::fill_random > Fills `buf` from the operating system CSPRNG. `zaun_community_protocol::ids::fill_random` · Function ```rust pub fn fill_random(buf: &mut [u8]) -> Result<(), RngError> ``` Fills `buf` from the operating system CSPRNG. # Errors `RngError` when `getrandom` fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/fn.fill_random.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-json-is_zero_u32/ --- # Function json::is_zero_u32 > `skip_serializing_if` for a `u32` that is absent when 0 (message `flags`, the protocol). `zaun_community_protocol::json::is_zero_u32` · Function ```rust pub const fn is_zero_u32(value: &u32) -> bool ``` `skip_serializing_if` for a `u32` that is absent when 0 (message `flags`, the protocol). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/json/fn.is_zero_u32.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-json-u64_decimal-deserialize/ --- # Function json::u64_decimal::deserialize > Deserializes a canonical decimal string. `zaun_community_protocol::json::u64_decimal::deserialize` · Function ```rust pub fn deserialize<'de, D>(d: D) -> Result::Error> ``` Deserializes a canonical decimal string. # Errors A number, a non-canonical decimal or an overflow. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/json/u64_decimal/fn.deserialize.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-json-u64_decimal-parse/ --- # Function json::u64_decimal::parse > Parses a canonical decimal. `zaun_community_protocol::json::u64_decimal::parse` · Function ```rust pub fn parse(text: &str) -> Option ``` Parses a canonical decimal. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/json/u64_decimal/fn.parse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-json-u64_decimal-serialize/ --- # Function json::u64_decimal::serialize > Serializes as a decimal string. `zaun_community_protocol::json::u64_decimal::serialize` · Function ```rust pub fn serialize(value: &u64, s: S) -> Result<::Ok, ::Error> ``` Serializes as a decimal string. # Errors Only the serializer's own errors. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/json/u64_decimal/fn.serialize.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-limits-text_within/ --- # Function limits::text_within > Whether `text` has between `min` and `max` Unicode scalar values and at most 4× `max` bytes. `zaun_community_protocol::limits::text_within` · Function ```rust pub fn text_within(text: &str, (min, max): (usize, usize)) -> bool ``` Whether `text` has between `min` and `max` Unicode scalar values and at most 4× `max` bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/limits/fn.text_within.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-act_on/ --- # Function permissions::act_on > H1 then H2, with H2 skipped when the actor targets themself and `self_ok` is set. `zaun_community_protocol::permissions::act_on` · Function ```rust pub fn act_on(actor: &Party, target: &Party, self_ok: bool) -> Result<(), Denial> ``` H1 then H2, with H2 skipped when the actor targets themself and `self_ok` is set. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.act_on.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-all_in/ --- # Function permissions::all_in > The grants of an owner or administrator in a channel. `zaun_community_protocol::permissions::all_in` · Function ```rust pub const fn all_in(kind: ChannelKind) -> Permissions ``` The grants of an owner or administrator in a channel. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.all_in.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-applicable/ --- # Function permissions::applicable > The channel bits that apply to a channel kind. `zaun_community_protocol::permissions::applicable` · Function ```rust pub const fn applicable(kind: ChannelKind) -> Permissions ``` The channel bits that apply to a channel kind. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.applicable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-base/ --- # Function permissions::base > `base(m)` for a non-owner (steps 1–2): `@everyone` OR the member's roles; `ALL` with `ADMINISTRATOR`; otherwise masked by `KNOWN`. `zaun_community_protocol::permissions::base` · Function ```rust pub fn base(everyone: Permissions, roles: &[Role]) -> Permissions ``` `base(m)` for a non-owner (steps 1–2): `@everyone` OR the member's roles; `ALL` with `ADMINISTRATOR`; otherwise masked by `KNOWN`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.base.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-channel_grants/ --- # Function permissions::channel_grants > `grants(m, ch)` (steps 3–6) for a non-administrator whose base is `base`. `zaun_community_protocol::permissions::channel_grants` · Function ```rust pub fn channel_grants(base: Permissions, member: MemberId, roles: &[Role], ch: &Channel<'_>) -> Permissions ``` `grants(m, ch)` (steps 3–6) for a non-administrator whose base is `base`. Overrides are aggregated per layer in one pass, so duplicate or reordered entries give the same result (property 1). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.channel_grants.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-commands/ --- # Function permissions::commands > Every command name of the table. `zaun_community_protocol::permissions::commands` · Function ```rust pub fn commands() -> impl Iterator ``` Every command name of the table. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/table/fn.commands.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-community_dependencies/ --- # Function permissions::community_dependencies > Implicit dependencies at community level: no attachment, embed or mass mention without `SEND_MESSAGES`, no voice bit without `CONNECT`. There is no `VIEW_CHANNEL` gate here: whethe `zaun_community_protocol::permissions::community_dependencies` · Function ```rust pub const fn community_dependencies(p: Permissions) -> Permissions ``` Implicit dependencies at community level: no attachment, embed or mass mention without `SEND_MESSAGES`, no voice bit without `CONNECT`. There is no `VIEW_CHANNEL` gate here: whether a member sees a channel is decided per channel (permissions the protocol). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.community_dependencies.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-dependencies/ --- # Function permissions::dependencies > Implicit dependencies (step 6) at channel level: no channel bit without `VIEW_CHANNEL`, then `community_dependencies`. `zaun_community_protocol::permissions::dependencies` · Function ```rust pub const fn dependencies(p: Permissions) -> Permissions ``` Implicit dependencies (step 6) at channel level: no channel bit without `VIEW_CHANNEL`, then `community_dependencies`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.dependencies.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-gate/ --- # Function permissions::gate > The gate for a connection bound to a member in `state`. `Probation` and `Active` pass every bound command, which is then subject to its permissions. `zaun_community_protocol::permissions::gate` · Function ```rust pub fn gate(state: MembershipState, command: &str) -> Result<(), GateDenial> ``` The gate for a connection bound to a member in `state`. `Probation` and `Active` pass every bound command, which is then subject to its permissions. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/fn.gate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-gate_unbound/ --- # Function permissions::gate_unbound > The gate for an unbound connection. `zaun_community_protocol::permissions::gate_unbound` · Function ```rust pub fn gate_unbound(command: &str) -> Result<(), GateDenial> ``` The gate for an unbound connection. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/gate/fn.gate_unbound.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-h1/ --- # Function permissions::h1 > H1: nobody acts on the owner, except the owner on themself. `zaun_community_protocol::permissions::h1` · Function ```rust pub fn h1(actor: &Party, target: &Party) -> Result<(), Denial> ``` H1: nobody acts on the owner, except the owner on themself. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.h1.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-h2/ --- # Function permissions::h2 > H2: acting on another member requires `top(T) < top(A)`; equal positions block and `ADMINISTRATOR` does not lift it. The owner passes. `zaun_community_protocol::permissions::h2` · Function ```rust pub fn h2(actor: &Party, target: &Party) -> Result<(), Denial> ``` H2: acting on another member requires `top(T) < top(A)`; equal positions block and `ADMINISTRATOR` does not lift it. The owner passes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.h2.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-h3/ --- # Function permissions::h3 > H3: every changed bit must be held (`changed ⊆ held`, `held` being `cp` or `chp`). `zaun_community_protocol::permissions::h3` · Function ```rust pub fn h3(actor: &Party, changed: Permissions, held: Permissions) -> Result<(), Denial> ``` H3: every changed bit must be held (`changed ⊆ held`, `held` being `cp` or `chp`). The owner and `ADMINISTRATOR` holders are exempt: permissions.md says H3 never blocks an administrator, and the protocol exempts them explicitly. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.h3.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-h3_owner_only/ --- # Function permissions::h3_owner_only > H3 where only the owner is exempt: restriction masks (`newcomer_restrictions`, a lockdown's mask), for which permissions.md the protocol says "owner exempt" and the specification i `zaun_community_protocol::permissions::h3_owner_only` · Function ```rust pub fn h3_owner_only(actor: &Party, changed: Permissions, held: Permissions) -> Result<(), Denial> ``` H3 where only the owner is exempt: restriction masks (`newcomer_restrictions`, a lockdown's mask), for which permissions.md the protocol says "owner exempt" and the specification is silent. So an administrator in probation cannot lift the newcomer mask that binds it (7b). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.h3_owner_only.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-h4/ --- # Function permissions::h4 > H4: a role is manageable only strictly below the actor's top; the owner is exempt. `zaun_community_protocol::permissions::h4` · Function ```rust pub fn h4(actor: &Party, position: u32) -> Result<(), Denial> ``` H4: a role is manageable only strictly below the actor's top; the owner is exempt. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.h4.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-invites-invite_create/ --- # Function permissions::invites::invite_create > `invite.create` beyond `CREATE_INVITE` itself (checked by the table in the right scope): the `invite_creation` rule, default roles the actor could assign, stricter-only admission o `zaun_community_protocol::permissions::invites::invite_create` · Function ```rust pub fn invite_create(actor: &Party, state: MembershipState, cp: Permissions, req: &InviteRequest<'_>) -> Result<(), Refusal> ``` `invite.create` beyond `CREATE_INVITE` itself (checked by the table in the right scope): the `invite_creation` rule, default roles the actor could assign, stricter-only admission overrides, and `pre_approved` needing `APPROVE_MEMBERS` and excluding `requires_approval`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/invites/fn.invite_create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-invites-redeemable_roles/ --- # Function permissions::invites::redeemable_roles > At redemption, the default roles the issuer could still assign now; the rest are dropped, never granted (permissions the protocol, the protocol). A deleted role is simply absent fr `zaun_community_protocol::permissions::invites::redeemable_roles` · Function ```rust pub fn redeemable_roles<'r>(issuer: &'r Party, issuer_cp: Permissions, roles: &'r [Role]) -> impl Iterator + 'r ``` At redemption, the default roles the issuer could still assign now; the rest are dropped, never granted (permissions the protocol, the protocol). A deleted role is simply absent from `roles`. An issuer who left or was banned resolves to an empty `cp`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/invites/fn.redeemable_roles.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-approve/ --- # Function permissions::members::approve > `membership.approve`. A `Pending` target has no roles, so no H2; but the approver must be able to assign every default role applied at approval. Ending a `Probation` early needs H1 `zaun_community_protocol::permissions::members::approve` · Function ```rust pub fn approve(actor: &Party, cp: Permissions, target: &Party, state: MembershipState, default_roles: &[Role]) -> Result<(), Refusal> ``` `membership.approve`. A `Pending` target has no roles, so no H2; but the approver must be able to assign every default role applied at approval. Ending a `Probation` early needs H1 and H2 (permissions the protocol). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.approve.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-kick_or_ban/ --- # Function permissions::members::kick_or_ban > `member.kick` and `member.ban`: not self (use `community.leave`); H1; H2. `zaun_community_protocol::permissions::members::kick_or_ban` · Function ```rust pub fn kick_or_ban(actor: &Party, target: &Party) -> Result<(), Refusal> ``` `member.kick` and `member.ban`: not self (use `community.leave`); H1; H2. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.kick_or_ban.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-moderate_content/ --- # Function permissions::members::moderate_content > Deleting another member's message or removing their reaction: H1 only, no H2. `zaun_community_protocol::permissions::members::moderate_content` · Function ```rust pub fn moderate_content(actor: &Party, author: &Party) -> Result<(), Refusal> ``` Deleting another member's message or removing their reaction: H1 only, no H2. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.moderate_content.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-nickname/ --- # Function permissions::members::nickname > `member.update` of a nickname: one's own needs only `CHANGE_NICKNAME` (table); another's needs H1 and H2. `zaun_community_protocol::permissions::members::nickname` · Function ```rust pub fn nickname(actor: &Party, target: &Party) -> Result<(), Refusal> ``` `member.update` of a nickname: one's own needs only `CHANGE_NICKNAME` (table); another's needs H1 and H2. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.nickname.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-reject/ --- # Function permissions::members::reject > `membership.reject`: the target is `Pending`. `zaun_community_protocol::permissions::members::reject` · Function ```rust pub fn reject(state: MembershipState) -> Result<(), Refusal> ``` `membership.reject`: the target is `Pending`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.reject.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-restore/ --- # Function permissions::members::restore > `membership.restore`: not self; H1; H2; the target is `Suspended`. `zaun_community_protocol::permissions::members::restore` · Function ```rust pub fn restore(actor: &Party, target: &Party, state: MembershipState) -> Result<(), Refusal> ``` `membership.restore`: not self; H1; H2; the target is `Suspended`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.restore.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-suspend/ --- # Function permissions::members::suspend > `membership.suspend`: not self; H1; H2; the target is `Probation` or `Active`. `zaun_community_protocol::permissions::members::suspend` · Function ```rust pub fn suspend(actor: &Party, target: &Party, state: MembershipState) -> Result<(), Refusal> ``` `membership.suspend`: not self; H1; H2; the target is `Probation` or `Active`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.suspend.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-members-timeout/ --- # Function permissions::members::timeout > `member.timeout` (set or clear): H1; H2; never the owner; never a target holding `ADMINISTRATOR`; `until ≤ now + 28 days`. `zaun_community_protocol::permissions::members::timeout` · Function ```rust pub fn timeout(actor: &Party, target: &Party, target_is_admin: bool, until_ms: Option, now_ms: u64) -> Result<(), Refusal> ``` `member.timeout` (set or clear): H1; H2; never the owner; never a target holding `ADMINISTRATOR`; `until ≤ now + 28 days`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/members/fn.timeout.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-no_new_unknown/ --- # Function permissions::no_new_unknown > the protocol: a command may not set an unknown bit that `old` did not already hold. `zaun_community_protocol::permissions::no_new_unknown` · Function ```rust pub fn no_new_unknown(old: Permissions, new: Permissions) -> Result<(), Invalid> ``` the protocol: a command may not set an unknown bit that `old` did not already hold. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/fn.no_new_unknown.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-overrides-adopt_parent/ --- # Function permissions::overrides::adopt_parent > Setting `sync_with_parent = true`: checked as an override edit from the channel's own overrides to the parent's, for every target in either. `subject` maps a target to its hierarch `zaun_community_protocol::permissions::overrides::adopt_parent` · Function ```rust pub fn adopt_parent Option>(actor: &Party, chp: Permissions, own: &[Override], parent: &[Override], subject: impl Fn(&OverrideTarget) -> Option) -> Result<(), Refusal> ``` Setting `sync_with_parent = true`: checked as an override edit from the channel's own overrides to the parent's, for every target in either. `subject` maps a target to its hierarchy view; `None` (a deleted role or member) is skipped. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/overrides/fn.adopt_parent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-overrides-override_edit/ --- # Function permissions::overrides::override_edit > One override edit in `channel.permissions.update` (or `channel.create` with initial overrides). `chp` is the actor's effective permissions in that channel; `old`/`new` are `(allow, `zaun_community_protocol::permissions::overrides::override_edit` · Function ```rust pub fn override_edit(actor: &Party, chp: Permissions, subject: OverrideSubject, old: (Permissions, Permissions), new: (Permissions, Permissions)) -> Result<(), Refusal> ``` One override edit in `channel.permissions.update` (or `channel.create` with initial overrides). `chp` is the actor's effective permissions in that channel; `old`/`new` are `(allow, deny)` with `(0, 0)` for none. A role target needs H4; a member target H1 and H2 unless self. H3: the changed bits must be in `chp` (owner and administrator exempt). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/overrides/fn.override_edit.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-overrides-validate_override/ --- # Function permissions::overrides::validate_override > Validates a new override value against the stored one (`old`, if any): `allow & deny == 0`; no known bit outside `CHANNEL_SCOPED`; no unknown bit that `old` did not already hold. U `zaun_community_protocol::permissions::overrides::validate_override` · Function ```rust pub fn validate_override(old: Option<(Permissions, Permissions)>, allow: Permissions, deny: Permissions) -> Result ``` Validates a new override value against the stored one (`old`, if any): `allow & deny == 0`; no known bit outside `CHANNEL_SCOPED`; no unknown bit that `old` did not already hold. Unknown bits already present pass through unchanged. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/overrides/fn.validate_override.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-required/ --- # Function permissions::required > The requirement of a command by wire name; `None` for a name the table does not know (the engine answers `UNSUPPORTED_COMMAND`). `zaun_community_protocol::permissions::required` · Function ```rust pub fn required(command: &str) -> Option ``` The requirement of a command by wire name; `None` for a name the table does not know (the engine answers `UNSUPPORTED_COMMAND`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/table/fn.required.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-can_assign/ --- # Function permissions::roles::can_assign > Whether `actor` could assign `role` right now: the check behind invitation default roles and approval (permissions the protocol, the protocol). `cp` must hold `MANAGE_ROLES` unless `zaun_community_protocol::permissions::roles::can_assign` · Function ```rust pub fn can_assign(actor: &Party, cp: Permissions, role: &Role) -> Result<(), Denial> ``` Whether `actor` could assign `role` right now: the check behind invitation default roles and approval (permissions the protocol, the protocol). `cp` must hold `MANAGE_ROLES` unless the actor is the owner. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.can_assign.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-can_grant/ --- # Function permissions::roles::can_grant > Hierarchy over a role being granted, without `MANAGE_ROLES`: not `@everyone`, H4, and its known bits held (H3). Used by `membership.approve`. `zaun_community_protocol::permissions::roles::can_grant` · Function ```rust pub fn can_grant(actor: &Party, cp: Permissions, role: &Role) -> Result<(), Denial> ``` Hierarchy over a role being granted, without `MANAGE_ROLES`: not `@everyone`, H4, and its known bits held (H3). Used by `membership.approve`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.can_grant.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-member_role_change/ --- # Function permissions::roles::member_role_change > `member.roles.update` for one role `role` on `target`: H1; H2 unless self; H4 on the role; when assigning, `role.permissions ⊆ cp` (H3). `@everyone` is never listed. `zaun_community_protocol::permissions::roles::member_role_change` · Function ```rust pub fn member_role_change(actor: &Party, cp: Permissions, target: &Party, role: &Role, assign: bool) -> Result<(), Refusal> ``` `member.roles.update` for one role `role` on `target`: H1; H2 unless self; H4 on the role; when assigning, `role.permissions ⊆ cp` (H3). `@everyone` is never listed. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.member_role_change.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_create/ --- # Function permissions::roles::role_create > `role.create`: H3 on the new role's bits. Returns the new role's position; the engine shifts every role at or above it up by one. `zaun_community_protocol::permissions::roles::role_create` · Function ```rust pub fn role_create(actor: &Party, cp: Permissions, permissions: Permissions, max_position: u32) -> Result ``` `role.create`: H3 on the new role's bits. Returns the new role's position; the engine shifts every role at or above it up by one. Specification the protocol and permissions the protocol place it "directly below the actor's highest role": the actor's top position (the actor's role moves up), or `max_position + 1` for the owner. An actor holding no role has nothing to place it below and is refused (`hierarchy`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.role_create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_delete/ --- # Function permissions::roles::role_delete > `role.delete`: not `@everyone`; H4. `zaun_community_protocol::permissions::roles::role_delete` · Function ```rust pub fn role_delete(actor: &Party, role: &Role) -> Result<(), Refusal> ``` `role.delete`: not `@everyone`; H4. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.role_delete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_reorder/ --- # Function permissions::roles::role_reorder > `role.reorder`: `roles` is the community's role table, `moves` the request's `(role_id, new_position)` pairs. Every role whose position changes must be below the actor before and a `zaun_community_protocol::permissions::roles::role_reorder` · Function ```rust pub fn role_reorder(actor: &Party, roles: &[Role], moves: &[(RoleId, u32)]) -> Result<(), Refusal> ``` `role.reorder`: `roles` is the community's role table, `moves` the request's `(role_id, new_position)` pairs. Every role whose position changes must be below the actor before and after; positions must stay unique and non-zero; `@everyone` cannot be listed. The owner may move any other role. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.role_reorder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-roles-role_update/ --- # Function permissions::roles::role_update > `role.update`: H4 on the role, H3 on `old XOR new`. `@everyone` may change only its permissions (`other_fields` is true when the body changes anything else). `zaun_community_protocol::permissions::roles::role_update` · Function ```rust pub fn role_update(actor: &Party, cp: Permissions, role: &Role, new_permissions: Permissions, other_fields: bool) -> Result<(), Refusal> ``` `role.update`: H4 on the role, H3 on `old XOR new`. `@everyone` may change only its permissions (`other_fields` is true when the body changes anything else). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/roles/fn.role_update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-safety-admission_policy_update/ --- # Function permissions::safety::admission_policy_update > `admission.policy.update` of `newcomer_restrictions`: valid, and H3 on the bits added or removed (`old XOR new ⊆ cp`; only the owner exempt, see `h3_owner_only`). `zaun_community_protocol::permissions::safety::admission_policy_update` · Function ```rust pub fn admission_policy_update(actor: &Party, cp: Permissions, old: Permissions, new: Permissions) -> Result<(), Refusal> ``` `admission.policy.update` of `newcomer_restrictions`: valid, and H3 on the bits added or removed (`old XOR new ⊆ cp`; only the owner exempt, see `h3_owner_only`). [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/safety/fn.admission_policy_update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-safety-lockdown_disable/ --- # Function permissions::safety::lockdown_disable > `moderation.lockdown.disable`: `top(A) ≥` the enabling actor's recorded top (owner exempt), so a lower moderator cannot lift a higher one's lockdown, and H3 on the bits the lockdow `zaun_community_protocol::permissions::safety::lockdown_disable` · Function ```rust pub fn lockdown_disable(actor: &Party, held: Permissions, active: ActiveLockdown) -> Result<(), Refusal> ``` `moderation.lockdown.disable`: `top(A) ≥` the enabling actor's recorded top (owner exempt), so a lower moderator cannot lift a higher one's lockdown, and H3 on the bits the lockdown restricts, against `held` as in `lockdown_enable`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/safety/fn.lockdown_disable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-safety-lockdown_enable/ --- # Function permissions::safety::lockdown_enable > `moderation.lockdown.enable` (also renewal and replacement): duration within 60 s – 7 days and H3 on the new lockdown's mask (only the owner exempt). Enabling while one is active r `zaun_community_protocol::permissions::safety::lockdown_enable` · Function ```rust pub fn lockdown_enable(actor: &Party, held: Permissions, restrictions: LockdownRestrictions, newcomer_restrictions: Permissions, expires_in_ms: u64, active: Option) -> Result<(), Refusal> ``` `moderation.lockdown.enable` (also renewal and replacement): duration within 60 s – 7 days and H3 on the new lockdown's mask (only the owner exempt). Enabling while one is active replaces it, so the actor must also pass `lockdown_disable` for the active one: a lower moderator cannot swap a higher one's lockdown. `held` is the actor's community permissions **before the lockdown step** (`Resolved::before_lockdown` of `cp`): timeout and probation still apply, but a lockdown never prevents its own management. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/safety/fn.lockdown_enable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-safety-validate_newcomer_restrictions/ --- # Function permissions::safety::validate_newcomer_restrictions > Validates a new `newcomer_restrictions` mask: no `VIEW_CHANNEL` or `READ_MESSAGE_HISTORY`, no newly set unknown bit. `zaun_community_protocol::permissions::safety::validate_newcomer_restrictions` · Function ```rust pub fn validate_newcomer_restrictions(old: Permissions, new: Permissions) -> Result<(), Invalid> ``` Validates a new `newcomer_restrictions` mask: no `VIEW_CHANNEL` or `READ_MESSAGE_HISTORY`, no newly set unknown bit. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/safety/fn.validate_newcomer_restrictions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-permissions-with_dependants/ --- # Function permissions::with_dependants > Every bit that `dependencies` would also drop once `mask` is removed: used to attribute a lost dependant to the restriction that removed its prerequisite. `zaun_community_protocol::permissions::with_dependants` · Function ```rust pub const fn with_dependants(mask: Permissions) -> Permissions ``` Every bit that `dependencies` would also drop once `mask` is removed: used to attribute a lost dependant to the restriction that removed its prerequisite. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolve/fn.with_dependants.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-claimed_genesis/ --- # Function signed::claimed_genesis > The **claimed** genesis key: the first rotation's `old_root`, or the descriptor's `root_public_key` when the chain is empty. `zaun_community_protocol::signed::claimed_genesis` · Function ```rust pub fn claimed_genesis(descriptor_bytes: &[u8], chain: &[SignedRootRotation]) -> Result ``` The **claimed** genesis key: the first rotation's `old_root`, or the descriptor's `root_public_key` when the chain is empty. The key is read from unverified bytes at a fixed offset. It is authenticated only by `verify_chain`, which checks that it derives the expected community id, and then by the signatures it verifies. # Errors `DecodeError` when the bytes are too short or the key has an unknown suite. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/rotation/chain/fn.claimed_genesis.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-compare_versions/ --- # Function signed::compare_versions > Semantic Versioning precedence of two versions; `None` when either is invalid. An update must be `Ordering::Greater` than the installed version. `zaun_community_protocol::signed::compare_versions` · Function ```rust pub fn compare_versions(a: &str, b: &str) -> Option ``` Semantic Versioning precedence of two versions; `None` when either is invalid. An update must be `Ordering::Greater` than the installed version. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/rules/fn.compare_versions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-parse_package/ --- # Function signed::parse_package > Splits a `.zbot` file into its parts, checking every limit and that nothing trails. `zaun_community_protocol::signed::parse_package` · Function ```rust pub fn parse_package(file: &[u8]) -> Result ``` Splits a `.zbot` file into its parts, checking every limit and that nothing trails. # Errors `PackageError::Malformed`. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/fn.parse_package.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-valid_app_id/ --- # Function signed::valid_app_id > Lowercase reverse-DNS: `a-z0-9-+(\.a-z0-9-+)+`, 3–64 bytes. `zaun_community_protocol::signed::valid_app_id` · Function ```rust pub fn valid_app_id(app_id: &str) -> bool ``` Lowercase reverse-DNS: `[a-z0-9-]+(\.[a-z0-9-]+)+`, 3–64 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/rules/fn.valid_app_id.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-valid_version/ --- # Function signed::valid_version > Semantic Versioning 2.0.0 without build metadata, ≤ 64 bytes. `zaun_community_protocol::signed::valid_version` · Function ```rust pub fn valid_version(version: &str) -> bool ``` Semantic Versioning 2.0.0 without build metadata, ≤ 64 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/rules/fn.valid_version.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-valid_world/ --- # Function signed::valid_world > `zaun:bot/bot@`, ≤ 64 bytes. `zaun_community_protocol::signed::valid_world` · Function ```rust pub fn valid_world(world: &str) -> bool ``` `zaun:bot/bot@`, ≤ 64 bytes. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/rules/fn.valid_world.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-validate_descriptor/ --- # Function signed::validate_descriptor > Rule 1 and the descriptor parts of rule 5: `chain` is the full rotation chain from the genesis key (`community.rotations`), `accepted` the verifier's stored state, if any. `zaun_community_protocol::signed::validate_descriptor` · Function ```rust pub fn validate_descriptor(community_id: &CommunityId, descriptor: &SignedJson, chain: &[SignedRootRotation], accepted: Option<&AcceptedState>) -> Result ``` Rule 1 and the descriptor parts of rule 5: `chain` is the full rotation chain from the genesis key (`community.rotations`), `accepted` the verifier's stored state, if any. # Errors `ValidityError` naming the first rule that fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/validity/fn.validate_descriptor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-validate_pair/ --- # Function signed::validate_pair > Whether a (descriptor, delegation) pair is valid at `now_ms`. `chain` is the full rotation chain from the genesis key; `accepted` is the verifier's stored state for the community, `zaun_community_protocol::signed::validate_pair` · Function ```rust pub fn validate_pair(community_id: &CommunityId, descriptor: &SignedJson, delegation: &SignedJson, chain: &[SignedRootRotation], accepted: Option<&AcceptedState>, now_ms: u64) -> Result ``` Whether a (descriptor, delegation) pair is valid at `now_ms`. `chain` is the full rotation chain from the genesis key; `accepted` is the verifier's stored state for the community, if any. On success the returned pair carries the state to store. # Errors `ValidityError` naming the first rule that fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/validity/pair/fn.validate_pair.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-verify_chain/ --- # Function signed::verify_chain > Verifies a rotation chain from the genesis key: `genesis` must derive `community_id`; for rotation `i` (1-based, list order) `sig_old` verifies under `Kᵢ₋₁` **before** decoding, th `zaun_community_protocol::signed::verify_chain` · Function ```rust pub fn verify_chain(community_id: &CommunityId, genesis: &PublicKey, chain: &[SignedRootRotation]) -> Result ``` Verifies a rotation chain from the genesis key: `genesis` must derive `community_id`; for rotation `i` (1-based, list order) `sig_old` verifies under `Kᵢ₋₁` **before** decoding, then `community_id`, `rotation_seq = i`, `old_root = Kᵢ₋₁`, `new_suite ≥` the previous suite and `sig_new` under `new_root` are checked. # Errors `RotationError` naming the first failing rotation. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/rotation/chain/fn.verify_chain.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-verify_package/ --- # Function signed::verify_package > Verifies the signature under the header's publisher key (`min_suite` 1) before anything else, then both hashes and the manifest's `app_id` and `version`. An all-zero signature is a `zaun_community_protocol::signed::verify_package` · Function ```rust pub fn verify_package(parsed: ParsedPackage, allow_unsigned: bool) -> Result ``` Verifies the signature under the header's publisher key (`min_suite` 1) before anything else, then both hashes and the manifest's `app_id` and `version`. An all-zero signature is accepted only with `allow_unsigned`. # Errors `PackageError` naming the first failed check. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/fn.verify_package.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-write_package/ --- # Function signed::write_package > Writes a `.zbot` file from a signed header and its parts. The caller computed the header's hashes from these exact `manifest` and `component` bytes. `zaun_community_protocol::signed::write_package` · Function ```rust pub fn write_package(header: &Signed, manifest: &[u8], component: &[u8]) -> Result, EncodeError> ``` Writes a `.zbot` file from a signed header and its parts. The caller computed the header's hashes from these exact `manifest` and `component` bytes. # Errors `EncodeError::OverLimit` for a part over its limit. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/fn.write_package.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/function-signed-write_unsigned_package/ --- # Function signed::write_unsigned_package > Writes an unsigned development `.zbot` file (all-zero signature, the protocol). `zaun_community_protocol::signed::write_unsigned_package` · Function ```rust pub fn write_unsigned_package(header: &BotPackage, manifest: &[u8], component: &[u8]) -> Result, EncodeError> ``` Writes an unsigned development `.zbot` file (all-zero signature, the protocol). # Errors `EncodeError` for a broken header rule or a part over its limit. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/fn.write_unsigned_package.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-b64-b64error/ --- # Struct b64::B64Error > The input is not canonical base64url without padding. `zaun_community_protocol::b64::B64Error` · Struct ```rust pub struct B64Error ``` The input is not canonical base64url without padding. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/b64/struct.B64Error.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-bits-permissions/ --- # Struct bits::Permissions > A permission set. JSON: a canonical decimal string. SQLite: `i64` by bit-cast. `zaun_community_protocol::bits::Permissions` · Struct ```rust pub struct Permissions(…) ``` A permission set. JSON: a canonical decimal string. SQLite: `i64` by bit-cast. Unknown bits are preserved by `Permissions::from_bits_retain` (permissions the protocol) and must be masked with `Permissions::KNOWN` before they grant anything. ## Methods ### `empty` ```rust pub const fn empty() -> Self ``` Get a flags value with all bits unset. ### `all` ```rust pub const fn all() -> Self ``` Get a flags value with all known bits set. ### `bits` ```rust pub const fn bits(&self) -> u64 ``` Get the underlying bits value. The returned value is exactly the bits set in this flags value. ### `from_bits` ```rust pub const fn from_bits(bits: u64) -> Option ``` Convert from a bits value. This method will return `None` if any unknown bits are set. ### `from_bits_truncate` ```rust pub const fn from_bits_truncate(bits: u64) -> Self ``` Convert from a bits value, unsetting any unknown bits. ### `from_bits_retain` ```rust pub const fn from_bits_retain(bits: u64) -> Self ``` Convert from a bits value exactly. ### `from_name` ```rust pub fn from_name(name: &str) -> Option ``` Get a flags value with the bits of a flag with the given name set. This method will return `None` if `name` is empty or doesn't correspond to any named flag. ### `is_empty` ```rust pub const fn is_empty(&self) -> bool ``` Whether all bits in `self` are unset. ### `is_all` ```rust pub const fn is_all(&self) -> bool ``` Whether all known bits in this flags value are set. ### `intersects` ```rust pub const fn intersects(&self, other: Self) -> bool ``` Whether any set bits in `other` are also set in `self`. ### `contains` ```rust pub const fn contains(&self, other: Self) -> bool ``` Whether all set bits in `other` are also set in `self`. ### `insert` ```rust pub fn insert(&mut self, other: Self) ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `remove` ```rust pub fn remove(&mut self, other: Self) ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `remove` won't truncate `other`, but the `!` operator will. ### `toggle` ```rust pub fn toggle(&mut self, other: Self) ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `set` ```rust pub fn set(&mut self, other: Self, value: bool) ``` Call `insert` when `value` is `true` or `remove` when `value` is `false`. ### `intersection` ```rust pub const fn intersection(self, other: Self) -> Self ``` The bitwise and (`&`) of the bits in `self` and `other`. ### `union` ```rust pub const fn union(self, other: Self) -> Self ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `difference` ```rust pub const fn difference(self, other: Self) -> Self ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `difference` won't truncate `other`, but the `!` operator will. ### `symmetric_difference` ```rust pub const fn symmetric_difference(self, other: Self) -> Self ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `complement` ```rust pub const fn complement(self) -> Self ``` The bitwise negation (`!`) of the bits in `self`, truncating the result. ### `iter` ```rust pub const fn iter(&self) -> Iter ``` Yield a set of contained flags values. Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value. ### `iter_names` ```rust pub const fn iter_names(&self) -> IterNames ``` Yield a set of contained named flags values. This method is like [`iter`](#method.iter), except only yields bits in contained named flags. Any unknown bits, or bits not corresponding to a contained flag will not be yielded. ### `to_i64` ```rust pub const fn to_i64(self) -> i64 ``` SQLite storage form (bit-cast, never compared numerically). ### `from_i64` ```rust pub const fn from_i64(value: i64) -> Self ``` From the SQLite storage form, retaining unknown bits. ## Trait implementations `Binary`, `BitAnd`, `BitAndAssign`, `BitOr`, `BitOrAssign`, `BitXor`, `BitXorAssign`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `Extend`, `Flags`, `FromIterator`, `Hash`, `IntoIterator`, `LowerHex`, `Not`, `Octal`, `PartialEq`, `PublicFlags`, `Serialize`, `StructuralPartialEq`, `Sub`, `SubAssign`, `UpperHex` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/bits/struct.Permissions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-cursor/ --- # Struct client::Cursor > One stream's position: the highest contiguous sequence applied, and events held aside. `zaun_community_protocol::client::Cursor` · Struct ```rust pub struct Cursor { … } ``` One stream's position: the highest contiguous sequence applied, and events held aside. ## Methods ### `applied` ```rust pub const fn applied(&self) -> u64 ``` The highest contiguous sequence applied. ### `held` ```rust pub fn held(&self) -> usize ``` Events held aside behind a gap. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/cursors/cursor/struct.Cursor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-cursortable/ --- # Struct client::CursorTable > The member cursor and one cursor per channel. `zaun_community_protocol::client::CursorTable` · Struct ```rust pub struct CursorTable { … } ``` The member cursor and one cursor per channel. SPEC: the protocol does not say where a channel's cursor starts when the client has none (a new channel, or one it never listed). It starts at 0, so a first event above 1 is a gap and `sync.resume` reports the channel's floor, which then raises the cursor. ## Methods ### `resume_bodies` ```rust pub fn resume_bodies(&self) -> Vec ``` `sync.resume` bodies for every tracked stream, at most 100 channels each. ### `member` ```rust pub const fn member(&self) -> u64 ``` The member-stream cursor. ### `channel` ```rust pub fn channel(&self, id: &ChannelId) -> Option ``` A channel's cursor, if tracked. ### `set_member` ```rust pub fn set_member(&mut self, seq: u64) ``` Sets the member cursor exactly (after a snapshot, the protocol), dropping held events. ### `set_channel` ```rust pub fn set_channel(&mut self, id: ChannelId, seq: u64) ``` Sets a channel cursor exactly (after paging history), dropping held events. ### `remove_channel` ```rust pub fn remove_channel(&mut self, id: &ChannelId) ``` Stops tracking a channel (lost access, `sync.resume.hidden`). ### `seed` ```rust pub fn seed(&mut self, cursors: &Cursors) ``` Raises cursors to the given ones (binding responses); never lowers them. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/cursors/struct.CursorTable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-gap/ --- # Struct client::Gap > A detected gap in a sequenced stream. `zaun_community_protocol::client::Gap` · Struct ```rust pub struct Gap { … } ``` A detected gap in a sequenced stream. ## Fields ### `stream: Stream` The stream. ### `channel_id: Option` The channel, for a channel stream. ### `expected: u64` The next sequence the client needs. ### `received: u64` The sequence that arrived. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/event/struct.Gap.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-member-invitepayload/ --- # Struct client::member::InvitePayload > The canonical `InvitePayload`. Unsigned: after connecting, the welcome must show a descriptor deriving `community_id`, a delegation naming `host_id`, and a host proof — which `Invi `zaun_community_protocol::client::member::InvitePayload` · Struct ```rust pub struct InvitePayload { … } ``` The canonical `InvitePayload`. Unsigned: after connecting, the welcome must show a descriptor deriving `community_id`, a delegation naming `host_id`, and a host proof — which `InvitePayload::session_config` makes the session check. `Debug` never shows the secret (`InviteSecret` is redacted); it is zeroized on drop. ## Fields ### `community_id: CommunityId` The community. ### `host_id: HostId` The host to connect to. ### `host_address: String` The host's SimpleX contact address, ≤ 2 048 bytes. ### `invite_secret: InviteSecret` The invitation secret. ### `expires_at: Option` Expiry, ms; none = never. ### `protocol_min: u16` Lowest protocol version of the community. ### `protocol_max: u16` Highest protocol version of the community. ## Methods ### `parse` ```rust pub fn parse(link: &str) -> Result ``` Parses a link strictly: prefix, canonical base64url, canonical payload, no trailing bytes. Decoded bytes are zeroized. # Errors `LinkError`, which never echoes the input. ### `to_link` ```rust pub fn to_link(&self) -> Result ``` Formats the link. The intermediate bytes are zeroized; the returned link is redacted in `Debug`. # Errors `LinkError::Field` for an empty or oversized address or a bad version range. ### `is_expired` ```rust pub fn is_expired(&self, now_ms: u64) -> bool ``` Whether the invitation has expired at `now_ms`. ### `supports` ```rust pub const fn supports(&self, ours: VersionRange) -> bool ``` Whether the community's version range overlaps `ours`. ### `session_config` ```rust pub fn session_config(&self) -> SessionConfig ``` A session configuration that pins the link's host and community. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/link/struct.InvitePayload.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-member-moved/ --- # Struct client::member::Moved > A verified move: the new pair (store its state) and how to reach the new host. `zaun_community_protocol::client::member::Moved` · Struct ```rust pub struct Moved { … } ``` A verified move: the new pair (store its state) and how to reach the new host. ## Fields ### `pair: ValidPair` The verified descriptor and delegation; `ValidPair::state` is the state to store. ### `host_id: HostId` The new host. ### `host_public_key: PublicKey` Its key: the welcome's `host_public_key` must equal it. ### `host_addresses: Vec` Its SimpleX addresses, signed by the root key. ### `delegation_epoch: u64` The new delegation's epoch. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/moved/struct.Moved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-member-reauthtarget/ --- # Struct client::member::ReauthTarget > Where a member re-authenticates: the community, the new host, the delegation epoch its verified welcome proved, and that welcome's challenge. `zaun_community_protocol::client::member::ReauthTarget` · Struct ```rust pub struct ReauthTarget { … } ``` Where a member re-authenticates: the community, the new host, the delegation epoch its verified welcome proved, and that welcome's challenge. ## Fields ### `community_id: CommunityId` The community. ### `host_id: HostId` The new host. ### `delegation_epoch: u64` The epoch of the delegation that names the new host. ### `host_challenge: Challenge` `host_challenge` from this connection's latest verified welcome. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/moved/struct.ReauthTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-member-registrationtarget/ --- # Struct client::member::RegistrationTarget > Where a registration is made: the community, the host and the welcome's challenge. `zaun_community_protocol::client::member::RegistrationTarget` · Struct ```rust pub struct RegistrationTarget { … } ``` Where a registration is made: the community, the host and the welcome's challenge. ## Fields ### `community_id: CommunityId` The community. ### `host_id: HostId` The host the registration is made to. ### `host_challenge: Challenge` `host_challenge` from this connection's latest verified welcome. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/member/struct.RegistrationTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-owner-descriptorcontent/ --- # Struct client::owner::DescriptorContent > The owner-editable, public fields of a descriptor. `zaun_community_protocol::client::owner::DescriptorContent` · Struct ```rust pub struct DescriptorContent { … } ``` The owner-editable, public fields of a descriptor. ## Fields ### `name: String` 2–100 scalars. ### `description: Option` ≤ 1 000 scalars. ### `icon: Option<[u8; 32]>` `SHA3-256` of the icon bytes. ### `languages: Vec` ≤ 8 BCP 47 tags. ### `categories: Vec` ≤ 8 topic tags. ### `rules: Vec` ≤ 20 rules. ### `moderation_policy: Option` ≤ 4 000 scalars. ### `operator_contact: Option` ≤ 256 scalars. ### `abuse_contact: Option` ≤ 256 scalars. ### `admission_summary: AdmissionSummary` The public admission claim. ### `discovery: Discovery` Private, unlisted or listed. ## Methods ### `new` ```rust pub fn new>(name: impl Into) -> Self ``` A private, invitation-only community named `name` with nothing else set. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/content/struct.DescriptorContent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-owner-genesis/ --- # Struct client::owner::Genesis > A signed genesis descriptor (revision 1) and the delegation it references (epoch 1). `zaun_community_protocol::client::owner::Genesis` · Struct ```rust pub struct Genesis { … } ``` A signed genesis descriptor (revision 1) and the delegation it references (epoch 1). ## Fields ### `descriptor: Signed` Signed by the root key. ### `delegation: Signed` Signed by the root key. ## Methods ### `community_id` ```rust pub fn community_id(&self) -> CommunityId ``` The new community's id (derived from the genesis root key). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/genesis/struct.Genesis.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-owner-hostinfo/ --- # Struct client::owner::HostInfo > What an owner needs about a host to delegate to it. `zaun_community_protocol::client::owner::HostInfo` · Struct ```rust pub struct HostInfo { … } ``` What an owner needs about a host to delegate to it. ## Fields ### `public_key: PublicKey` The host key. ### `addresses: Vec` 1–4 SimpleX contact addresses of the host. ## Methods ### `new` ```rust pub const fn new(public_key: PublicKey, addresses: Vec) -> Self ``` Wraps a host key and addresses known to be authentic. ### `from_advertised` ```rust pub fn from_advertised(host_id: HostId, public_key: PublicKey, addresses: Vec) -> Result ``` From the host's advertised `HostId`, key and addresses: the key must derive the id. # Errors `BuildError::HostId` when it does not. ### `host_id` ```rust pub fn host_id(&self) -> HostId ``` The host's id. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/owner/struct.HostInfo.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-receivedevent/ --- # Struct client::ReceivedEvent > A received event: the envelope (sequence, timestamp, actor) and its decoded body. `zaun_community_protocol::client::ReceivedEvent` · Struct ```rust pub struct ReceivedEvent { … } ``` A received event: the envelope (sequence, timestamp, actor) and its decoded body. ## Fields ### `envelope: EventEnvelope` The validated envelope. ### `event: Event` The decoded body. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/event/struct.ReceivedEvent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-response/ --- # Struct client::Response > A final response. `Debug` hides the body, which may embed a secret (an invitation link). `zaun_community_protocol::client::Response` · Struct ```rust pub struct Response { … } ``` A final response. `Debug` hides the body, which may embed a secret (an invitation link). ## Fields ### `request_id: RequestId` The request it answers. ### `kind: &'static str` The command name. ### `result: Result, ErrorBody>` The `ok` body exactly as received, or the error. ## Methods ### `decode` ```rust pub fn decode(&self) -> Result<::Response, Option> ``` Decodes a successful body as `B`'s response type. # Errors `Err(Some(error))` for an error response, `Err(None)` for a body that is not a `B` response. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/event/struct.Response.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-retrypolicy/ --- # Struct client::RetryPolicy > Exponential backoff: `initial_ms`, then ×`factor`, capped at `cap_ms`; give up once `give_up_ms` have passed since the first send. `zaun_community_protocol::client::RetryPolicy` · Struct ```rust pub struct RetryPolicy { … } ``` Exponential backoff: `initial_ms`, then ×`factor`, capped at `cap_ms`; give up once `give_up_ms` have passed since the first send. A resend also waits until the host has been silent for `initial_ms` (at most `cap_ms` longer): while its messages are still arriving, the answer is most likely among them. ## Fields ### `initial_ms: u64` Delay before the first retry. ### `factor: u64` Multiplier per attempt. ### `cap_ms: u64` Largest delay. ### `give_up_ms: u64` Total time after which a request is abandoned. ## Methods ### `delay` ```rust pub fn delay(&self, attempt: u32) -> u64 ``` The delay after send number `attempt` (1 = the first send): 5 s, 10 s, 20 s, 40 s, then 60 s. ### `refused_delay` ```rust pub fn refused_delay(&self, attempt: u32) -> u64 ``` The delay after a transient error on send number `attempt`: 2 s, 4 s, 8 s, … 60 s, never longer than `RetryPolicy::delay`. ### `next_at` ```rust pub fn next_at(&self, now_ms: u64, attempt: u32, error: Option<&ErrorBody>) -> u64 ``` The next send time after send number `attempt` at `now_ms`: the backoff, or after a transient `error` its `RetryPolicy::refused_delay` or, if later, its `retry_after_ms`. ### `resend_now` ```rust pub const fn resend_now(&self, due_ms: u64, heard_ms: Option, now_ms: u64) -> bool ``` Whether a resend due at `due_ms` goes out at `now_ms`, the host last heard at `heard_ms`: once the host has been silent for `initial_ms`, or `cap_ms` after it was due, whatever the host is sending. ### `expired` ```rust pub const fn expired(&self, first_ms: u64, now_ms: u64) -> bool ``` Whether a request first sent at `first_ms` is abandoned at `now_ms`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/retry/struct.RetryPolicy.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-session/ --- # Struct client::Session > A sans-IO client session. See the module documentation. `zaun_community_protocol::client::Session` · Struct ```rust pub struct Session { … } ``` A sans-IO client session. See the module documentation. ## Methods ### `hello` ```rust pub fn hello(&mut self, now_ms: u64) -> Result ``` Sends `session.hello` with a fresh nonce. Call it first, and again after every reconnect; commands then wait for the new welcome and are resent after it. SPEC: `community_id` is "unbound only"; it is sent when the session has no binding and is `null` otherwise. # Errors `ClientError::Failed` after a failed welcome, `ClientError::Rng` or a framing error. ### `send` ```rust pub fn send(&mut self, body: &B, community: Option, channel: Option, now_ms: u64) -> Result ``` Sends a command and tracks it for retries with the same `request_id` and byte-identical body. The body is validated first. # Errors `ClientError::NotReady` before a verified welcome, `ClientError::Failed` after a failed one, `ClientError::WrongCommunity`, `ClientError::WrongKind` for a signal, or a body, size, framing or RNG error. ### `send_behind_hello` ```rust pub fn send_behind_hello(&mut self, body: &B, now_ms: u64) -> Result ``` Sends a read-only sync command (`sync.snapshot`, `sync.resume`, `sync.events`) right behind the hello of a bound session, without waiting for the welcome: the host runs the connection's commands in order, so it answers after the welcome. The answer is reported only once the welcome verified. After the welcome this is `Session::send`. # Errors As `Session::send`; `ClientError::NotReady` for another command, or before a hello or without a binding. ### `send_signal` ```rust pub fn send_signal(&mut self, body: &B, community: Option, channel: Option) -> Result<(), ClientError> ``` Sends an ephemeral signal (`signal.*`): `request_id: null`, no response, no retry. # Errors As `Session::send`; `ClientError::WrongKind` for a non-signal body. ### `resume_request` ```rust pub fn resume_request(&mut self, now_ms: u64) -> Result, ClientError> ``` Sends `sync.resume` for every tracked stream, in chunks of 100 channels. Call it after the welcome of a reconnect. # Errors As `Session::send`. ### `send_command` ```rust pub fn send_command(&mut self, command: &Command, community: Option, channel: Option, now_ms: u64) -> Result, ClientError> ``` Sends a command known only at run time (a bot's, an application's raw command): `Session::send`, or `Session::send_signal` for a `signal.*` (no request id). # Errors As `Session::send`. ### `receive` ```rust pub fn receive(&mut self, text: &str, now_ms: u64) -> Vec ``` Processes one received transport text at `now_ms`: reassembles fragments, parses the envelope, correlates responses, orders events by their stream cursors, and queues any `sync.resume` (after a gap) or `sync.ack` that became due. Events are only applied on a verified session; before the welcome (or after a failed one) they are dropped and the resume after the welcome recovers them. SPEC: the protocol acks what the client has "durably applied". An ack queued here covers the events returned by this call, so the caller must apply (persist) them before sending the texts it drains next. ### `poll_timeouts` ```rust pub fn poll_timeouts(&mut self, now_ms: u64) -> Vec ``` Drives timers at `now_ms`: discards stale fragment reassemblies, resends due requests with the same text (commands only once the welcome is verified), abandons requests after the give-up time, and queues a `sync.ack` when 30 s passed with unacked frames or when a refused ack's retry time has come. ### `new` ```rust pub fn new(config: SessionConfig) -> Self ``` A session that has sent nothing yet; call `Session::hello` first. ### `state` ```rust pub const fn state(&self) -> &SessionState ``` The lifecycle state. ### `welcome` ```rust pub const fn welcome(&self) -> Option<&VerifiedWelcome> ``` The verified welcome of the current hello. ### `community` ```rust pub fn community(&self) -> Option<&ValidPair> ``` The verified descriptor and delegation; persist its `state()`. ### `hold_pair` ```rust pub fn hold_pair(&mut self, pair: (SignedJson, SignedJson)) ``` Holds `pair` (a verified signed descriptor and delegation) for this connection's community: the next hello names it, so its welcome may leave it out. For a creator, whose welcome carried no pair. ### `binding` ```rust pub const fn binding(&self) -> Option ``` The connection's binding, from the welcome or a successful create/redeem/request. ### `negotiated_version` ```rust pub fn negotiated_version(&self) -> Option ``` The negotiated protocol version. ### `host_challenge` ```rust pub fn host_challenge(&self) -> Option ``` The challenge to sign into a `MemberKeyRegistration`. ### `cursors` ```rust pub const fn cursors(&self) -> &CursorTable ``` The stream cursors. ### `cursors_mut` ```rust pub const fn cursors_mut(&mut self) -> &mut CursorTable ``` The stream cursors, for seeding after a snapshot or history paging. ### `pending_count` ```rust pub fn pending_count(&self) -> usize ``` Unanswered requests (hello and commands). ### `poll_transmit` ```rust pub fn poll_transmit(&mut self) -> Option ``` The next transport text to send, in order. ### `drain_transmit` ```rust pub fn drain_transmit(&mut self) -> Vec ``` Every queued transport text, in order. ## Trait implementations `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/session/struct.Session.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-sessionconfig/ --- # Struct client::SessionConfig > Everything a `super::Session` needs besides the transport. `zaun_community_protocol::client::SessionConfig` · Struct ```rust pub struct SessionConfig { … } ``` Everything a `super::Session` needs besides the transport. ## Fields ### `host: ExpectedHost` The host the welcome must come from. ### `community_id: Option` The community the host must prove (invitation target, or the bound community). `None` only for an unbound connection with no target (before `community.create`). ### `binding: Option` The connection's binding from an earlier session, if any (restart persistence). ### `accepted: Option` The caller's stored anti-rollback state for the community. ### `rotations: Vec` The full rotation chain from the genesis key, if the caller has it. ### `held_pair: Option<(SignedJson, SignedJson)>` The signed descriptor and delegation of the community, as verified before (a stored `crate::signed::ValidPair`): the hello names it and the host may leave it out of the welcome; it is then verified again as if the host had sent it. ### `versions: VersionRange` The versions offered in `session.hello`. ### `capabilities: Vec` The capabilities offered in `session.hello`. ### `text_budget: usize` Per-message text budget for framing, from the transport adapter. ### `retry: RetryPolicy` Retry schedule. ### `ack_every_frames: u32` Ack after this many received frames. ### `ack_every_ms: u64` Ack after this long while frames arrive. ## Methods ### `new` ```rust pub fn new(host: ExpectedHost, community_id: Option) -> Self ``` Defaults for `host` and `community_id`: version 1, `frag`, the the protocol schedule and the the protocol ack cadence (8 frames / 30 s). ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/config/struct.SessionConfig.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-client-verifiedwelcome/ --- # Struct client::VerifiedWelcome > A welcome that passed every check. Everything in it comes from verified signed objects or was compared with them. `zaun_community_protocol::client::VerifiedWelcome` · Struct ```rust pub struct VerifiedWelcome { … } ``` A welcome that passed every check. Everything in it comes from verified signed objects or was compared with them. ## Fields ### `version: u16` The negotiated version. ### `host_id: HostId` The host's id (derives from `host_public_key`). ### `host_public_key: PublicKey` The host's key, as pinned by the configuration. ### `host_challenge: Challenge` The challenge to sign into a `MemberKeyRegistration`, from the decoded proof. ### `capabilities: Vec` Capabilities both sides support. ### `limits: Map` Effective limits; the keys are not defined by the specification. ### `binding: Option` The connection's binding, if bound. ### `community: Option` The verified descriptor and delegation, when a community was named. Persist `ValidPair::state` for anti-rollback. ### `attachments: Option` What the host accepts as attachments; `None` when it takes none. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/client/welcome/struct.VerifiedWelcome.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-app-commands/ --- # Struct command::app::Commands > Response of both: commands with ids (and `bot_id` in `command.list`). `zaun_community_protocol::command::app::Commands` · Struct ```rust pub struct Commands { … } ``` Response of both: commands with ids (and `bot_id` in `command.list`). ## Fields ### `commands: Vec` The commands. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/app/struct.Commands.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-app-list/ --- # Struct command::app::List > `command.list`. `zaun_community_protocol::command::app::List` · Struct ```rust pub struct List { … } ``` `command.list`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/app/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-app-set/ --- # Struct command::app::Set > `command.set`: a bot replaces its whole command list. `zaun_community_protocol::command::app::Set` · Struct ```rust pub struct Set { … } ``` `command.set`: a bot replaces its whole command list. ## Fields ### `commands: Vec` Without ids; names keep their `command_id`. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/app/struct.Set.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-attachment-download/ --- # Struct command::attachment::Download > `attachment.download`: asks the host to send an attachment's file. `zaun_community_protocol::command::attachment::Download` · Struct ```rust pub struct Download { … } ``` `attachment.download`: asks the host to send an attachment's file. ## Fields ### `attachment_id: AttachmentId` An attachment of a message in the envelope's channel. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/attachment/struct.Download.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-attachment-upload/ --- # Struct command::attachment::Upload > `attachment.upload`: declares a file the member is about to send. `zaun_community_protocol::command::attachment::Upload` · Struct ```rust pub struct Upload { … } ``` `attachment.upload`: declares a file the member is about to send. ## Fields ### `name: String` The file name shown to readers: 1–255 scalars, no path separator or control character. ### `size: u64` Exact size in bytes, 1 to the host's limit (at most 1 GiB). ### `mime: String` The media type, such as `image/png` (`type/subtype`, ASCII, at most 127 bytes). ### `sha3_256: Vec` SHA3-256 of the bytes, base64url. The host refuses a file that does not match. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/attachment/struct.Upload.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-attachment-uploading/ --- # Struct command::attachment::Uploading > `attachment.upload` response. `zaun_community_protocol::command::attachment::Uploading` · Struct ```rust pub struct Uploading { … } ``` `attachment.upload` response. ## Fields ### `attachment_id: AttachmentId` Host-assigned id; the file's caption names it (`caption`). ### `expires_at: u64` When the host stops waiting for the file, ms. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/attachment/struct.Uploading.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-audit-list/ --- # Struct command::audit::List > `audit.list`. `zaun_community_protocol::command::audit::List` · Struct ```rust pub struct List { … } ``` `audit.list`. ## Fields ### `before: Option` Only entries older than this one. ### `limit: u32` 1–100. ### `action: Option` Only this action; one of `AUDIT_ACTIONS`. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/audit/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-audit-page/ --- # Struct command::audit::Page > `audit.list` response. `zaun_community_protocol::command::audit::Page` · Struct ```rust pub struct Page { … } ``` `audit.list` response. ## Fields ### `entries: Vec` Newest first. ### `has_more: bool` Older entries exist. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/audit/struct.Page.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-bots/ --- # Struct command::bot::Bots > `bot.list` response. `zaun_community_protocol::command::bot::Bots` · Struct ```rust pub struct Bots { … } ``` `bot.list` response. ## Fields ### `bots: Vec` Every installed bot. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Bots.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-configure/ --- # Struct command::bot::Configure > `bot.configure`: the owner sets or clears values of the settings the bot's manifest declares. With neither, it only reads them. `zaun_community_protocol::command::bot::Configure` · Struct ```rust pub struct Configure { … } ``` `bot.configure`: the owner sets or clears values of the settings the bot's manifest declares. With neither, it only reads them. ## Fields ### `bot_id: BotId` The bot. ### `set: BTreeMap` Values to set, by key. ### `unset: Vec` Keys to clear (back to their default). ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Configure.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-configured/ --- # Struct command::bot::Configured > `bot.configure` response: the values the owner set, secrets shown as `"••••"`. `zaun_community_protocol::command::bot::Configured` · Struct ```rust pub struct Configured { … } ``` `bot.configure` response: the values the owner set, secrets shown as `"••••"`. ## Fields ### `values: BTreeMap` Key to value. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Configured.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-disable/ --- # Struct command::bot::Disable > `bot.disable`. `zaun_community_protocol::command::bot::Disable` · Struct ```rust pub struct Disable { … } ``` `bot.disable`. ## Fields ### `bot_id: BotId` The bot. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Disable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-enable/ --- # Struct command::bot::Enable > `bot.enable` (distinct type so the command table can name it). `zaun_community_protocol::command::bot::Enable` · Struct ```rust pub struct Enable { … } ``` `bot.enable` (distinct type so the command table can name it). ## Fields ### `bot_id: BotId` The bot. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Enable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-grant/ --- # Struct command::bot::Grant > `bot.grant`: the new effective grants, replacing the old. `zaun_community_protocol::command::bot::Grant` · Struct ```rust pub struct Grant { … } ``` `bot.grant`: the new effective grants, replacing the old. ## Fields ### `bot_id: BotId` The bot. ### `permissions: Option` Bits of the managed role. ### `capabilities: Option` Capabilities. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Grant.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-grantchoice/ --- # Struct command::bot::GrantChoice > Optional grant choices of `bot.install`: absent means everything the manifest asks for, within the operator's ceiling. `zaun_community_protocol::command::bot::GrantChoice` · Struct ```rust pub struct GrantChoice { … } ``` Optional grant choices of `bot.install`: absent means everything the manifest asks for, within the operator's ceiling. ## Fields ### `permissions: Option` Permission bits. ### `capabilities: Option` Capabilities. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.GrantChoice.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-install/ --- # Struct command::bot::Install > `bot.install`. `zaun_community_protocol::command::bot::Install` · Struct ```rust pub struct Install { … } ``` `bot.install`. ## Fields ### `package: AttachmentId` A stored attachment the owner uploaded, holding the `.zbot` package. ### `grants: Option` What to grant. ### `role_position: Option` Where the managed role goes (default: directly above `@everyone`). ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Install.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-list/ --- # Struct command::bot::List > `bot.list`. `zaun_community_protocol::command::bot::List` · Struct ```rust pub struct List { … } ``` `bot.list`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-register/ --- # Struct command::bot::Register > `bot.register`: mark an existing member as an external bot. `zaun_community_protocol::command::bot::Register` · Struct ```rust pub struct Register { … } ``` `bot.register`: mark an existing member as an external bot. ## Fields ### `member_id: MemberId` The member. ### `name: Option` The card's name (default: the member's display name). ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Register.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-remove/ --- # Struct command::bot::Remove > `bot.remove`. `zaun_community_protocol::command::bot::Remove` · Struct ```rust pub struct Remove { … } ``` `bot.remove`. ## Fields ### `bot_id: BotId` The bot. ### `delete_data: Option` Delete its storage and package too (default true). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Remove.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-target/ --- # Struct command::bot::Target > `bot.enable`, `bot.disable`, `bot.get`. `zaun_community_protocol::command::bot::Target` · Struct ```rust pub struct Target { … } ``` `bot.enable`, `bot.disable`, `bot.get`. ## Fields ### `bot_id: BotId` The bot. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Target.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-bot-update/ --- # Struct command::bot::Update > `bot.update`. `zaun_community_protocol::command::bot::Update` · Struct ```rust pub struct Update { … } ``` `bot.update`. ## Fields ### `bot_id: BotId` The bot. ### `package: AttachmentId` The new package. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/bot/struct.Update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-channel-create/ --- # Struct command::channel::Create > `channel.create`. `zaun_community_protocol::command::channel::Create` · Struct ```rust pub struct Create { … } ``` `channel.create`. SPEC: `history` and `sync_with_parent` are not create fields; they take their defaults and change through `channel.update`. ## Fields ### `kind: ChannelKind` v1: `category`, `text`, `announcement`, `voice`; others are `UNSUPPORTED_FEATURE`. ### `name: String` 1–100 scalars. ### `topic: Option` ≤ 1 024 scalars. ### `parent_id: Option` A category; categories have none. ### `position: Option` Position among siblings. ### `slowmode_s: Option` 0–21 600 s. ### `overrides: Option>` Initial overrides, checked like `channel.permissions.update`. ### `retention: Option` Retention. ### `typing: Option` Who sees typing; absent: `named`. ### `user_limit: Option` Voice channels only: the most participants, 1–99 (also capped by the host's `mesh_max`); absent = the host's cap. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/channel/struct.Create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-channel-delete/ --- # Struct command::channel::Delete > `channel.delete`. `zaun_community_protocol::command::channel::Delete` · Struct ```rust pub struct Delete { … } ``` `channel.delete`. ## Fields ### `channel_id: Option` The channel (or on the envelope). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/channel/struct.Delete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-channel-permissionsupdate/ --- # Struct command::channel::PermissionsUpdate > `channel.permissions.update`. `zaun_community_protocol::command::channel::PermissionsUpdate` · Struct ```rust pub struct PermissionsUpdate { … } ``` `channel.permissions.update`. ## Fields ### `channel_id: Option` The channel (or on the envelope). ### `set: Vec` Overrides to create or replace. ### `remove: Vec` Override targets to delete. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/channel/struct.PermissionsUpdate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-channel-reorder/ --- # Struct command::channel::Reorder > `channel.reorder`. `zaun_community_protocol::command::channel::Reorder` · Struct ```rust pub struct Reorder { … } ``` `channel.reorder`. ## Fields ### `positions: Vec` 1–500 entries, each channel at most once. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/channel/struct.Reorder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-channel-update/ --- # Struct command::channel::Update > `channel.update`: any of the fields; `null` clears only `topic` and `parent_id`. `zaun_community_protocol::command::channel::Update` · Struct ```rust pub struct Update { … } ``` `channel.update`: any of the fields; `null` clears only `topic` and `parent_id`. ## Fields ### `channel_id: Option` The channel (or on the envelope). ### `name: Patch` New name. ### `topic: Patch` New topic; `null` clears. ### `parent_id: Patch` New parent; `null` moves to the top level. ### `slowmode_s: Patch` New slowmode. ### `locked: Patch` Lock or unlock. ### `typing: Patch` Who sees typing: `named`, `anonymous` or `off`. ### `retention: Patch` New retention. ### `sync_with_parent: Patch` Re-link to or detach from the parent's overrides. ### `history: Patch` New history policy (increments `history_rev`). ### `public_distribution: Patch` Experimental (Appendix A); owner only. ### `user_limit: Patch` Voice channels only: new `user_limit` (1–99); `null` removes it. ## Trait implementations `Body`, `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/channel/struct.Update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-create/ --- # Struct command::community::Create > `community.create`. The envelope's `community_id` names the target. `zaun_community_protocol::command::community::Create` · Struct ```rust pub struct Create { … } ``` `community.create`. The envelope's `community_id` names the target. ## Fields ### `descriptor: SignedJson` Signed `CommunityDescriptor`, revision 1. ### `delegation: SignedJson` Signed `HostDelegation` naming this host. ### `member_public_key: PublicKey` The creator's member key; MUST equal the descriptor's `owner_member_key`. ### `registration: SignedJson` Signed `MemberKeyRegistration`, purpose 1. ### `profile: NewProfile` The creator's display profile. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-created/ --- # Struct command::community::Created > `community.create` response. `zaun_community_protocol::command::community::Created` · Struct ```rust pub struct Created { … } ``` `community.create` response. ## Fields ### `community_id: CommunityId` The community. ### `member_id: MemberId` The creator's member id. ### `cursors: Cursors` Initial cursors. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Created.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-descriptorpublish/ --- # Struct command::community::DescriptorPublish > `community.descriptor.publish`. Owner only; larger envelope limit. `zaun_community_protocol::command::community::DescriptorPublish` · Struct ```rust pub struct DescriptorPublish { … } ``` `community.descriptor.publish`. Owner only; larger envelope limit. ## Fields ### `descriptor: SignedJson` The new signed descriptor (revision > current). ### `delegation: Option` The new signed delegation; omitted (or `null`) when unchanged. ### `icon: Option>` The icon bytes, when the descriptor's icon hash changed. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.DescriptorPublish.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-get/ --- # Struct command::community::Get > `community.get` (`{}`). `zaun_community_protocol::command::community::Get` · Struct ```rust pub struct Get { … } ``` `community.get` (`{}`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Get.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-icon/ --- # Struct command::community::Icon > `community.icon.get` response; the client checks `SHA3-256(icon)` against the descriptor. `zaun_community_protocol::command::community::Icon` · Struct ```rust pub struct Icon { … } ``` `community.icon.get` response; the client checks `SHA3-256(icon)` against the descriptor. ## Fields ### `icon: Vec` PNG or WebP bytes, ≤ 49 152. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Icon.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-iconget/ --- # Struct command::community::IconGet > `community.icon.get` (`{}`). `zaun_community_protocol::command::community::IconGet` · Struct ```rust pub struct IconGet { … } ``` `community.icon.get` (`{}`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.IconGet.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-info/ --- # Struct command::community::Info > `community.get` response. `zaun_community_protocol::command::community::Info` · Struct ```rust pub struct Info { … } ``` `community.get` response. ## Fields ### `descriptor: SignedJson` Signed descriptor. ### `delegation: SignedJson` Signed delegation. ### `profile: CommunityProfile` Host-managed profile. ### `owner_id: MemberId` The owner's member id. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Info.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-leave/ --- # Struct command::community::Leave > `community.leave` (`{}`). The owner cannot leave (engine: `CONFLICT`). `zaun_community_protocol::command::community::Leave` · Struct ```rust pub struct Leave { … } ``` `community.leave` (`{}`). The owner cannot leave (engine: `CONFLICT`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Leave.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-profileresponse/ --- # Struct command::community::ProfileResponse > `community.update` response. `zaun_community_protocol::command::community::ProfileResponse` · Struct ```rust pub struct ProfileResponse { … } ``` `community.update` response. ## Fields ### `profile: CommunityProfile` The updated profile. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.ProfileResponse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-published/ --- # Struct command::community::Published > `community.descriptor.publish` response. `zaun_community_protocol::command::community::Published` · Struct ```rust pub struct Published { … } ``` `community.descriptor.publish` response. ## Fields ### `revision: u64` The accepted revision. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Published.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-rotationpage/ --- # Struct command::community::RotationPage > `community.rotations` response. `zaun_community_protocol::command::community::RotationPage` · Struct ```rust pub struct RotationPage { … } ``` `community.rotations` response. ## Fields ### `rotations: Vec` Signed rotations in chain order. ### `next: Option` The `after` for the next page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.RotationPage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-rotations/ --- # Struct command::community::Rotations > `community.rotations`. `zaun_community_protocol::command::community::Rotations` · Struct ```rust pub struct Rotations { … } ``` `community.rotations`. SPEC: `after` is written `u32` but `rotation_seq` is a `u64`; `u64` is accepted. ## Fields ### `after: Option` Return rotations with `rotation_seq` above this. ### `limit: u32` 1–4. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Rotations.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-community-update/ --- # Struct command::community::Update > `community.update`: host-managed profile fields only. `zaun_community_protocol::command::community::Update` · Struct ```rust pub struct Update { … } ``` `community.update`: host-managed profile fields only. ## Fields ### `system_channel_id: Patch` `null` clears. ### `default_slowmode_s: Patch` 0–21 600; not nullable. ## Trait implementations `Body`, `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/community/struct.Update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-channels/ --- # Struct command::dm::Channels > `dm.list` response: the actor's open DMs. `zaun_community_protocol::command::dm::Channels` · Struct ```rust pub struct Channels { … } ``` `dm.list` response: the actor's open DMs. ## Fields ### `channels: Vec` Channel objects of kind `dm`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.Channels.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-close/ --- # Struct command::dm::Close > `dm.close`: hides the DM for the actor. `zaun_community_protocol::command::dm::Close` · Struct ```rust pub struct Close { … } ``` `dm.close`: hides the DM for the actor. ## Fields ### `channel_id: ChannelId` The DM. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.Close.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-list/ --- # Struct command::dm::List > `dm.list`. `zaun_community_protocol::command::dm::List` · Struct ```rust pub struct List { … } ``` `dm.list`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-open/ --- # Struct command::dm::Open > `dm.open`: the DM with `member_id`, created when there is none (idempotent per pair). `zaun_community_protocol::command::dm::Open` · Struct ```rust pub struct Open { … } ``` `dm.open`: the DM with `member_id`, created when there is none (idempotent per pair). ## Fields ### `member_id: MemberId` The other participant: a member when a bot opens it, a bot when a member does. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.Open.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-settings/ --- # Struct command::dm::Settings > The member's settings (`member.settings.get` / `.update` response). `zaun_community_protocol::command::dm::Settings` · Struct ```rust pub struct Settings { … } ``` The member's settings (`member.settings.get` / `.update` response). ## Fields ### `dms_from_bots: bool` Whether bots may open DMs with this member (default true). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.Settings.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-settingsget/ --- # Struct command::dm::SettingsGet > `member.settings.get`. `zaun_community_protocol::command::dm::SettingsGet` · Struct ```rust pub struct SettingsGet { … } ``` `member.settings.get`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.SettingsGet.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-dm-settingsupdate/ --- # Struct command::dm::SettingsUpdate > `member.settings.update`: absent fields stay. `zaun_community_protocol::command::dm::SettingsUpdate` · Struct ```rust pub struct SettingsUpdate { … } ``` `member.settings.update`: absent fields stay. ## Fields ### `dms_from_bots: Option` Whether bots may open DMs with this member. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/dm/struct.SettingsUpdate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-create/ --- # Struct command::interaction::Create > `interaction.create`. `zaun_community_protocol::command::interaction::Create` · Struct ```rust pub struct Create { … } ``` `interaction.create`. ## Fields ### `kind: InteractionType` 2–5. ### `data: CreateData` By type. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.Create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-created/ --- # Struct command::interaction::Created > `interaction.create` response. `zaun_community_protocol::command::interaction::Created` · Struct ```rust pub struct Created { … } ``` `interaction.create` response. ## Fields ### `interaction_id: InteractionId` The new interaction. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.Created.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-followup/ --- # Struct command::interaction::Followup > `interaction.followup` and `interaction.original.edit`. `zaun_community_protocol::command::interaction::Followup` · Struct ```rust pub struct Followup { … } ``` `interaction.followup` and `interaction.original.edit`. ## Fields ### `interaction_id: InteractionId` The interaction. ### `body: MessageBody` The message. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.Followup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-originaldelete/ --- # Struct command::interaction::OriginalDelete > `interaction.original.delete`. `zaun_community_protocol::command::interaction::OriginalDelete` · Struct ```rust pub struct OriginalDelete { … } ``` `interaction.original.delete`. ## Fields ### `interaction_id: InteractionId` The interaction. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.OriginalDelete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-originaledit/ --- # Struct command::interaction::OriginalEdit > `interaction.original.edit`: absent fields stay unchanged. `zaun_community_protocol::command::interaction::OriginalEdit` · Struct ```rust pub struct OriginalEdit { … } ``` `interaction.original.edit`: absent fields stay unchanged. ## Fields ### `interaction_id: InteractionId` The interaction. ### `body: MessageBody` The changes. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.OriginalEdit.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-replied/ --- # Struct command::interaction::Replied > `interaction.respond` and `interaction.followup` response. `zaun_community_protocol::command::interaction::Replied` · Struct ```rust pub struct Replied { … } ``` `interaction.respond` and `interaction.followup` response. ## Fields ### `message_id: Option` The channel message created or edited; absent for ephemeral and invisible responses. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.Replied.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-interaction-respond/ --- # Struct command::interaction::Respond > `interaction.respond`. `zaun_community_protocol::command::interaction::Respond` · Struct ```rust pub struct Respond { … } ``` `interaction.respond`. ## Fields ### `interaction_id: InteractionId` The bot's own interaction. ### `kind: ResponseType` What to do. ### `data: ResponseData` By type. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/interaction/struct.Respond.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-admitted/ --- # Struct command::invite::Admitted > `invite.redeem` and `membership.request` response. `zaun_community_protocol::command::invite::Admitted` · Struct ```rust pub struct Admitted { … } ``` `invite.redeem` and `membership.request` response. ## Fields ### `community_id: CommunityId` The community the member joined or requested to join. ### `member_id: MemberId` The new member id. ### `state: MembershipState` `pending`, `probation` or `active`. ### `descriptor: Option` Signed descriptor; absent when it is the one the session's welcome gave or confirmed. ### `delegation: Option` Signed delegation; absent with the descriptor. ### `cursors: Cursors` Initial cursors. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Admitted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-create/ --- # Struct command::invite::Create > `invite.create`. `zaun_community_protocol::command::invite::Create` · Struct ```rust pub struct Create { … } ``` `invite.create`. ## Fields ### `channel_id: Option` The channel the invitation opens on. ### `max_uses: u32` 0 = unlimited, else ≤ 100 000. ### `expires_in_s: Option` Lifetime in seconds (1–2 592 000); `null` = never. Required. ### `default_role_ids: Option>` Roles applied when the member leaves `pending`; never `@everyone`. ### `requires_approval: Option` Joins through it start `pending`. ### `pre_approved: Option` Skip the approval queue (needs `APPROVE_MEMBERS`); conflicts with `requires_approval`. ### `sponsored: Option` Record the actor as sponsor. ### `admission_overrides: Option` Stricter-only admission settings. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-created/ --- # Struct command::invite::Created > `invite.create` response. `link` embeds the secret and is shown once. `zaun_community_protocol::command::invite::Created` · Struct ```rust pub struct Created { … } ``` `invite.create` response. `link` embeds the secret and is shown once. ## Fields ### `invite_id: InviteId` Public handle. ### `link: InviteLink` `zaun://join/…`; redacted in `Debug`. ### `expires_at: Option` Expiry, ms; none = never. ### `max_uses: u32` 0 = unlimited. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Created.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-list/ --- # Struct command::invite::List > `invite.list`. `zaun_community_protocol::command::invite::List` · Struct ```rust pub struct List { … } ``` `invite.list`. ## Fields ### `after: Option` Page start (exclusive). ### `limit: u32` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-page/ --- # Struct command::invite::Page > `invite.list` response. `zaun_community_protocol::command::invite::Page` · Struct ```rust pub struct Page { … } ``` `invite.list` response. ## Fields ### `invites: Vec` All invitations (`MANAGE_INVITES`) or the caller's own. ### `next: Option` The `after` of the next page; absent on the last page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Page.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-redeem/ --- # Struct command::invite::Redeem > `invite.redeem`. Unbound; the envelope's `community_id` names the target. `zaun_community_protocol::command::invite::Redeem` · Struct ```rust pub struct Redeem { … } ``` `invite.redeem`. Unbound; the envelope's `community_id` names the target. ## Fields ### `invite_secret: InviteSecret` The secret from the link; redacted in `Debug`. ### `member_public_key: PublicKey` The joining member's key. ### `registration: SignedJson` Signed `MemberKeyRegistration`, purpose 2. ### `profile: NewProfile` The joining member's display profile. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Redeem.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-revoke/ --- # Struct command::invite::Revoke > `invite.revoke`. `zaun_community_protocol::command::invite::Revoke` · Struct ```rust pub struct Revoke { … } ``` `invite.revoke`. ## Fields ### `invite_id: InviteId` The invitation. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Revoke.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-usepage/ --- # Struct command::invite::UsePage > `invite.uses` response. `zaun_community_protocol::command::invite::UsePage` · Struct ```rust pub struct UsePage { … } ``` `invite.uses` response. ## Fields ### `members: Vec` Members admitted through the invitation. ### `next: Option` The `after` of the next page; absent on the last page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.UsePage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-invite-uses/ --- # Struct command::invite::Uses > `invite.uses`. Page size 1–100. `zaun_community_protocol::command::invite::Uses` · Struct ```rust pub struct Uses { … } ``` `invite.uses`. Page size 1–100. ## Fields ### `invite_id: InviteId` The invitation. ### `after: Option` Page start (exclusive). ### `limit: u32` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/invite/struct.Uses.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-disable/ --- # Struct command::lockdown::Disable > `moderation.lockdown.disable` (`{}`). `zaun_community_protocol::command::lockdown::Disable` · Struct ```rust pub struct Disable { … } ``` `moderation.lockdown.disable` (`{}`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/lockdown/struct.Disable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-enable/ --- # Struct command::lockdown::Enable > `moderation.lockdown.enable`; responds with the full `Lockdown`. `zaun_community_protocol::command::lockdown::Enable` · Struct ```rust pub struct Enable { … } ``` `moderation.lockdown.enable`; responds with the full `Lockdown`. ## Fields ### `restrictions: Vec` ≥ 1, each once. ### `expires_in_s: u64` 60 – 604 800 s. Required. ### `forced_slowmode_s: Option` ≤ 21 600 s. ### `newcomer_window_s: Option` 1 s – 30 days; only with `restrict_newcomers`. ### `reason: Option` ≤ 512 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/lockdown/struct.Enable.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-get/ --- # Struct command::lockdown::Get > `moderation.lockdown.get` (`{}`). `zaun_community_protocol::command::lockdown::Get` · Struct ```rust pub struct Get { … } ``` `moderation.lockdown.get` (`{}`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/lockdown/struct.Get.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-lockdown-getresponse/ --- # Struct command::lockdown::GetResponse > `moderation.lockdown.get` response: `{ "lockdown": object | null }`, the full form for `MANAGE_SAFETY` holders, otherwise the public form; `null` when none is active. `zaun_community_protocol::command::lockdown::GetResponse` · Struct ```rust pub struct GetResponse { … } ``` `moderation.lockdown.get` response: `{ "lockdown": object | null }`, the full form for `MANAGE_SAFETY` holders, otherwise the public form; `null` when none is active. ## Fields ### `lockdown: Option` The lockdown as the caller may see it; `null` when none is active. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/lockdown/struct.GetResponse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-banmember/ --- # Struct command::member::BanMember > `member.ban`. `zaun_community_protocol::command::member::BanMember` · Struct ```rust pub struct BanMember { … } ``` `member.ban`. ## Fields ### `member_id: MemberId` The member. ### `reason: Option` ≤ 512 scalars. ### `delete_messages_s: u64` Delete the member's messages from this many seconds back, 0–604 800. ### `revoke_invites: bool` Revoke the member's unexpired invitations (default true). ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.BanMember.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-banned/ --- # Struct command::member::Banned > `member.ban` response. `zaun_community_protocol::command::member::Banned` · Struct ```rust pub struct Banned { … } ``` `member.ban` response. ## Fields ### `ban_id: BanId` The ban record. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Banned.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-banpage/ --- # Struct command::member::BanPage > `member.bans` response. `zaun_community_protocol::command::member::BanPage` · Struct ```rust pub struct BanPage { … } ``` `member.bans` response. ## Fields ### `bans: Vec` Ban records. ### `next: Option` The `after` of the next page; absent on the last page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.BanPage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-bans/ --- # Struct command::member::Bans > `member.bans`. `zaun_community_protocol::command::member::Bans` · Struct ```rust pub struct Bans { … } ``` `member.bans`. ## Fields ### `after: Option` Page start (exclusive). ### `limit: u32` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Bans.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-get/ --- # Struct command::member::Get > `member.get`. `zaun_community_protocol::command::member::Get` · Struct ```rust pub struct Get { … } ``` `member.get`. ## Fields ### `member_id: MemberId` The member. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Get.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-kick/ --- # Struct command::member::Kick > `member.kick`. `zaun_community_protocol::command::member::Kick` · Struct ```rust pub struct Kick { … } ``` `member.kick`. ## Fields ### `member_id: MemberId` The member. ### `reason: Option` ≤ 512 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Kick.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-list/ --- # Struct command::member::List > `member.list`. `zaun_community_protocol::command::member::List` · Struct ```rust pub struct List { … } ``` `member.list`. ## Fields ### `after: Option` Page start (exclusive). ### `limit: u32` 1–200. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-page/ --- # Struct command::member::Page > `member.list` response. `zaun_community_protocol::command::member::Page` · Struct ```rust pub struct Page { … } ``` `member.list` response. ## Fields ### `members: Vec` Members visible to the viewer. ### `next: Option` The `after` of the next page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Page.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-rolesupdate/ --- # Struct command::member::RolesUpdate > `member.roles.update`. `zaun_community_protocol::command::member::RolesUpdate` · Struct ```rust pub struct RolesUpdate { … } ``` `member.roles.update`. ## Fields ### `member_id: MemberId` The member. ### `add: Vec` Roles to assign; never `@everyone`. ### `remove: Vec` Roles to remove; never `@everyone`. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.RolesUpdate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-timeout/ --- # Struct command::member::Timeout > `member.timeout`. `until` is absolute; the 28-day bound needs the host clock, so it is checked by `Command::validate_at`. `zaun_community_protocol::command::member::Timeout` · Struct ```rust pub struct Timeout { … } ``` `member.timeout`. `until` is absolute; the 28-day bound needs the host clock, so it is checked by `Command::validate_at`. ## Fields ### `member_id: MemberId` The member. ### `until: Option` End of the timeout, ms; `null` clears. Required. ### `reason: Option` ≤ 512 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Timeout.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-unban/ --- # Struct command::member::Unban > `member.unban`. `zaun_community_protocol::command::member::Unban` · Struct ```rust pub struct Unban { … } ``` `member.unban`. ## Fields ### `ban_id: BanId` The ban record. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Unban.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-member-update/ --- # Struct command::member::Update > `member.update`: a display-name change. `zaun_community_protocol::command::member::Update` · Struct ```rust pub struct Update { … } ``` `member.update`: a display-name change. ## Fields ### `member_id: MemberId` The member (self or another). ### `display_name: String` 1–32 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/member/struct.Update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-approve/ --- # Struct command::membership::Approve > `membership.approve`. `zaun_community_protocol::command::membership::Approve` · Struct ```rust pub struct Approve { … } ``` `membership.approve`. ## Fields ### `member_id: MemberId` A `pending` or `probation` member. ### `skip_probation: Option` From `pending` straight to `active`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.Approve.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-pending/ --- # Struct command::membership::Pending > `membership.pending`. `zaun_community_protocol::command::membership::Pending` · Struct ```rust pub struct Pending { … } ``` `membership.pending`. ## Fields ### `after: Option` Page start (exclusive). ### `limit: u32` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.Pending.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-pendingpage/ --- # Struct command::membership::PendingPage > `membership.pending` response. `zaun_community_protocol::command::membership::PendingPage` · Struct ```rust pub struct PendingPage { … } ``` `membership.pending` response. ## Fields ### `members: Vec` Pending members with `note` and `admission`. ### `next: Option` The `after` of the next page; absent on the last page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.PendingPage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyget/ --- # Struct command::membership::PolicyGet > `admission.policy.get` (`{}`). `zaun_community_protocol::command::membership::PolicyGet` · Struct ```rust pub struct PolicyGet { … } ``` `admission.policy.get` (`{}`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/policy/struct.PolicyGet.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyresponse/ --- # Struct command::membership::PolicyResponse > `admission.policy.get` response: `policy` (full, `MANAGE_SAFETY`) or `summary`. `zaun_community_protocol::command::membership::PolicyResponse` · Struct ```rust pub struct PolicyResponse { … } ``` `admission.policy.get` response: `policy` (full, `MANAGE_SAFETY`) or `summary`. SPEC: written "`policy` (full) or `summary`"; read as an object with exactly one of the two keys. ## Fields ### `policy: Option` The full policy. ### `summary: Option` The public summary. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/policy/struct.PolicyResponse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyupdate/ --- # Struct command::membership::PolicyUpdate > `admission.policy.update`: any policy field. Every field is non-nullable. `zaun_community_protocol::command::membership::PolicyUpdate` · Struct ```rust pub struct PolicyUpdate { … } ``` `admission.policy.update`: any policy field. Every field is non-nullable. ## Fields ### `level: Patch` A preset (fills the other fields) or `custom`. ### `requires_approval: Patch` Joins start `pending`. ### `waiting_period_s: Patch` s. ### `probation_period_s: Patch` s. ### `probation_activity_min: Patch` Messages or reactions during probation. ### `newcomer_restrictions: Patch` Known bits; never `VIEW_CHANNEL`/`READ_MESSAGE_HISTORY`. ### `join_rate: Patch` Aggregate admission rate. ### `pending_expiry_s: Patch` 1 s – 30 days. ### `invite_creation: Patch` Who may create invitations. ### `verification: Patch>` Reserved; MUST be empty in v1. ## Trait implementations `Body`, `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/policy/struct.PolicyUpdate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-policyupdated/ --- # Struct command::membership::PolicyUpdated > `admission.policy.update` response. `zaun_community_protocol::command::membership::PolicyUpdated` · Struct ```rust pub struct PolicyUpdated { … } ``` `admission.policy.update` response. ## Fields ### `policy: AdmissionPolicy` The policy now in force. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/policy/struct.PolicyUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-reject/ --- # Struct command::membership::Reject > `membership.reject`. `zaun_community_protocol::command::membership::Reject` · Struct ```rust pub struct Reject { … } ``` `membership.reject`. ## Fields ### `member_id: MemberId` A `pending` member. ### `reason: Option` ≤ 512 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.Reject.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-request/ --- # Struct command::membership::Request > `membership.request`. Unbound; responds with `super::invite::Admitted`. The target community is the envelope's `community_id`, as for `invite.redeem`. `zaun_community_protocol::command::membership::Request` · Struct ```rust pub struct Request { … } ``` `membership.request`. Unbound; responds with `super::invite::Admitted`. The target community is the envelope's `community_id`, as for `invite.redeem`. ## Fields ### `member_public_key: PublicKey` The requesting member's key. ### `registration: SignedJson` Signed `MemberKeyRegistration`, purpose 3. ### `profile: NewProfile` The requesting member's display profile. ### `note: Option` ≤ 500 scalars, shown to approvers. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.Request.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-restore/ --- # Struct command::membership::Restore > `membership.restore`. `zaun_community_protocol::command::membership::Restore` · Struct ```rust pub struct Restore { … } ``` `membership.restore`. ## Fields ### `member_id: MemberId` A `suspended` member. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.Restore.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-membership-suspend/ --- # Struct command::membership::Suspend > `membership.suspend`. `until` is absolute; the 90-day bound is checked by `Command::validate_at`. `zaun_community_protocol::command::membership::Suspend` · Struct ```rust pub struct Suspend { … } ``` `membership.suspend`. `until` is absolute; the 90-day bound is checked by `Command::validate_at`. ## Fields ### `member_id: MemberId` A `probation` or `active` member. ### `until: Option` End of the suspension, ms; absent or `null` = until restored. ### `reason: Option` ≤ 512 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/membership/struct.Suspend.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-delete/ --- # Struct command::message::Delete > `message.delete`. `zaun_community_protocol::command::message::Delete` · Struct ```rust pub struct Delete { … } ``` `message.delete`. ## Fields ### `message_id: MessageId` The message. ### `reason: Option` ≤ 512 scalars (audited when a moderator deletes). ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.Delete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-edit/ --- # Struct command::message::Edit > `message.edit`. Author only. `zaun_community_protocol::command::message::Edit` · Struct ```rust pub struct Edit { … } ``` `message.edit`. Author only. ## Fields ### `message_id: MessageId` The message. ### `content: String` ≤ 4 000 scalars; the edited message must still have content, an attachment or an embed. ### `embeds: Option>` The message's new embeds (`EMBED_LINKS` unless empty): absent leaves them unchanged, `[]` removes them all. Their pictures must be attachments already on the message. ### `components: Option>` New components (bots only): absent leaves them unchanged, `[]` removes them. ### `mentions: Option` Who the edited message mentions, by `message.send`'s rules: absent leaves the mentions unchanged, otherwise they replace them all. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.Edit.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-history/ --- # Struct command::message::History > `message.history`. `zaun_community_protocol::command::message::History` · Struct ```rust pub struct History { … } ``` `message.history`. SPEC: the spec does not say how `before` and `after` combine; when both are given this crate requires `after < before`. ## Fields ### `before: Option` Only messages with a lower `channel_seq`. ### `after: Option` Only messages with a higher `channel_seq`. ### `limit: u32` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.History.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-historypage/ --- # Struct command::message::HistoryPage > `message.history` response. `zaun_community_protocol::command::message::HistoryPage` · Struct ```rust pub struct HistoryPage { … } ``` `message.history` response. ## Fields ### `messages: Vec` Visible, undeleted messages. ### `has_more: bool` More exist in the requested direction. ### `floor: u64` The member's floor in this channel. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.HistoryPage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-reactionadd/ --- # Struct command::message::ReactionAdd > `reaction.add`. `zaun_community_protocol::command::message::ReactionAdd` · Struct ```rust pub struct ReactionAdd { … } ``` `reaction.add`. ## Fields ### `message_id: MessageId` The message. ### `emoji: String` ≤ 64 bytes, a Unicode emoji sequence. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.ReactionAdd.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-reactionremove/ --- # Struct command::message::ReactionRemove > `reaction.remove`. `zaun_community_protocol::command::message::ReactionRemove` · Struct ```rust pub struct ReactionRemove { … } ``` `reaction.remove`. ## Fields ### `message_id: MessageId` The message. ### `emoji: String` The emoji. ### `member_id: Option` Someone else's reaction (needs `MANAGE_MESSAGES`); absent = own. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.ReactionRemove.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-send/ --- # Struct command::message::Send > `message.send`. `zaun_community_protocol::command::message::Send` · Struct ```rust pub struct Send { … } ``` `message.send`. ## Fields ### `content: String` ≤ 4 000 scalars; at least 1 unless the message has an attachment or an embed. ### `embeds: Vec` Up to 10 rich embeds (`EMBED_LINKS`). Every picture an embed shows is one of `attachments`. ### `reply_to: Option` A message in the same channel. ### `mentions: Option` Who to notify. ### `attachments: Vec` Up to 10 distinct attachments this member uploaded to this channel and the host stored (`attachment.upload`), not yet on a message. SPEC: written without `?` in the protocol but absent from the the protocol example body; it defaults to empty. ### `components: Vec` Components; bot members only. ### `flags: Option` Message flags; `EPHEMERAL` only in interaction replies. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.Send.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-sent/ --- # Struct command::message::Sent > `message.send` response. `zaun_community_protocol::command::message::Sent` · Struct ```rust pub struct Sent { … } ``` `message.send` response. ## Fields ### `message_id: MessageId` Host-assigned id. ### `sequence: u64` Its `channel_seq`. ### `timestamp: u64` Acceptance time, ms. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.Sent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-message-sequenced/ --- # Struct command::message::Sequenced > `message.edit` and `message.delete` response: the event's `channel_seq`. `zaun_community_protocol::command::message::Sequenced` · Struct ```rust pub struct Sequenced { … } ``` `message.edit` and `message.delete` response: the event's `channel_seq`. ## Fields ### `sequence: u64` The `channel_seq` of the resulting event. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/message/struct.Sequenced.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-migration-reauth/ --- # Struct command::migration::Reauth > `migration.reauth`: on an unbound connection to the host that took the community over, a member proves its existing member key and the connection binds to the same `MemberId`. Resp `zaun_community_protocol::command::migration::Reauth` · Struct ```rust pub struct Reauth { … } ``` `migration.reauth`: on an unbound connection to the host that took the community over, a member proves its existing member key and the connection binds to the same `MemberId`. Responds with `super::invite::Admitted`. The envelope's `community_id` names the community; the hello before it must name it too, so the challenge and proof cover it. ## Fields ### `member_public_key: PublicKey` The member's existing key. ### `reauth: SignedJson` Signed `MemberReauth` (ctx `zaun/v1/member-reauth`). ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/migration/struct.Reauth.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-actionrow/ --- # Struct command::object::ActionRow > Type 1. `zaun_community_protocol::command::object::ActionRow` · Struct ```rust pub struct ActionRow { … } ``` Type 1. ## Fields ### `id: Option` Unique in the message. ### `components: Vec` 1–5 buttons, or one select. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.ActionRow.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-activity/ --- # Struct command::object::Activity > An activity. `zaun_community_protocol::command::object::Activity` · Struct ```rust pub struct Activity { … } ``` An activity. ## Fields ### `kind: ActivityType` The kind. ### `name: String` 1–128 scalars: the game, song, show, … ### `details: Option` ≤ 128 scalars: e.g. the track or the level. ### `state: Option` ≤ 128 scalars: e.g. the artist or the party size. ### `url: Option` `streaming` only: where to watch (`https://`, the the protocol link rules; opened only after the reader confirms). ### `started_at: Option` When it started, ms since the epoch. ### `emoji: Option` `custom` only: a Unicode emoji. ## Methods ### `check` ```rust pub fn check(&self) -> Result<(), BodyError> ``` The state-free rules. # Errors The first violated rule, with the field named `activity.`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/presence/struct.Activity.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-admission/ --- # Struct command::object::Admission > How a member was admitted. `zaun_community_protocol::command::object::Admission` · Struct ```rust pub struct Admission { … } ``` How a member was admitted. ## Fields ### `via: AdmissionVia` `"invite"` or `"request"`. ### `invite_id: Option` The invitation redeemed. ### `sponsored_by: Option` The sponsoring member. ### `approved_by: Option` The approving moderator. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/member/struct.Admission.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-admissionoverrides/ --- # Struct command::object::AdmissionOverrides > `invite.create.admission_overrides`: stricter-only admission settings. `zaun_community_protocol::command::object::AdmissionOverrides` · Struct ```rust pub struct AdmissionOverrides { … } ``` `invite.create.admission_overrides`: stricter-only admission settings. SPEC: the shape is never defined. permissions the protocol lists "approval required where it was not, longer probation, more newcomer restrictions"; this models those plus the waiting period and activity minimum. Whether each value is stricter needs the community policy, so that check is the engine's; other policy fields sent here are ignored. ## Fields ### `requires_approval: Option` Require approval. ### `waiting_period_s: Option` Longer waiting period, s. ### `probation_period_s: Option` Longer probation, s. ### `probation_activity_min: Option` Higher activity requirement. ### `newcomer_restrictions: Option` More newcomer restrictions. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/invite/struct.AdmissionOverrides.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-admissionpolicy/ --- # Struct command::object::AdmissionPolicy > The full admission policy. Visible to `MANAGE_SAFETY` holders. `zaun_community_protocol::command::object::AdmissionPolicy` · Struct ```rust pub struct AdmissionPolicy { … } ``` The full admission policy. Visible to `MANAGE_SAFETY` holders. SPEC: governance the protocol lists different fields (`admission: open|invite_only`, `max_pending`) and different `invite_creation` values; the protocol is followed. the protocol says membership requests need "open admission" but the full policy has no field saying so. ## Fields ### `level: PolicyLevel` The preset, or `custom` once a field is edited. ### `requires_approval: bool` Joins start `pending`. ### `waiting_period_s: u64` Delay before the first message, reaction or invitation, s. ### `probation_period_s: u64` Time in `probation` before automatic promotion, s (0 = none). ### `probation_activity_min: u32` Messages or reactions required during probation. ### `newcomer_restrictions: Permissions` Bits removed during probation; never `VIEW_CHANNEL`/`READ_MESSAGE_HISTORY`. ### `join_rate: JoinRate` Aggregate admission rate. ### `pending_expiry_s: u64` Pending requests expire after this, s (≤ 30 days). ### `invite_creation: InviteCreation` Who may create invitations. ### `verification: Vec` Reserved; MUST be empty in v1. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/admission/struct.AdmissionPolicy.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-applicationcommand/ --- # Struct command::object::ApplicationCommand > An application command. `zaun_community_protocol::command::object::ApplicationCommand` · Struct ```rust pub struct ApplicationCommand { … } ``` An application command. ## Fields ### `command_id: Option` Host-assigned; absent in `command.set`. ### `bot_id: Option` The bot that owns it: in `command.list` and `command.updated`, absent elsewhere. ### `kind: CommandType` Slash, user or message command. ### `name: String` The name. ### `name_localizations: BTreeMap` Localized names. ### `description: String` 1–100 scalars for slash commands; `""` for user and message commands. ### `description_localizations: BTreeMap` Localized descriptions. ### `options: Vec` Slash commands only, ≤ 25. ### `default_member_permissions: Option` Bits the invoker needs in the channel; `"0"` is owner only; absent is everyone. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/struct.ApplicationCommand.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-attachment/ --- # Struct command::object::Attachment > An attachment record: what a message carries, and what `attachment.download` and `attachment.updated` answer. `zaun_community_protocol::command::object::Attachment` · Struct ```rust pub struct Attachment { … } ``` An attachment record: what a message carries, and what `attachment.download` and `attachment.updated` answer. ## Fields ### `attachment_id: AttachmentId` Host-assigned id. ### `name: String` File name. ### `size: u64` Size in bytes. ### `mime: String` MIME type. ### `sha3_256: Vec` `SHA3-256` of the bytes, base64url. ### `availability: Availability` Whether the host still holds the bytes. ### `failure: Option` Why an upload never became `stored`; only with `availability: failed`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/message/struct.Attachment.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-auditchange/ --- # Struct command::object::AuditChange > `changes: {field, old, new}`. SPEC: value types are never given; raw JSON. `zaun_community_protocol::command::object::AuditChange` · Struct ```rust pub struct AuditChange { … } ``` `changes: [{field, old, new}]`. SPEC: value types are never given; raw JSON. ## Fields ### `field: String` The changed field. ### `old: Value` Its old value. ### `new: Value` Its new value. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/audit/struct.AuditChange.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-auditentry/ --- # Struct command::object::AuditEntry > An audit entry. `zaun_community_protocol::command::object::AuditEntry` · Struct ```rust pub struct AuditEntry { … } ``` An audit entry. ## Fields ### `audit_id: AuditId` Host-assigned id. ### `actor_id: Option` The acting member; `null` (always written) when the host itself acted: a timer's `lockdown.expire`, `membership.probation_end` or `membership.restore`. ### `action: String` One of `AUDIT_ACTIONS` (kept as text so newer actions still parse). ### `target: AuditTarget` What was acted on. ### `at: u64` Time, ms. ### `reason: Option` The moderator's reason. ### `changes: Vec` Field changes; never message content or report evidence. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/audit/struct.AuditEntry.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-audittarget/ --- # Struct command::object::AuditTarget > `target: {t, c}` of an audit entry. `zaun_community_protocol::command::object::AuditTarget` · Struct ```rust pub struct AuditTarget { … } ``` `target: {t, c}` of an audit entry. SPEC: the variants are never listed, so `t` is kept as text and `c` as raw JSON. ## Fields ### `t: String` The kind of target (`channel`, `role`, `member`, …). ### `c: Option` Its id or content. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/audit/struct.AuditTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-ban/ --- # Struct command::object::Ban > One entry of `member.bans`. `zaun_community_protocol::command::object::Ban` · Struct ```rust pub struct Ban { … } ``` One entry of `member.bans`. ## Fields ### `ban_id: BanId` The ban record. ### `display_name: String` The banned member's display name at ban time. ### `reason: Option` The moderator's reason, if given. ### `actor_id: MemberId` The banning moderator. ### `at: u64` Ban time, ms. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/member/struct.Ban.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-binding/ --- # Struct command::object::Binding > `session.welcome.binding`. `zaun_community_protocol::command::object::Binding` · Struct ```rust pub struct Binding { … } ``` `session.welcome.binding`. ## Fields ### `community_id: CommunityId` The bound community. ### `member_id: MemberId` The bound member. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/community/struct.Binding.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-botcard/ --- # Struct command::object::BotCard > The public description of an installed bot, visible to every member. `zaun_community_protocol::command::object::BotCard` · Struct ```rust pub struct BotCard { … } ``` The public description of an installed bot, visible to every member. ## Fields ### `bot_id: BotId` The installation. ### `member_id: MemberId` Its member. ### `app_id: String` From the package; for an external bot, its `name`. ### `name: String` Display name. ### `description: Option` ≤ 400 scalars. ### `version: String` Package version; `""` for an external bot. ### `publisher: Option` The package signer; none for an external bot. ### `signed: bool` False for an unsigned development package. ### `kind: BotKind` Hosted or external. ### `state: BotState` Running state. ### `permissions: Permissions` The managed role's bits. ### `capabilities: Capabilities` Effective capabilities. ### `requested: Option` While `pending_approval`: what the waiting update asks for. ### `events: Vec` Event types delivered to it. ### `config: BTreeMap` The settings it declares (never their values): a member can see that it is configured with, say, an API key. ### `installed_at: u64` Install time, ms. ### `installed_by: Option` The owner who installed it; none when the operator did. ### `updated_at: u64` Last package change, ms. ### `granted_at: u64` Last grant change, ms. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/struct.BotCard.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-button/ --- # Struct command::object::Button > Type 2. `zaun_community_protocol::command::object::Button` · Struct ```rust pub struct Button { … } ``` Type 2. ## Fields ### `id: Option` Unique in the message. ### `style: ButtonStyle` The look, and whether it is a link. ### `label: Option` ≤ 80 scalars. ### `emoji: Option` A Unicode emoji. ### `custom_id: Option` Styles 1–4. ### `url: Option` Style 5: an `https://` link. ### `disabled: bool` Shown but not clickable. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.Button.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-capabilities/ --- # Struct command::object::Capabilities > What a bot may do beyond its permission bits. Every field defaults to "no". `zaun_community_protocol::command::object::Capabilities` · Struct ```rust pub struct Capabilities { … } ``` What a bot may do beyond its permission bits. Every field defaults to "no". ## Fields ### `message_content: bool` Read the content of messages that do not mention it. ### `members: bool` List and read members beyond the authors it sees. ### `presence: bool` Receive presence signals. ### `timers: bool` Schedule timers. ### `attachments: bool` Upload files for its messages. ### `voice: bool` Join voice channels and play audio (ADR-0020); `CONNECT` and `SPEAK` still apply. ### `dms: bool` Open direct messages with members and take theirs. ### `storage_bytes: u64` Key-value storage quota, bytes (≤ 1 GiB). ### `network: Vec` DNS names it may request over https (≤ 32; a leading `*.` matches subdomains). ### `local_network: Vec` Exact `host:port` addresses next to the host it may reach over http or https, private addresses included (≤ 8): a media server on the same machine, say. Only the operator's ceiling (`[bots] local_network_allow_list`) lets any be granted. ## Methods ### `within` ```rust pub fn within(&self, other: &Self) -> bool ``` Whether every capability of `self` is also in `other`. ### `intersect` ```rust pub fn intersect(&self, other: &Self) -> Self ``` What both allow. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/struct.Capabilities.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-channel/ --- # Struct command::object::Channel > A channel or category as members see it. `zaun_community_protocol::command::object::Channel` · Struct ```rust pub struct Channel { … } ``` A channel or category as members see it. ## Fields ### `channel_id: ChannelId` Host-assigned id. ### `kind: ChannelKind` The kind. ### `name: String` 1–100 scalars. ### `topic: Option` ≤ 1 024 scalars. ### `parent_id: Option` The parent category; categories have none. ### `position: u32` Position among siblings. ### `slowmode_s: u32` 0–21 600 s. ### `locked: bool` The `locked` flag (permissions the protocol, step 7d). ### `typing: TypingMode` Who sees typing in the channel; absent means `named`, and `named` is written absent. ### `retention: Retention` Retention settings. ### `sync_with_parent: bool` Whether the effective overrides are the parent's (permissions the protocol). ### `history: HistoryAccess` History access policy (ADR-0014). ### `history_rev: u64` Incremented on each `history` change. ### `distribution: DistributionMode` Host-chosen distribution mode; clients never send it. ### `overrides: Vec` The channel's own overrides. ### `config: Map` SPEC: shown only as `{}` in the protocol and never defined; kept as an opaque object. ### `head_seq: Option` `sync.snapshot` only: the latest `channel_seq`. ### `user_limit: Option` Voice channels: the most participants, when limited. ### `voice_participants: Option>` `sync.snapshot` of a voice channel: who is in it now, without key packages. ### `participants: Vec` A `dm` channel's two members, sorted by id bytes; absent otherwise. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/channel/struct.Channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-channelafter/ --- # Struct command::object::ChannelAfter > `{channel_id, after}` (`sync.resume`, the protocol). `zaun_community_protocol::command::object::ChannelAfter` · Struct ```rust pub struct ChannelAfter { … } ``` `{channel_id, after}` (`sync.resume`, the protocol). ## Fields ### `channel_id: ChannelId` The channel. ### `after: u64` The client's cursor. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/struct.ChannelAfter.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-channelcursor/ --- # Struct command::object::ChannelCursor > `{channel_id, seq}` (`sync.ack`, the protocol). `zaun_community_protocol::command::object::ChannelCursor` · Struct ```rust pub struct ChannelCursor { … } ``` `{channel_id, seq}` (`sync.ack`, the protocol). ## Fields ### `channel_id: ChannelId` The channel. ### `seq: u64` A `channel_seq`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/struct.ChannelCursor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-channelfloor/ --- # Struct command::object::ChannelFloor > `{channel_id, floor}` (`sync.resume.floors`, the protocol). `zaun_community_protocol::command::object::ChannelFloor` · Struct ```rust pub struct ChannelFloor { … } ``` `{channel_id, floor}` (`sync.resume.floors`, the protocol). ## Fields ### `channel_id: ChannelId` The channel. ### `floor: u64` Events at or below it are not readable. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/struct.ChannelFloor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-channelhead/ --- # Struct command::object::ChannelHead > `{channel_id, head_seq, floor}` (`sync.resume.new`, the protocol). `zaun_community_protocol::command::object::ChannelHead` · Struct ```rust pub struct ChannelHead { … } ``` `{channel_id, head_seq, floor}` (`sync.resume.new`, the protocol). ## Fields ### `channel_id: ChannelId` A channel the client did not list but can now view. ### `head_seq: u64` Its latest `channel_seq`. ### `floor: u64` The member's floor in it. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/struct.ChannelHead.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-channelposition/ --- # Struct command::object::ChannelPosition > One entry of `channel.reorder` and `channel.reordered`. `zaun_community_protocol::command::object::ChannelPosition` · Struct ```rust pub struct ChannelPosition { … } ``` One entry of `channel.reorder` and `channel.reordered`. ## Fields ### `channel_id: ChannelId` The channel moved. ### `position: u32` Its new position. ### `parent_id: Option` Its new parent. Required, `null` = top level. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/channel/struct.ChannelPosition.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-checkbox/ --- # Struct command::object::Checkbox > Type 23. Never required; use a one-option checkbox group for that. `zaun_community_protocol::command::object::Checkbox` · Struct ```rust pub struct Checkbox { … } ``` Type 23. Never required; use a one-option checkbox group for that. ## Fields ### `id: Option` Unique in the modal. ### `custom_id: String` 1–100 bytes. ### `default: bool` Checked initially. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.Checkbox.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-checkboxgroup/ --- # Struct command::object::CheckboxGroup > Type 22. `zaun_community_protocol::command::object::CheckboxGroup` · Struct ```rust pub struct CheckboxGroup { … } ``` Type 22. ## Fields ### `id: Option` Unique in the modal. ### `custom_id: String` 1–100 bytes. ### `options: Vec` 1–10. ### `min_values: Option` Default 0. ### `max_values: Option` Default the number of options. ### `required: Option` Default true. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.CheckboxGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-choice/ --- # Struct command::object::Choice > A predefined choice of an option, or an autocomplete result. `zaun_community_protocol::command::object::Choice` · Struct ```rust pub struct Choice { … } ``` A predefined choice of an option, or an autocomplete result. ## Fields ### `name: String` 1–100 scalars. ### `name_localizations: BTreeMap` Localized names by BCP 47 tag. ### `value: ChoiceValue` What the bot receives. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/struct.Choice.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-commandoption/ --- # Struct command::object::CommandOption > An option of a command or subcommand. `zaun_community_protocol::command::object::CommandOption` · Struct ```rust pub struct CommandOption { … } ``` An option of a command or subcommand. ## Fields ### `kind: OptionType` The kind of value. ### `name: String` 1–32, Discord's name pattern. ### `name_localizations: BTreeMap` Localized names. ### `description: String` 1–100 scalars. ### `description_localizations: BTreeMap` Localized descriptions. ### `required: bool` Required options come before optional ones; never on subcommands. ### `choices: Vec` ≤ 25 fixed choices (string, integer and number options). ### `options: Vec` Subcommand and group children. ### `channel_types: Vec` Channel options: the kinds offered. ### `min_value: Option` Integer and number bounds. ### `max_value: Option` Integer and number bounds. ### `min_length: Option` String length bounds, 0–6 000. ### `max_length: Option` String length bounds, 1–6 000. ### `autocomplete: bool` The bot suggests values as the invoker types (not with `choices`). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/app_command/struct.CommandOption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-communityprofile/ --- # Struct command::object::CommunityProfile > The host-managed community profile. `zaun_community_protocol::command::object::CommunityProfile` · Struct ```rust pub struct CommunityProfile { … } ``` The host-managed community profile. SPEC: "profile" is never defined. the protocol names only `system_channel_id` and `default_slowmode_s` as host-managed profile fields, so only these are modelled; other fields a host sends are ignored. Distinct from a member's `profile: {display_name}`. ## Fields ### `system_channel_id: Option` Where the host posts system notices, if anywhere. ### `default_slowmode_s: u32` Slowmode applied to new channels, 0–21 600 s. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/community/struct.CommunityProfile.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-configkey/ --- # Struct command::object::ConfigKey > One setting a bot declares in its manifest's `config` table; the owner sets its value. `zaun_community_protocol::command::object::ConfigKey` · Struct ```rust pub struct ConfigKey { … } ``` One setting a bot declares in its manifest's `config` table; the owner sets its value. ## Fields ### `description: String` What it is, shown to the owner (1-200 scalars). ### `default: Option` Used while the owner has set nothing (≤ 4 KiB); never for a secret. ### `secret: bool` Masked wherever it is shown, and never logged. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/struct.ConfigKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-container/ --- # Struct command::object::Container > Type 17. `zaun_community_protocol::command::object::Container` · Struct ```rust pub struct Container { … } ``` Type 17. ## Fields ### `id: Option` Unique in the message. ### `components: Vec` Types 1, 9, 10, 12, 13, 14. ### `accent_color: Option` `0x000000`–`0xFFFFFF`. ### `spoiler: bool` Blurred until clicked. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.Container.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-cursors/ --- # Struct command::object::Cursors > The cursors a binding command returns (`community.create`, `invite.redeem`, `membership.request`). `zaun_community_protocol::command::object::Cursors` · Struct ```rust pub struct Cursors { … } ``` The cursors a binding command returns (`community.create`, `invite.redeem`, `membership.request`). SPEC: `cursors` is never defined. the protocol says a client holds one `member_seq` and one `channel_seq` per visible channel; the `sync.ack` shape `{member, channels: [{channel_id, seq}]}` is reused. ## Fields ### `member: u64` `member_seq`. ### `channels: Vec` One `channel_seq` per channel. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/struct.Cursors.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-defaultvalue/ --- # Struct command::object::DefaultValue > A preselected entity of a user, role, mentionable or channel select. `zaun_community_protocol::command::object::DefaultValue` · Struct ```rust pub struct DefaultValue { … } ``` A preselected entity of a user, role, mentionable or channel select. ## Fields ### `id: String` The id, base64url. ### `kind: DefaultValueKind` What the id names. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.DefaultValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-embed/ --- # Struct command::object::Embed > An embed. 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 `zaun_community_protocol::command::object::Embed` · Struct ```rust pub struct Embed { … } ``` An embed. 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). ## Fields ### `title: Option` 1–256 scalars. ### `description: Option` 1–4 096 scalars. ### `url: Option` The title's link: `https://` only, ≤ 2 048 bytes, no whitespace or control characters. Needs a `title`. ### `color: Option` `0x000000`–`0xFFFFFF`. ### `timestamp: Option` A time the embed shows, ms since the epoch (< 2^53). ### `author: Option` The author line. ### `footer: Option` The footer line. ### `image: Option` The large picture: one of the message's attachments. ### `thumbnail: Option` The small picture: one of the message's attachments. ### `fields: Vec` Up to 25 fields, in order. ## Methods ### `attachments` ```rust pub fn attachments(&self) -> impl Iterator + '_ ``` The attachments this embed shows, with the field that names each: `embeds.image`, `embeds.thumbnail`, `embeds.author.icon`, `embeds.footer.icon`. ### `is_empty` ```rust pub fn is_empty(&self) -> bool ``` Whether the embed shows nothing but a colour, a time or a bare link. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/struct.Embed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-embedauthor/ --- # Struct command::object::EmbedAuthor > `author: {name, url?, icon?}` of an embed. `zaun_community_protocol::command::object::EmbedAuthor` · Struct ```rust pub struct EmbedAuthor { … } ``` `author: {name, url?, icon?}` of an embed. ## Fields ### `name: String` 1–256 scalars. ### `url: Option` The name's link, under the same rules as `Embed::url`. ### `icon: Option` A small picture: one of the message's attachments. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/struct.EmbedAuthor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-embedfield/ --- # Struct command::object::EmbedField > `fields: {name, value, inline}` of an embed. `zaun_community_protocol::command::object::EmbedField` · Struct ```rust pub struct EmbedField { … } ``` `fields: [{name, value, inline}]` of an embed. ## Fields ### `name: String` 1–256 scalars. ### `value: String` 1–1 024 scalars. ### `inline: bool` Shown next to the neighbouring inline fields rather than on its own line; absent means `false`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/struct.EmbedField.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-embedfooter/ --- # Struct command::object::EmbedFooter > `footer: {text, icon?}` of an embed. `zaun_community_protocol::command::object::EmbedFooter` · Struct ```rust pub struct EmbedFooter { … } ``` `footer: {text, icon?}` of an embed. ## Fields ### `text: String` 1–2 048 scalars. ### `icon: Option` A small picture: one of the message's attachments. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/embed/struct.EmbedFooter.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-empty/ --- # Struct command::object::Empty > An empty body or response, `{}`. Unknown fields are ignored. `zaun_community_protocol::command::object::Empty` · Struct ```rust pub struct Empty { … } ``` An empty body or response, `{}`. Unknown fields are ignored. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/community/struct.Empty.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-entityselect/ --- # Struct command::object::EntitySelect > Types 5–8. `zaun_community_protocol::command::object::EntitySelect` · Struct ```rust pub struct EntitySelect { … } ``` Types 5–8. ## Fields ### `id: Option` Unique in the message. ### `custom_id: String` 1–100 bytes. ### `placeholder: Option` ≤ 150 scalars. ### `min_values: Option` 0–25, default 1. ### `max_values: Option` ≤ 25, default 1. ### `default_values: Vec` Preselected entities, ≤ `max_values`. ### `channel_types: Vec` Type 8 only: the channel kinds offered. ### `required: Option` Modal only; default true. ### `disabled: bool` Not in a modal. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.EntitySelect.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-evidence/ --- # Struct command::object::Evidence > One evidence item. `zaun_community_protocol::command::object::Evidence` · Struct ```rust pub struct Evidence { … } ``` One evidence item. ## Fields ### `channel_id: ChannelId` The message's channel. ### `message_id: MessageId` The message. ### `content_snapshot: Option` The host's snapshot at report time (`content_snapshot?`, the protocol); absent when redacted. ### `embeds_snapshot: Vec` The message's embeds at report time; absent when it had none or when redacted. ### `omitted: bool` The snapshot was left out of this response for size; `report.get` with `evidence_from` returns it (see `Report::evidence_next`). ### `redacted: bool` Withheld from this viewer (permissions the protocol). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/struct.Evidence.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-filecomponent/ --- # Struct command::object::FileComponent > Type 13. `zaun_community_protocol::command::object::FileComponent` · Struct ```rust pub struct FileComponent { … } ``` Type 13. ## Fields ### `id: Option` Unique in the message. ### `file: AttachmentId` An attachment of the same message. ### `spoiler: bool` Hidden until clicked. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.FileComponent.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-fileupload/ --- # Struct command::object::FileUpload > Type 19. `zaun_community_protocol::command::object::FileUpload` · Struct ```rust pub struct FileUpload { … } ``` Type 19. ## Fields ### `id: Option` Unique in the modal. ### `custom_id: String` 1–100 bytes. ### `min_values: Option` 0–10, default 1. ### `max_values: Option` ≤ 10, default 1. ### `required: Option` Default true. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.FileUpload.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-grants/ --- # Struct command::object::Grants > A bot's grants: permission bits (its managed role) and capabilities. `zaun_community_protocol::command::object::Grants` · Struct ```rust pub struct Grants { … } ``` A bot's grants: permission bits (its managed role) and capabilities. ## Fields ### `permissions: Permissions` The managed role's bits. ### `capabilities: Capabilities` Capabilities. ## Methods ### `within` ```rust pub fn within(&self, other: &Self) -> bool ``` Whether `self` asks for nothing beyond `other`. ### `intersect` ```rust pub fn intersect(&self, other: &Self) -> Self ``` What both allow. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/struct.Grants.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-iceserver/ --- # Struct command::object::IceServer > One ICE server, in the shape of WebRTC's `RTCIceServer`. `zaun_community_protocol::command::object::IceServer` · Struct ```rust pub struct IceServer { … } ``` One ICE server, in the shape of WebRTC's `RTCIceServer`. ## Fields ### `urls: Vec` `stun:`, `turn:` or `turns:` URLs. ### `username: Option` TURN username, from the operator's credentials file. ### `credential: Option` TURN credential, from the operator's credentials file. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/voice/struct.IceServer.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-interaction/ --- # Struct command::object::Interaction > An interaction as delivered to its bot (`interaction.created`). `zaun_community_protocol::command::object::Interaction` · Struct ```rust pub struct Interaction { … } ``` An interaction as delivered to its bot (`interaction.created`). ## Fields ### `interaction_id: InteractionId` Host-assigned. ### `kind: InteractionType` The kind. ### `bot_id: BotId` The bot it is for. ### `channel_id: ChannelId` Where it happened. ### `member: Member` The invoker, as the bot may see it. ### `app_permissions: Permissions` The bot's effective permissions in the channel. ### `locale: Option` The invoker's client locale. ### `message: Option>` Type 3: the message holding the component. ### `data: InteractionData` By type. ### `created_at: u64` When the host received it, ms. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/struct.Interaction.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-interactionmetadata/ --- # Struct command::object::InteractionMetadata > `interaction_metadata` of a message that answers an interaction. `zaun_community_protocol::command::object::InteractionMetadata` · Struct ```rust pub struct InteractionMetadata { … } ``` `interaction_metadata` of a message that answers an interaction. ## Fields ### `interaction_id: InteractionId` The interaction. ### `kind: InteractionType` Its type. ### `name: Option` The command's name, for commands. ### `member_id: MemberId` The invoker. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/struct.InteractionMetadata.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-invitelink/ --- # Struct command::object::InviteLink > A `zaun://join/…` link. It embeds the `crate::ids::InviteSecret`, so `Debug` is redacted; the text is reachable only through `InviteLink::expose`. `zaun_community_protocol::command::object::InviteLink` · Struct ```rust pub struct InviteLink(…) ``` A `zaun://join/…` link. It embeds the `crate::ids::InviteSecret`, so `Debug` is redacted; the text is reachable only through `InviteLink::expose`. ## Methods ### `new` ```rust pub const fn new(link: String) -> Self ``` Wraps a link built by the host. ### `expose` ```rust pub fn expose(&self) -> &str ``` The link text, for the one place it is shown. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/invite/struct.InviteLink.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-invitesummary/ --- # Struct command::object::InviteSummary > One entry of `invite.list`. Never carries the secret. `zaun_community_protocol::command::object::InviteSummary` · Struct ```rust pub struct InviteSummary { … } ``` One entry of `invite.list`. Never carries the secret. ## Fields ### `invite_id: InviteId` Public handle. ### `creator_id: MemberId` The issuing member. ### `uses: u32` Redemptions so far (pending requests count). ### `max_uses: u32` 0 = unlimited. ### `expires_at: Option` Expiry, ms; none = never. ### `channel_id: Option` The channel the invitation opens on, if any. ### `requires_approval: bool` Joins through it start `pending`. ### `sponsored: bool` The creator sponsors members admitted through it. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/invite/struct.InviteSummary.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-inviteuse/ --- # Struct command::object::InviteUse > One entry of `invite.uses`. `zaun_community_protocol::command::object::InviteUse` · Struct ```rust pub struct InviteUse { … } ``` One entry of `invite.uses`. ## Fields ### `member_id: MemberId` The admitted member. ### `joined_at: u64` Admission time, ms. ### `state: MembershipState` Current state. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/invite/struct.InviteUse.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-joinrate/ --- # Struct command::object::JoinRate > `join_rate: {per_hour}`. `zaun_community_protocol::command::object::JoinRate` · Struct ```rust pub struct JoinRate { … } ``` `join_rate: {per_hour}`. ## Fields ### `per_hour: u32` Admissions per hour for the community. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/admission/struct.JoinRate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-label/ --- # Struct command::object::Label > Type 18. `zaun_community_protocol::command::object::Label` · Struct ```rust pub struct Label { … } ``` Type 18. ## Fields ### `id: Option` Unique in the modal. ### `label: String` 1–45 scalars. ### `description: Option` ≤ 100 scalars. ### `component: Box` One input: 3, 4, 5–8, 19, 21, 22 or 23. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.Label.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-lockdown/ --- # Struct command::object::Lockdown > The full lockdown record, for `MANAGE_SAFETY` holders: `{ lockdown_id, restrictions, forced_slowmode_s?, newcomer_window_s?, expires_at, reason?, actor_id }`. `zaun_community_protocol::command::object::Lockdown` · Struct ```rust pub struct Lockdown { … } ``` The full lockdown record, for `MANAGE_SAFETY` holders: `{ lockdown_id, restrictions, forced_slowmode_s?, newcomer_window_s?, expires_at, reason?, actor_id }`. ## Fields ### `lockdown_id: LockdownId` Host-assigned id. ### `restrictions: Vec` Active restrictions (≥ 1). ### `forced_slowmode_s: Option` Forced minimum slowmode on every channel, s. ### `newcomer_window_s: Option` Window for `restrict_newcomers`, s; present only with that restriction. ### `expires_at: u64` Expiry, ms. ### `reason: Option` The moderator's reason. ### `actor_id: MemberId` The enabling moderator. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/lockdown/struct.Lockdown.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-lockdownpublic/ --- # Struct command::object::LockdownPublic > The public form, for members without `MANAGE_SAFETY`: `{active, restrictions_affecting_you, expires_at}`. With no active lockdown (disabled or expired) it is `{active: false, restr `zaun_community_protocol::command::object::LockdownPublic` · Struct ```rust pub struct LockdownPublic { … } ``` The public form, 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`. ## Fields ### `active: bool` Whether a lockdown is active. ### `restrictions_affecting_you: Vec` The restrictions that apply to the viewer. ### `expires_at: Option` Expiry, ms; `null` when inactive. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/lockdown/struct.LockdownPublic.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-manifest/ --- # Struct command::object::Manifest > The manifest inside a bot package. `zaun_community_protocol::command::object::Manifest` · Struct ```rust pub struct Manifest { … } ``` The manifest inside a bot package. ## Fields ### `app_id: String` Lowercase reverse-DNS, equal to the signed header. ### `version: String` Semantic version, equal to the signed header. ### `name: String` The bot member's display name, 1–32 scalars. ### `description: Option` ≤ 400 scalars. ### `permissions: Permissions` Permission bits it asks for. ### `capabilities: Capabilities` Capabilities it asks for. ### `events: Vec` Event types it wants delivered. ### `limits: Option` Requested limits. ### `update_url: Option` Where newer packages are published. ### `config: BTreeMap` Settings the owner sets (`bot.configure`): key (`[a-z][a-z0-9_]{0,63}`, ≤ 32) to description, default and whether it is secret. ## Methods ### `request` ```rust pub fn request(&self) -> Grants ``` What the manifest asks for. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/struct.Manifest.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-manifestlimits/ --- # Struct command::object::ManifestLimits > Resource limits a manifest asks for; the host may lower them. `zaun_community_protocol::command::object::ManifestLimits` · Struct ```rust pub struct ManifestLimits { … } ``` Resource limits a manifest asks for; the host may lower them. ## Fields ### `memory_bytes: Option` Memory, bytes. ### `cpu_ms: Option` CPU per call, ms. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/bot/struct.ManifestLimits.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-mediagallery/ --- # Struct command::object::MediaGallery > Type 12. `zaun_community_protocol::command::object::MediaGallery` · Struct ```rust pub struct MediaGallery { … } ``` Type 12. ## Fields ### `id: Option` Unique in the message. ### `items: Vec` 1–10 pictures. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.MediaGallery.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-mediaitem/ --- # Struct command::object::MediaItem > One picture of a media gallery. `zaun_community_protocol::command::object::MediaItem` · Struct ```rust pub struct MediaItem { … } ``` One picture of a media gallery. ## Fields ### `media: AttachmentId` An image attachment of the same message. ### `description: Option` Alt text, ≤ 1 024 scalars. ### `spoiler: bool` Blurred until clicked. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.MediaItem.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-member/ --- # Struct command::object::Member > A member as visible to the viewer. Optional fields depend on the viewer's permissions; the host filters them. `zaun_community_protocol::command::object::Member` · Struct ```rust pub struct Member { … } ``` A member as visible to the viewer. Optional fields depend on the viewer's permissions; the host filters them. ## Fields ### `member_id: MemberId` Host-assigned id. ### `display_name: String` 1–32 scalars. ### `role_ids: Vec` Assigned roles; `@everyone` is implicit and never listed. ### `joined_at: u64` Admission time, ms. ### `timeout_until: Option` Only for `TIMEOUT_MEMBERS` viewers and the member itself. ### `state: Option` Only for the member itself and `APPROVE_MEMBERS`/`KICK_MEMBERS` viewers. ### `admission: Option` Only for `APPROVE_MEMBERS` viewers. ### `note: Option` The membership request note: `membership.pending` and `membership.requested` only. SPEC: the protocol/the protocol say the member object comes "with `admission` and `note`" without placing `note`; it is modelled as a member field. ### `bot_id: Option` Present only for bots. ### `status_text: Option` The custom status text (`member.status.set`), until it expires. ### `status_emoji: Option` The custom status emoji. ### `status_expires_at: Option` When the host clears the custom status, ms. ### `voice_channel_id: Option` Only in what the host sends a bot: the voice channel the member is connected to, when the bot can see that channel (so `/play` can join the caller). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/member/struct.Member.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-mentions/ --- # Struct command::object::Mentions > `mentions: {everyone, members, roles}`. `zaun_community_protocol::command::object::Mentions` · Struct ```rust pub struct Mentions { … } ``` `mentions: {everyone, members, roles}`. ## Fields ### `everyone: bool` `@everyone` was mentioned. ### `members: Vec` Mentioned members, ≤ 50. ### `roles: Vec` Mentioned roles, ≤ 20. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/message/struct.Mentions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-message/ --- # Struct command::object::Message > A stored message as returned by `message.history`. `zaun_community_protocol::command::object::Message` · Struct ```rust pub struct Message { … } ``` A stored message as returned by `message.history`. ## Fields ### `message_id: MessageId` Host-assigned id. ### `channel_id: ChannelId` The channel. ### `sequence: u64` Its `channel_seq`. ### `author_id: MemberId` The author, from the connection binding. ### `created_at: u64` Acceptance time, ms. ### `edited_at: Option` Last edit time, ms. ### `content: String` ≤ 4 000 scalars; empty only when the message has an attachment or an embed. ### `embeds: Vec` Rich embeds, in the author's order; absent when none. ### `components: Vec` Components (bots only, the protocol); absent when none. ### `flags: u32` Message flags; absent when 0. ### `interaction_metadata: Option>` The interaction this message answers. ### `reply_to: Option` The message replied to. ### `mentions: Mentions` Who is mentioned. ### `attachments: Vec` Attachments, in the order the author listed them. ### `reactions: Vec` Reaction counts. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/message/struct.Message.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-messagebody/ --- # Struct command::object::MessageBody > Content, embeds, components, attachments, mentions and flags of a bot's message. `zaun_community_protocol::command::object::MessageBody` · Struct ```rust pub struct MessageBody { … } ``` Content, embeds, components, attachments, mentions and flags of a bot's message. ## Fields ### `content: Option` ≤ 4 000 scalars. ### `embeds: Option>` ≤ 10 embeds. ### `components: Option>` Components. ### `attachments: Vec` Attachments the bot uploaded to the channel, not yet on a message. ### `mentions: Option` Who to notify. ### `flags: Option` `flags` bits. ## Methods ### `flag_bits` ```rust pub fn flag_bits(&self) -> u32 ``` The flags, 0 when absent. ### `is_ephemeral` ```rust pub fn is_ephemeral(&self) -> bool ``` Whether `EPHEMERAL` is set. ### `check` ```rust pub fn check(&self, whole: bool) -> Result<(), BodyError> ``` State-free rules. `whole`: a new message (needs something to show), not an edit. # Errors The first violated rule. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/body/struct.MessageBody.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-newprofile/ --- # Struct command::object::NewProfile > `profile: {display_name}` of a joining or creating member. `zaun_community_protocol::command::object::NewProfile` · Struct ```rust pub struct NewProfile { … } ``` `profile: {display_name}` of a joining or creating member. ## Fields ### `display_name: String` 1–32 scalars. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/community/struct.NewProfile.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-opaque/ --- # Struct command::object::Opaque > Opaque bytes, base64url on the wire (key packages, wrapped keys, signalling data). `zaun_community_protocol::command::object::Opaque` · Struct ```rust pub struct Opaque(…) ``` Opaque bytes, base64url on the wire (key packages, wrapped keys, signalling data). ## Methods ### `as_bytes` ```rust pub fn as_bytes(&self) -> &[u8] ``` The bytes. ### `len` ```rust pub fn len(&self) -> usize ``` Their length. ### `is_empty` ```rust pub fn is_empty(&self) -> bool ``` Whether there are none. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/voice/struct.Opaque.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-optionvalue/ --- # Struct command::object::OptionValue > One option of an invoked command. `zaun_community_protocol::command::object::OptionValue` · Struct ```rust pub struct OptionValue { … } ``` One option of an invoked command. ## Fields ### `name: String` The option's name. ### `kind: OptionType` The option's type. ### `value: Option` Absent for subcommands and groups. ### `options: Vec` A subcommand's options. ### `focused: bool` The option being typed (autocomplete only). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/struct.OptionValue.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-override/ --- # Struct command::object::Override > A permission override on a channel or category (permissions the protocol). `zaun_community_protocol::command::object::Override` · Struct ```rust pub struct Override { … } ``` A permission override on a channel or category (permissions the protocol). ## Fields ### `target: OverrideTarget` Whom it applies to. ### `allow: Permissions` Bits allowed. ### `deny: Permissions` Bits denied. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/channel/struct.Override.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-policysummary/ --- # Struct command::object::PolicySummary > The public summary: `{level, requires_approval, invite_creation, open}`. Hosts MUST send `open`. `zaun_community_protocol::command::object::PolicySummary` · Struct ```rust pub struct PolicySummary { … } ``` The public summary: `{level, requires_approval, invite_creation, open}`. Hosts MUST send `open`. ## Fields ### `level: PolicyLevel` The preset. ### `requires_approval: bool` Joins start `pending`. ### `invite_creation: InviteCreation` Who may create invitations. ### `open: bool` Whether the community accepts `membership.request` (open admission, the protocol). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/admission/struct.PolicySummary.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-radiogroup/ --- # Struct command::object::RadioGroup > Type 21. `zaun_community_protocol::command::object::RadioGroup` · Struct ```rust pub struct RadioGroup { … } ``` Type 21. ## Fields ### `id: Option` Unique in the modal. ### `custom_id: String` 1–100 bytes. ### `options: Vec` 2–10. ### `required: Option` Default true. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.RadioGroup.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-reactioncount/ --- # Struct command::object::ReactionCount > `reactions: {emoji, count, me}`. `zaun_community_protocol::command::object::ReactionCount` · Struct ```rust pub struct ReactionCount { … } ``` `reactions: [{emoji, count, me}]`. ## Fields ### `emoji: String` The emoji. ### `count: u32` How many members reacted with it. ### `me: bool` Whether the viewer is one of them. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/message/struct.ReactionCount.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-report/ --- # Struct command::object::Report > A report. Only for `MANAGE_REPORTS` holders and, without other reporters' data, the reporter. `zaun_community_protocol::command::object::Report` · Struct ```rust pub struct Report { … } ``` A report. Only for `MANAGE_REPORTS` holders and, without other reporters' data, the reporter. ## Fields ### `report_id: ReportId` Host-assigned id. ### `category: ReportCategory` The category. ### `description: Option` ≤ 2 000 scalars. ### `target: ReportTarget` The reported member or message. ### `evidence: Vec` Host snapshots of the selected messages. ### `evidence_next: Option` Some snapshots were left out to keep the report within a frame (items with `omitted: true`): `report.get` with `evidence_from` set to this index returns them. ### `reporter_id: MemberId` The reporter. ### `status: ReportStatus` Workflow status. ### `resolution: Option` Set once resolved. ### `created_at: u64` Creation time, ms. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/struct.Report.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-resolution/ --- # Struct command::object::Resolution > `resolution: {outcome, note?, actor_id, at}`. `zaun_community_protocol::command::object::Resolution` · Struct ```rust pub struct Resolution { … } ``` `resolution: {outcome, note?, actor_id, at}`. ## Fields ### `outcome: Outcome` The outcome. ### `note: Option` The moderator's note. ### `actor_id: MemberId` The resolving moderator. ### `at: u64` Resolution time, ms. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/report/struct.Resolution.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-resolved/ --- # Struct command::object::Resolved > Objects an interaction refers to, resolved by the host. `zaun_community_protocol::command::object::Resolved` · Struct ```rust pub struct Resolved { … } ``` Objects an interaction refers to, resolved by the host. ## Fields ### `members: BTreeMap` Members. ### `roles: BTreeMap` Roles. ### `channels: BTreeMap` Channels. ### `messages: BTreeMap` Messages. ### `attachments: BTreeMap` Attachments. ## Methods ### `is_empty` ```rust pub fn is_empty(&self) -> bool ``` Nothing resolved. ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/struct.Resolved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-resync/ --- # Struct command::object::Resync > `{stream, channel_id?}` of `sync.resume.resync` and `RESYNC_REQUIRED`. `zaun_community_protocol::command::object::Resync` · Struct ```rust pub struct Resync { … } ``` `{stream, channel_id?}` of `sync.resume.resync` and `RESYNC_REQUIRED`. ## Fields ### `stream: Stream` The stream to rebuild. ### `channel_id: Option` For a channel stream. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/sync/struct.Resync.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-retention/ --- # Struct command::object::Retention > Message retention of a channel. `zaun_community_protocol::command::object::Retention` · Struct ```rust pub struct Retention { … } ``` Message retention of a channel. SPEC: the spec gives no bounds or semantics; this crate requires each set value ≥ 1 and below 2^53, and lets `null` mean "no limit". ## Fields ### `max_age_s: Option` Maximum message age in seconds. ### `max_count: Option` Maximum number of messages kept. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/channel/struct.Retention.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-role/ --- # Struct command::object::Role > A role. Visible to every member. `zaun_community_protocol::command::object::Role` · Struct ```rust pub struct Role { … } ``` A role. Visible to every member. ## Fields ### `role_id: RoleId` Host-assigned id; all-zero for `@everyone`. ### `name: String` 1–100 scalars. ### `color: Option` RGB `0x000000`–`0xFFFFFF`, or none. ### `hoist: bool` Shown separately in member lists. ### `mentionable: bool` May be mentioned by anyone. ### `position: u32` 0 for `@everyone`; 1..n otherwise, higher = more authority. ### `permissions: Permissions` Granted bits; unknown bits are preserved (permissions the protocol). ### `managed_by: Option` Only on a bot's managed role. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/role/struct.Role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-roleposition/ --- # Struct command::object::RolePosition > One entry of `role.reorder` and `role.reordered`. `zaun_community_protocol::command::object::RolePosition` · Struct ```rust pub struct RolePosition { … } ``` One entry of `role.reorder` and `role.reordered`. ## Fields ### `role_id: RoleId` The role moved. ### `position: u32` Its new position (≥ 1). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/role/struct.RolePosition.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-section/ --- # Struct command::object::Section > Type 9. `zaun_community_protocol::command::object::Section` · Struct ```rust pub struct Section { … } ``` Type 9. ## Fields ### `id: Option` Unique in the message. ### `components: Vec` 1–3 text displays. ### `accessory: Box` A button or a thumbnail. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.Section.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-selectoption/ --- # Struct command::object::SelectOption > One option of a string select, radio group or checkbox group. `zaun_community_protocol::command::object::SelectOption` · Struct ```rust pub struct SelectOption { … } ``` One option of a string select, radio group or checkbox group. ## Fields ### `label: String` ≤ 100 scalars. ### `value: String` ≤ 100 scalars; what the bot receives. ### `description: Option` ≤ 100 scalars. ### `emoji: Option` A Unicode emoji. ### `default: bool` Selected initially. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.SelectOption.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-separator/ --- # Struct command::object::Separator > Type 14. `zaun_community_protocol::command::object::Separator` · Struct ```rust pub struct Separator { … } ``` Type 14. ## Fields ### `id: Option` Unique in the message. ### `divider: Option` Draws a line; default true. ### `spacing: Option` 1 small, 2 large. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.Separator.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-signedrotation/ --- # Struct command::object::SignedRotation > A `SignedRootRotation` in JSON: `{bytes, sig_old, sig_new}`, all base64url. Kept undecoded, like `crate::json::SignedJson`; the `signed` module verifies it. `zaun_community_protocol::command::object::SignedRotation` · Struct ```rust pub struct SignedRotation { … } ``` A `SignedRootRotation` in JSON: `{bytes, sig_old, sig_new}`, all base64url. Kept undecoded, like `crate::json::SignedJson`; the `signed` module verifies it. ## Fields ### `bytes: Vec` Canonical bytes of the `RootRotation`. ### `sig_old: Vec` Signature by the retiring root key. ### `sig_new: Vec` Signature by the new root key. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/community/struct.SignedRotation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-stringselect/ --- # Struct command::object::StringSelect > Type 3. `zaun_community_protocol::command::object::StringSelect` · Struct ```rust pub struct StringSelect { … } ``` Type 3. ## Fields ### `id: Option` Unique in the message. ### `custom_id: String` 1–100 bytes. ### `options: Vec` 1–25. ### `placeholder: Option` ≤ 150 scalars. ### `min_values: Option` 0–25, default 1. ### `max_values: Option` ≤ 25, default 1. ### `required: Option` Modal only; default true. ### `disabled: bool` Not in a modal. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.StringSelect.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-submittedinput/ --- # Struct command::object::SubmittedInput > One submitted modal input. `zaun_community_protocol::command::object::SubmittedInput` · Struct ```rust pub struct SubmittedInput { … } ``` One submitted modal input. ## Fields ### `id: Option` The component's `id`. ### `custom_id: String` The component's `custom_id`. ### `value: Option` Text inputs and checkboxes (`"true"`/`"false"`). ### `values: Vec` Selects, radio and checkbox groups, file uploads (attachment ids). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/interaction/struct.SubmittedInput.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-textdisplay/ --- # Struct command::object::TextDisplay > Type 10. `zaun_community_protocol::command::object::TextDisplay` · Struct ```rust pub struct TextDisplay { … } ``` Type 10. ## Fields ### `id: Option` Unique in the message. ### `content: String` Markdown, 1–4 000 scalars (all text displays together ≤ 4 000). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.TextDisplay.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-textinput/ --- # Struct command::object::TextInput > Type 4. `zaun_community_protocol::command::object::TextInput` · Struct ```rust pub struct TextInput { … } ``` Type 4. ## Fields ### `id: Option` Unique in the modal. ### `custom_id: String` 1–100 bytes. ### `style: TextInputStyle` Short or paragraph. ### `min_length: Option` 0–4 000. ### `max_length: Option` 1–4 000. ### `required: Option` Default true. ### `value: Option` Prefilled text, ≤ 4 000 scalars. ### `placeholder: Option` ≤ 100 scalars. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/struct.TextInput.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-thumbnail/ --- # Struct command::object::Thumbnail > Type 11. `zaun_community_protocol::command::object::Thumbnail` · Struct ```rust pub struct Thumbnail { … } ``` Type 11. ## Fields ### `id: Option` Unique in the message. ### `media: AttachmentId` An image attachment of the same message. ### `description: Option` Alt text, ≤ 1 024 scalars. ### `spoiler: bool` Blurred until clicked. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/component/kinds/layout/struct.Thumbnail.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-object-voiceparticipant/ --- # Struct command::object::VoiceParticipant > One member in a voice channel. `zaun_community_protocol::command::object::VoiceParticipant` · Struct ```rust pub struct VoiceParticipant { … } ``` One member in a voice channel. ## Fields ### `member_id: MemberId` The member. ### `voice_session: VoiceSessionId` This stay in the channel; a rejoin gets a new one. ### `key_package: Option` The member's key package for this stay (opaque to the host). Only participants of the same channel receive it; other viewers see the participant without it. ### `member_public_key: Option` The member's public key, sent with `key_package`: the key that signed it (ADR-0018). Participants verify the key package and the member's sender keys under it. ### `self_mute: bool` Muted by the member. ### `self_deaf: bool` Deafened by the member. ### `server_mute: bool` Muted by a moderator (`MUTE_MEMBERS`); kept across stays. ### `server_deaf: bool` Deafened by a moderator (`DEAFEN_MEMBERS`); kept across stays. ### `can_speak: bool` Whether the member holds `SPEAK` in the channel. Clients do not play the audio of a participant who may not speak or is server-muted. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/object/voice/struct.VoiceParticipant.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-presence-list/ --- # Struct command::presence::List > `presence.list`: the presences of the community's connected, visible members. `zaun_community_protocol::command::presence::List` · Struct ```rust pub struct List { … } ``` `presence.list`: the presences of the community's connected, visible members. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/presence/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-presence-presences/ --- # Struct command::presence::Presences > `presence.list` response: one entry per member not `offline` (members missing from the list are offline). `zaun_community_protocol::command::presence::Presences` · Struct ```rust pub struct Presences { … } ``` `presence.list` response: one entry per member not `offline` (members missing from the list are offline). ## Fields ### `presences: Vec` The presences, as `signal.presence` events carry them. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/presence/struct.Presences.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-presence-statusset/ --- # Struct command::presence::StatusSet > `member.status.set`: replaces the actor's custom status. A body with neither `text` nor `emoji` clears it. `zaun_community_protocol::command::presence::StatusSet` · Struct ```rust pub struct StatusSet { … } ``` `member.status.set`: replaces the actor's custom status. A body with neither `text` nor `emoji` clears it. ## Fields ### `text: Option` 1–128 scalars. ### `emoji: Option` A Unicode emoji. ### `expires_at: Option` When the host clears it, ms since the epoch; absent: never. ## Methods ### `clears` ```rust pub const fn clears(&self) -> bool ``` Whether this clears the status. ## Trait implementations `Body`, `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/presence/struct.StatusSet.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-create/ --- # Struct command::report::Create > `report.create`. `zaun_community_protocol::command::report::Create` · Struct ```rust pub struct Create { … } ``` `report.create`. ## Fields ### `category: ReportCategory` The category. ### `description: Option` ≤ 2 000 scalars. ### `target: ReportTarget` The reported member or message. ### `evidence_message_ids: Vec` 0–20 messages selected by the reporter, each once. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.Create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-created/ --- # Struct command::report::Created > `report.create` response. `zaun_community_protocol::command::report::Created` · Struct ```rust pub struct Created { … } ``` `report.create` response. ## Fields ### `report_id: ReportId` The new report. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.Created.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-get/ --- # Struct command::report::Get > `report.get`. `zaun_community_protocol::command::report::Get` · Struct ```rust pub struct Get { … } ``` `report.get`. ## Fields ### `report_id: ReportId` The report. ### `evidence_from: u32` The first evidence item whose snapshot to return (0–19, default 0): the previous answer's `evidence_next`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.Get.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-list/ --- # Struct command::report::List > `report.list`. `zaun_community_protocol::command::report::List` · Struct ```rust pub struct List { … } ``` `report.list`. ## Fields ### `status: Option` Only this status. ### `after: Option` Page start (exclusive). ### `limit: u32` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.List.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-page/ --- # Struct command::report::Page > `report.list` response: `reports`, `next?`. `zaun_community_protocol::command::report::Page` · Struct ```rust pub struct Page { … } ``` `report.list` response: `reports`, `next?`. ## Fields ### `reports: Vec` Reports visible to the moderator. ### `next: Option` The `after` for the next page; absent on the last page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.Page.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-resolve/ --- # Struct command::report::Resolve > `report.resolve`: `note?` is ≤ 512 scalars. `zaun_community_protocol::command::report::Resolve` · Struct ```rust pub struct Resolve { … } ``` `report.resolve`: `note?` is ≤ 512 scalars. ## Fields ### `report_id: ReportId` The report. ### `outcome: Outcome` The outcome. ### `note: Option` ≤ 512 scalars. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.Resolve.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-report-review/ --- # Struct command::report::Review > `report.review`: `open` → `reviewing`. `zaun_community_protocol::command::report::Review` · Struct ```rust pub struct Review { … } ``` `report.review`: `open` → `reviewing`. ## Fields ### `report_id: ReportId` The report. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/report/struct.Review.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-role-create/ --- # Struct command::role::Create > `role.create`. `zaun_community_protocol::command::role::Create` · Struct ```rust pub struct Create { … } ``` `role.create`. ## Fields ### `name: String` 1–100 scalars. ### `color: Option` `0x000000`–`0xFFFFFF`. ### `hoist: Option` Shown separately. ### `mentionable: Option` Mentionable by anyone. ### `permissions: Option` Known bits only. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/role/struct.Create.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-role-delete/ --- # Struct command::role::Delete > `role.delete`. `zaun_community_protocol::command::role::Delete` · Struct ```rust pub struct Delete { … } ``` `role.delete`. ## Fields ### `role_id: RoleId` The role; never `@everyone`. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/role/struct.Delete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-role-reorder/ --- # Struct command::role::Reorder > `role.reorder`. `zaun_community_protocol::command::role::Reorder` · Struct ```rust pub struct Reorder { … } ``` `role.reorder`. ## Fields ### `positions: Vec` `(role_id, position)` pairs; no `@everyone`, unique roles and positions, positions ≥ 1. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/role/struct.Reorder.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-role-update/ --- # Struct command::role::Update > `role.update`: any of the `role.create` fields. `zaun_community_protocol::command::role::Update` · Struct ```rust pub struct Update { … } ``` `role.update`: any of the `role.create` fields. SPEC: "any of the fields above" is read as the `role.create` fields (positions change only through `role.reorder`). ## Fields ### `role_id: RoleId` The role. ### `name: Patch` New name. ### `color: Patch` New colour; `null` clears. ### `hoist: Patch` New hoist flag. ### `mentionable: Patch` New mentionable flag. ### `permissions: Patch` New permission set. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/role/struct.Update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-session-hello/ --- # Struct command::session::Hello > `session.hello`. `zaun_community_protocol::command::session::Hello` · Struct ```rust pub struct Hello { … } ``` `session.hello`. ## Fields ### `versions: Versions` The client's supported protocol range. ### `client_nonce: Nonce` Fresh per hello; echoed in the host's proof. ### `capabilities: Vec` ≤ 32 entries, each ≤ 64 bytes; unknown ones are ignored by the host. ### `community_id: Option` Unbound only: the community the client intends to join. Required, may be `null`. ### `held_descriptor: Option` The hash of the verified descriptor the client holds for the bound or requested community. A host whose current descriptor has this hash leaves the pair out of the welcome. Absent when the client holds none. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/session/struct.Hello.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-session-hostattachments/ --- # Struct command::session::HostAttachments > `session.welcome.attachments`. `zaun_community_protocol::command::session::HostAttachments` · Struct ```rust pub struct HostAttachments { … } ``` `session.welcome.attachments`. ## Fields ### `max_bytes: u64` The largest file the host takes, bytes. ### `file_servers: Vec` The XFTP servers (`xftp://…`) the host downloads uploads from. A member's client uploads only to these; the host never fetches from any other server, so an upload to another one fails with `failure: file_server`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/session/struct.HostAttachments.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-session-versions/ --- # Struct command::session::Versions > `{min, max}` protocol versions. `zaun_community_protocol::command::session::Versions` · Struct ```rust pub struct Versions { … } ``` `{min, max}` protocol versions. ## Fields ### `min: u16` Lowest supported version (≥ 1). ### `max: u16` Highest supported version (≥ `min`). ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/session/struct.Versions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-session-welcome/ --- # Struct command::session::Welcome > `session.welcome`. `zaun_community_protocol::command::session::Welcome` · Struct ```rust pub struct Welcome { … } ``` `session.welcome`. ## Fields ### `version: u16` The negotiated version. ### `host_public_key: PublicKey` The host key; `host_id` derives from it. ### `host_id: HostId` The host id. ### `host_challenge: Challenge` Fresh; valid until the next hello or 10 minutes. ### `proof: SignedJson` Signed `HostSessionProof`. ### `capabilities: Vec` Intersection of both sides' capabilities. ### `limits: Map` Effective limits the client MUST respect. SPEC: the key names are never defined; kept as an opaque object. ### `binding: Option` The connection's binding, if bound. ### `descriptor: Option` The bound or requested community's signed descriptor; `null` also when it has the hello's `held_descriptor` hash (the client uses its own). ### `delegation: Option` Its signed delegation. ### `attachments: Option` What the host accepts as attachments; absent when it takes none. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/session/struct.Welcome.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-signal-presence/ --- # Struct command::signal::Presence > `signal.presence`: `{ status?, activity?, viewing? }`, at least one of `status` and `viewing`. `zaun_community_protocol::command::signal::Presence` · Struct ```rust pub struct Presence { … } ``` `signal.presence`: `{ status?, activity?, viewing? }`, at least one of `status` and `viewing`. SPEC: the protocol writes the body as `{ status, activity? }` and later as `signal.presence { viewing }` (the client says which channel it views). Both forms are accepted, so `status` is optional here; a body with neither `status` nor `viewing` is a bad request. `viewing: null` means "no channel"; `viewing` is never forwarded to other members. ## Fields ### `status: Option` The member's presence. ### `activity: Option` What the member is doing (absent: nothing). Dropped when `status` is `invisible`. ### `viewing: Patch` The channel the client is viewing (typing signals go only to viewers); `null` = none. ## Trait implementations `Body`, `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/signal/struct.Presence.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-signal-typing/ --- # Struct command::signal::Typing > `signal.typing { channel_id }`. `zaun_community_protocol::command::signal::Typing` · Struct ```rust pub struct Typing { … } ``` `signal.typing { channel_id }`. SPEC: the body names `channel_id`, which a channel-scoped envelope also carries; it is optional here as for the channel commands. ## Fields ### `channel_id: Option` The channel typed in. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/signal/struct.Typing.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-ack/ --- # Struct command::sync::Ack > `sync.ack`: the highest contiguous sequence applied per stream. Not idempotency-recorded; lower values are ignored by the host. `zaun_community_protocol::command::sync::Ack` · Struct ```rust pub struct Ack { … } ``` `sync.ack`: the highest contiguous sequence applied per stream. Not idempotency-recorded; lower values are ignored by the host. ## Fields ### `member: u64` `member_seq`. ### `channels: Vec` ≤ 100 channel cursors, each channel once. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/struct.Ack.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-channelevents/ --- # Struct command::sync::ChannelEvents > One channel of `sync.resume.channels`. `zaun_community_protocol::command::sync::ChannelEvents` · Struct ```rust pub struct ChannelEvents { … } ``` One channel of `sync.resume.channels`. ## Fields ### `channel_id: ChannelId` The channel. ### `events: Vec>` Event envelopes in sequence order (≤ 50). ### `has_more: bool` Continue with `sync.events`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Serialize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/response/struct.ChannelEvents.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-communitysnapshot/ --- # Struct command::sync::CommunitySnapshot > The single item of `part: "community"`. `zaun_community_protocol::command::sync::CommunitySnapshot` · Struct ```rust pub struct CommunitySnapshot { … } ``` The single item of `part: "community"`. SPEC: the item's field names are not given ("profile, descriptor, delegation, the member's own member object"); `profile`, `descriptor`, `delegation`, `member` are used. ## Fields ### `profile: CommunityProfile` Host-managed profile. ### `descriptor: Option` Signed descriptor; absent when it is the one the session's welcome gave or confirmed. ### `delegation: Option` Signed delegation; absent with the descriptor. ### `member: Member` The member's own member object. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/response/struct.CommunitySnapshot.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-events/ --- # Struct command::sync::Events > `sync.events`. `zaun_community_protocol::command::sync::Events` · Struct ```rust pub struct Events { … } ``` `sync.events`. ## Fields ### `stream: Stream` `member` or `channel` (never `live`). ### `channel_id: Option` Required for the channel stream, absent for the member stream. ### `after: u64` The client's cursor. ### `limit: u32` 1–200. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/struct.Events.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-eventspage/ --- # Struct command::sync::EventsPage > `sync.events` response, also the `member` part of `sync.resume`. `zaun_community_protocol::command::sync::EventsPage` · Struct ```rust pub struct EventsPage { … } ``` `sync.events` response, also the `member` part of `sync.resume`. ## Fields ### `events: Vec>` Event envelopes in sequence order. ### `has_more: bool` More events follow. ### `floor: Option` Channel stream only: the member's floor. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Serialize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/response/struct.EventsPage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-pagecursor/ --- # Struct command::sync::PageCursor > A snapshot page cursor: a 16-byte role or channel id. `zaun_community_protocol::command::sync::PageCursor` · Struct ```rust pub struct PageCursor(…) ``` A snapshot page cursor: a 16-byte role or channel id. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/struct.PageCursor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-resume/ --- # Struct command::sync::Resume > `sync.resume`. `zaun_community_protocol::command::sync::Resume` · Struct ```rust pub struct Resume { … } ``` `sync.resume`. ## Fields ### `member_after: u64` The member-stream cursor. ### `channels: Vec` ≤ 100 channel cursors, each channel once. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/struct.Resume.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-resumed/ --- # Struct command::sync::Resumed > `sync.resume` response. `zaun_community_protocol::command::sync::Resumed` · Struct ```rust pub struct Resumed { … } ``` `sync.resume` response. ## Fields ### `member: Option` Member-stream events; absent or `null` when replaced by a `resync` entry. ### `channels: Vec` Per listed channel. ### `resync: Vec` Streams whose cursor is older than retention. ### `hidden: Vec` Listed channels the member can no longer view. ### `new: Vec` Viewable channels the client did not list. ### `floors: Vec` Floors of listed channels. ### `chain_heads: Vec` Appendix A only (experimental); empty otherwise. Kept raw. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Serialize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/response/struct.Resumed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-snapshot/ --- # Struct command::sync::Snapshot > `sync.snapshot`. `zaun_community_protocol::command::sync::Snapshot` · Struct ```rust pub struct Snapshot { … } ``` `sync.snapshot`. ## Fields ### `part: SnapshotPart` Which part. ### `after: Option` Page start: the last role or channel id of the previous page. ### `limit: Option` 1–100. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/struct.Snapshot.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-sync-snapshotpage/ --- # Struct command::sync::SnapshotPage > `sync.snapshot` response. `zaun_community_protocol::command::sync::SnapshotPage` · Struct ```rust pub struct SnapshotPage { … } ``` `sync.snapshot` response. ## Fields ### `as_of_member_seq: u64` The member stream position the page was read at. ### `items: Vec` The items of the requested part. ### `next: Option` The `after` of the next page. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/sync/response/struct.SnapshotPage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-join/ --- # Struct command::voice::Join > `voice.join`: enter a voice channel (leaving any other one). `zaun_community_protocol::command::voice::Join` · Struct ```rust pub struct Join { … } ``` `voice.join`: enter a voice channel (leaving any other one). ## Fields ### `channel_id: Option` The voice channel (or on the envelope). ### `key_package: Opaque` The member's key package for this stay, at most 6 KiB. ### `self_mute: bool` Join muted. ### `self_deaf: bool` Join deafened. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Join.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-joined/ --- # Struct command::voice::Joined > The `voice.join` response. `zaun_community_protocol::command::voice::Joined` · Struct ```rust pub struct Joined { … } ``` The `voice.join` response. ## Fields ### `channel_id: ChannelId` The voice channel. ### `voice_session: VoiceSessionId` The joiner's new stay. ### `participants: Vec` Everyone in the channel, the joiner included, oldest first, with key packages. ### `ice_servers: Vec` ICE servers to use. ### `ice_policy: IcePolicy` Which candidates to use. ### `mesh_max: u32` The host's participant cap for any voice channel. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Joined.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-keyfor/ --- # Struct command::voice::KeyFor > One entry of `voice.keys`. `zaun_community_protocol::command::voice::KeyFor` · Struct ```rust pub struct KeyFor { … } ``` One entry of `voice.keys`. ## Fields ### `to: MemberId` The participant it is for. ### `wrapped: Opaque` The sender's media key wrapped for that participant, opaque, at most 1.5 KiB. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.KeyFor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-keys/ --- # Struct command::voice::Keys > `voice.keys`: the sender's media key for `epoch`, wrapped for each other participant. A whole mesh always fits in one command, so an epoch is never split. `zaun_community_protocol::command::voice::Keys` · Struct ```rust pub struct Keys { … } ``` `voice.keys`: the sender's media key for `epoch`, wrapped for each other participant. A whole mesh always fits in one command, so an epoch is never split. ## Fields ### `epoch: u64` The sender's key epoch. ### `sender_keys: Opaque` The sender's signed message for this epoch, the same for every recipient (it covers every wrapped key), opaque, at most 6 KiB. Each recipient receives it. ### `keys: Vec` One entry per recipient, at most `mesh_max − 1` and each recipient once. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Keys.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-leave/ --- # Struct command::voice::Leave > `voice.leave`: leave the voice channel the member is in. `zaun_community_protocol::command::voice::Leave` · Struct ```rust pub struct Leave { … } ``` `voice.leave`: leave the voice channel the member is in. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Leave.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-moderate/ --- # Struct command::voice::Moderate > `voice.moderate`: server mute or deafen, move or disconnect another member. `zaun_community_protocol::command::voice::Moderate` · Struct ```rust pub struct Moderate { … } ``` `voice.moderate`: server mute or deafen, move or disconnect another member. ## Fields ### `member_id: MemberId` The member acted on. ### `server_mute: Option` Server mute (`MUTE_MEMBERS`). ### `server_deaf: Option` Server deafen (`DEAFEN_MEMBERS`). ### `move_to: Option` Move to this voice channel (`MOVE_MEMBERS` in both channels). ### `disconnect: bool` Disconnect from voice (`MOVE_MEMBERS`). ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Moderate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-signal/ --- # Struct command::voice::Signal > `voice.signal`: WebRTC signalling for one other participant of the same channel. `zaun_community_protocol::command::voice::Signal` · Struct ```rust pub struct Signal { … } ``` `voice.signal`: WebRTC signalling for one other participant of the same channel. ## Fields ### `to: MemberId` The participant it is for. ### `voice_session: VoiceSessionId` That participant's current stay; a stale one is refused. ### `data: Opaque` SDP or ICE, opaque, at most 8 KiB. ## Trait implementations `Body`, `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Signal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-command-voice-update/ --- # Struct command::voice::Update > `voice.update`: the member's own mute and deafen. `zaun_community_protocol::command::voice::Update` · Struct ```rust pub struct Update { … } ``` `voice.update`: the member's own mute and deafen. ## Fields ### `self_mute: Option` New self-mute. ### `self_deaf: Option` New self-deafen. ## Trait implementations `Body`, `Clone`, `Copy`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Validate` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/voice/struct.Update.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-secretkey/ --- # Struct crypto::SecretKey > A suite-1 composite private key: `mldsaSeed` (FIPS 204 ξ, 32 B) ‖ `edSK` (32 B). `zaun_community_protocol::crypto::SecretKey` · Struct ```rust pub struct SecretKey { … } ``` A suite-1 composite private key: `mldsaSeed` (FIPS 204 ξ, 32 B) ‖ `edSK` (32 B). Never on the wire. `Debug` is redacted and the bytes are zeroized on drop. Its component keys are used only inside this composite (RFC 10073 the protocol). The ML-DSA-65 expanded signing key is derived from the seed once, on first use, and kept with the key (it is zeroized on drop too): deriving it is about a fifth of the cost of a signature, and a host signs a session proof for every `session.hello`. ## Methods ### `generate` ```rust pub fn generate() -> Result ``` A fresh key from the OS CSPRNG. # Errors `RngError` when `getrandom` fails. ### `from_bytes` ```rust pub fn from_bytes(bytes: &[u8; 64]) -> Self ``` Wraps the 64-byte encoding. The caller zeroizes its own copy. ### `expose_secret` ```rust pub const fn expose_secret(&self) -> &[u8; 64] ``` The 64-byte encoding, for sealed storage only. ### `public_key` ```rust pub fn public_key(&self) -> PublicKey ``` The composite public key: suite `0x01` ‖ `mldsaPK` ‖ `edPK`. ## Trait implementations `Clone`, `Debug`, `Drop`, `Zeroize`, `ZeroizeOnDrop` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/secret/struct.SecretKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-sha3hasher/ --- # Struct crypto::Sha3Hasher > An incremental `content_hash`, for attachment files read in pieces. `zaun_community_protocol::crypto::Sha3Hasher` · Struct ```rust pub struct Sha3Hasher(…) ``` An incremental `content_hash`, for attachment files read in pieces. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty hash. ### `update` ```rust pub fn update(&mut self, bytes: &[u8]) ``` Feeds `bytes`. ### `finalize` ```rust pub fn finalize(self) -> [u8; 32] ``` The digest. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/hash/struct.Sha3Hasher.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-frameopener/ --- # Struct crypto::voice::FrameOpener > Opens one sender's frames for one KID, rejecting replays. `zaun_community_protocol::crypto::voice::FrameOpener` · Struct ```rust pub struct FrameOpener { … } ``` Opens one sender's frames for one KID, rejecting replays. ## Methods ### `new` ```rust pub fn new(base: &SenderKey, kid: u64) -> Self ``` An opener for `base` under `kid` (decryption only). ### `kid` ```rust pub const fn kid(&self) -> u64 ``` The KID this opener accepts. ### `open` ```rust pub fn open(&mut self, metadata: &[u8], frame: &[u8]) -> Result, VoiceError> ``` Opens a sealed frame. The counter is recorded only once the frame authenticates. # Errors `VoiceError::Header`, `VoiceError::UnknownKid` for another KID, `VoiceError::Replay` or `VoiceError::Open`. ## Trait implementations `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/struct.FrameOpener.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-framesealer/ --- # Struct crypto::voice::FrameSealer > Seals this participant's frames under one base key and KID. The counter starts at zero and never repeats; after `FRAMES_PER_KEY` frames it refuses and the sender rekeys. `zaun_community_protocol::crypto::voice::FrameSealer` · Struct ```rust pub struct FrameSealer { … } ``` Seals this participant's frames under one base key and KID. The counter starts at zero and never repeats; after `FRAMES_PER_KEY` frames it refuses and the sender rekeys. ## Methods ### `new` ```rust pub fn new(base: &SenderKey, kid: u64) -> Self ``` A sealer for `base` under `kid`. A base key is used by one sender only. ### `kid` ```rust pub const fn kid(&self) -> u64 ``` The KID frames are sealed under. ### `seal` ```rust pub fn seal(&mut self, metadata: &[u8], frame: &[u8]) -> Result, VoiceError> ``` `header ‖ AES-256-GCM(frame)`, authenticating the header and `metadata`. # Errors `VoiceError::Exhausted` after `FRAMES_PER_KEY` frames. ## Trait implementations `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/struct.FrameSealer.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-groupkeys/ --- # Struct crypto::voice::GroupKeys > A participant's key state for one voice session. `zaun_community_protocol::crypto::voice::GroupKeys` · Struct ```rust pub struct GroupKeys { … } ``` A participant's key state for one voice session. ## Methods ### `new` ```rust pub fn new(member_key: &SecretKey, community_id: CommunityId, channel_id: ChannelId, member_id: MemberId, min_suite: u8, created_at: u64) -> Result ``` Starts a voice session: a fresh voice session id and X-Wing key pair, and the key package signed by `member_key`. # Errors `VoiceError::Rng` or `VoiceError::Signed`. ### `voice_session` ```rust pub const fn voice_session(&self) -> VoiceSessionId ``` This participant's voice session. ### `key_package` ```rust pub const fn key_package(&self) -> &SignedKeyPackage ``` This participant's signed key package (send its `SignedKeyPackage::to_wire`). ### `needs_rekey` ```rust pub const fn needs_rekey(&self) -> bool ``` Whether the peer set changed since the last `Self::rekey`. ### `peers` ```rust pub fn peers(&self) -> impl Iterator + '_ ``` The voice sessions of the current peers. ### `add_peer` ```rust pub fn add_peer(&mut self, member_id: MemberId, member_key: &PublicKey, package_wire: &[u8]) -> Result ``` Verifies and adds a peer's key package. `member_key` is the roster's key for `member_id`. Re-adding the same package is a no-op. # Errors As `KeyPackage::verify`; `VoiceError::Recipients` beyond `MAX_RECIPIENTS` peers; `VoiceError::KidCollision` when its KID tag equals another participant's (the newer participant rejoins with a new voice session); `VoiceError::Mismatch` for a different package under a known session. ### `remove_peer` ```rust pub fn remove_peer(&mut self, session: &VoiceSessionId) -> bool ``` Forgets a peer and its keys. Returns whether it was known. ### `rekey` ```rust pub fn rekey(&mut self, member_key: &SecretKey, created_at: u64) -> Result ``` Makes the next epoch: a fresh base key wrapped to every current peer and the signed sender-keys message. The new key seals only after `Self::activate`. # Errors `VoiceError::Exhausted` after 2^32 epochs; `VoiceError::Rng`; HPKE or signing failures. ### `activate` ```rust pub fn activate(&mut self) -> bool ``` Switches sealing to the newest epoch. Returns whether there was one waiting. ### `seal` ```rust pub fn seal(&mut self, metadata: &[u8], frame: &[u8]) -> Result, VoiceError> ``` Seals one of this participant's frames under the active epoch. # Errors `VoiceError::NoSenderKey` before the first activation; `VoiceError::Exhausted`. ### `accept_sender_keys` ```rust pub fn accept_sender_keys(&mut self, from: &VoiceSessionId, sender_keys_wire: &[u8], wrapped: &[u8]) -> Result ``` Installs a peer's epoch key: verifies the sender-keys message under the peer's member key, checks that `wrapped` is the key it signed for this participant, opens it, and keeps the peer's previous epoch for frames still in flight. # Errors `VoiceError::UnknownPeer`, verification errors, `VoiceError::NotARecipient`, `VoiceError::WrappedHash`, `VoiceError::StaleEpoch` or `VoiceError::Unwrap`. ### `open` ```rust pub fn open(&mut self, metadata: &[u8], frame: &[u8]) -> Result<(VoiceSessionId, Vec), VoiceError> ``` Opens a frame from whichever peer's KID it carries. # Errors `VoiceError::Header`, `VoiceError::UnknownKid`, `VoiceError::Replay` or `VoiceError::Open`. ### `open_from` ```rust pub fn open_from(&mut self, from: &VoiceSessionId, metadata: &[u8], frame: &[u8]) -> Result, VoiceError> ``` Opens a frame that the transport says came from `from`; another peer's KID is refused. # Errors As `Self::open`, and `VoiceError::UnknownPeer`. ## Trait implementations `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/group/struct.GroupKeys.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-header/ --- # Struct crypto::voice::Header > An SFrame header (RFC 9605 the protocol). `zaun_community_protocol::crypto::voice::Header` · Struct ```rust pub struct Header { … } ``` An SFrame header (RFC 9605 the protocol). ## Fields ### `kid: u64` The key id. ### `ctr: u64` The counter. ## Methods ### `encode_into` ```rust pub fn encode_into(&self, out: &mut Vec) ``` Appends the minimal encoding. ### `to_bytes` ```rust pub fn to_bytes(&self) -> Vec ``` The minimal encoding. ### `parse` ```rust pub fn parse(frame: &[u8]) -> Result<(Self, usize), VoiceError> ``` Parses the header at the start of `frame`; returns it and its length. Non-minimal encodings are rejected, so each header has exactly one encoding. # Errors `VoiceError::Header`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sframe/struct.Header.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-keypackage/ --- # Struct crypto::voice::KeyPackage > A participant's voice key for one session in one voice channel. `zaun_community_protocol::crypto::voice::KeyPackage` · Struct ```rust pub struct KeyPackage { … } ``` A participant's voice key for one session in one voice channel. ## Fields ### `suite: u8` 2: the voice suite. ### `community_id: CommunityId` 3: the community. ### `channel_id: ChannelId` 4: the voice channel. ### `member_id: MemberId` 5: the participant; its member key signs. ### `voice_session: VoiceSessionId` 6: this participation. ### `kem_public: VoicePublicKey` 7: the X-Wing public key sender keys are wrapped to. ### `created_at: u64` 8: ms since the epoch. ## Methods ### `create` ```rust pub fn create(member_key: &SecretKey, identity: &VoiceIdentity, community_id: CommunityId, channel_id: ChannelId, member_id: MemberId, voice_session: VoiceSessionId, created_at: u64) -> Result ``` Makes and signs this participant's key package. # Errors `VoiceError::Signed` when signing fails. ### `verify` ```rust pub fn verify(wire: &[u8], member_key: &PublicKey, expected: &PackageExpectation) -> Result ``` Verifies a peer's key package from the wire under `member_key` (the roster's key for `expected.member_id`), then checks the community, channel and member. # Errors `VoiceError::Length`, `VoiceError::Signed` (checked before decoding) or `VoiceError::Mismatch`. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/package/struct.KeyPackage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-packageexpectation/ --- # Struct crypto::voice::PackageExpectation > What a receiver expects of a peer's key package. `zaun_community_protocol::crypto::voice::PackageExpectation` · Struct ```rust pub struct PackageExpectation { … } ``` What a receiver expects of a peer's key package. ## Fields ### `community_id: CommunityId` The community of the voice channel. ### `channel_id: ChannelId` The voice channel. ### `member_id: MemberId` The member the roster says this package belongs to. ### `min_suite: u8` The community's minimum signature suite (`0x01` today). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/package/struct.PackageExpectation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-recipiententry/ --- # Struct crypto::voice::RecipientEntry > One recipient of a sender's epoch key. `zaun_community_protocol::crypto::voice::RecipientEntry` · Struct ```rust pub struct RecipientEntry { … } ``` One recipient of a sender's epoch key. ## Fields ### `member_id: MemberId` The recipient. ### `voice_session: VoiceSessionId` The recipient's voice session. ### `wrapped_hash: [u8; 32]` `SHA3-256` of the `WrappedKey` made for it. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.RecipientEntry.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-rekey/ --- # Struct crypto::voice::Rekey > What a rekey sends: one signed sender-keys message for everyone and one wrapped key each. `zaun_community_protocol::crypto::voice::Rekey` · Struct ```rust pub struct Rekey { … } ``` What a rekey sends: one signed sender-keys message for everyone and one wrapped key each. ## Fields ### `epoch: u32` The new epoch. ### `sender_keys: Vec` The signed `VoiceSenderKeys`, wire form (the same for every recipient). ### `targets: Vec` The wrapped keys, one per current peer. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/group/struct.Rekey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-rekeytarget/ --- # Struct crypto::voice::RekeyTarget > One recipient's share of a `Rekey`. `zaun_community_protocol::crypto::voice::RekeyTarget` · Struct ```rust pub struct RekeyTarget { … } ``` One recipient's share of a `Rekey`. ## Fields ### `member_id: MemberId` The recipient. ### `voice_session: VoiceSessionId` The recipient's voice session. ### `wrapped: WrappedKey` Its wrapped key; it also needs `Rekey::sender_keys`. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/group/struct.RekeyTarget.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-senderkey/ --- # Struct crypto::voice::SenderKey > An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped. `zaun_community_protocol::crypto::voice::SenderKey` · Struct ```rust pub struct SenderKey(…) ``` An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped. ## Methods ### `generate` ```rust pub fn generate() -> Result ``` A fresh base key from the OS CSPRNG. # Errors `VoiceError::Rng` when the CSPRNG fails. ### `from_bytes` ```rust pub fn from_bytes(bytes: &[u8; 32]) -> Self ``` Wraps raw bytes. Tests only; real keys come from `Self::generate` or `Self::unwrap`. ### `wrap_for` ```rust pub fn wrap_for(&self, ctx: &WrapContext, recipient: &SignedKeyPackage) -> Result ``` Wraps this key to `recipient`'s verified key package. # Errors `VoiceError::Mismatch` when the package is for another community or channel, `VoiceError::Rng`, or `VoiceError::Unwrap` if HPKE fails. ### `unwrap` ```rust pub fn unwrap(identity: &VoiceIdentity, ctx: &WrapContext, own: &SignedKeyPackage, wrapped: &WrappedKey) -> Result ``` Opens a key wrapped to `own` (this participant's package) with `identity`. The caller must already have checked the wrapped key against a verified `SignedSenderKeys` (`SignedSenderKeys::entry_for`); `super::GroupKeys` does both. # Errors `VoiceError::Unwrap` when the key was not made for this package and context. ## Trait implementations `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.SenderKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-senderkeys/ --- # Struct crypto::voice::SenderKeys > The signed statement of one sender's epoch (see the module table). `zaun_community_protocol::crypto::voice::SenderKeys` · Struct ```rust pub struct SenderKeys { … } ``` The signed statement of one sender's epoch (see the module table). ## Fields ### `suite: u8` 2: the voice suite. ### `community_id: CommunityId` 3: the community. ### `channel_id: ChannelId` 4: the voice channel. ### `sender_member: MemberId` 5: the sender; its member key signs. ### `sender_session: VoiceSessionId` 6: the sender's voice session. ### `epoch: u32` 7: the epoch. ### `kid: u64` 8: the SFrame KID of this epoch. ### `recipients: Vec` 9: the recipients, at most `MAX_RECIPIENTS`, each once. ### `created_at: u64` 10: ms since the epoch. ## Methods ### `sign_epoch` ```rust pub fn sign_epoch(member_key: &SecretKey, ctx: &WrapContext, recipients: Vec, created_at: u64) -> Result ``` Signs a sender's epoch over the wrapped keys it made. # Errors `VoiceError::Recipients` for too many or repeated recipients; `VoiceError::Signed`. ### `verify` ```rust pub fn verify(wire: &[u8], sender_key: &PublicKey, expected: &SenderKeysExpectation) -> Result ``` Verifies a sender-keys message from the wire under the sender's member key. # Errors `VoiceError::Length`, `VoiceError::Decode`, `VoiceError::Signed` (checked before the body is decoded) or `VoiceError::Mismatch`. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.SenderKeys.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-senderkeysexpectation/ --- # Struct crypto::voice::SenderKeysExpectation > What a recipient expects of a sender-keys message. `zaun_community_protocol::crypto::voice::SenderKeysExpectation` · Struct ```rust pub struct SenderKeysExpectation { … } ``` What a recipient expects of a sender-keys message. ## Fields ### `community_id: CommunityId` The community. ### `channel_id: ChannelId` The voice channel. ### `sender_member: MemberId` The sender the roster names; its member key verifies. ### `min_suite: u8` The community's minimum signature suite (`0x01` today). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.SenderKeysExpectation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-signedkeypackage/ --- # Struct crypto::voice::SignedKeyPackage > A key package whose signature was made here or verified. `zaun_community_protocol::crypto::voice::SignedKeyPackage` · Struct ```rust pub struct SignedKeyPackage(…) ``` A key package whose signature was made here or verified. ## Methods ### `package` ```rust pub const fn package(&self) -> &KeyPackage ``` The package. ### `hash` ```rust pub fn hash(&self) -> [u8; 32] ``` `SHA3-256` of the canonical bytes: bound into every key wrapped to this package. ### `to_wire` ```rust pub fn to_wire(&self) -> Vec ``` The wire form: canonical bytes ‖ signature. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/package/struct.SignedKeyPackage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-signedsenderkeys/ --- # Struct crypto::voice::SignedSenderKeys > A sender-keys message whose signature was made here or verified. `zaun_community_protocol::crypto::voice::SignedSenderKeys` · Struct ```rust pub struct SignedSenderKeys(…) ``` A sender-keys message whose signature was made here or verified. ## Methods ### `keys` ```rust pub const fn keys(&self) -> &SenderKeys ``` The statement. ### `wrap_context` ```rust pub const fn wrap_context(&self) -> WrapContext ``` The HPKE context of this epoch. ### `entry_for` ```rust pub fn entry_for(&self, own: &SignedKeyPackage, wrapped: &WrappedKey) -> Result<&RecipientEntry, VoiceError> ``` The entry for `own`, after checking that `wrapped` is the key the sender signed for it. # Errors `VoiceError::NotARecipient` or `VoiceError::WrappedHash`. ### `to_wire` ```rust pub fn to_wire(&self) -> Result, VoiceError> ``` The wire form: `u32` length ‖ canonical bytes ‖ signature. # Errors `VoiceError::Encode` (never expected: the bytes were checked when made). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.SignedSenderKeys.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-voiceidentity/ --- # Struct crypto::voice::VoiceIdentity > A voice session's X-Wing key pair. The secret is the 32-byte X-Wing seed, zeroized on drop and never printed. It lives only as long as the voice session; it is never stored. `zaun_community_protocol::crypto::voice::VoiceIdentity` · Struct ```rust pub struct VoiceIdentity { … } ``` A voice session's X-Wing key pair. The secret is the 32-byte X-Wing seed, zeroized on drop and never printed. It lives only as long as the voice session; it is never stored. ## Methods ### `generate` ```rust pub fn generate() -> Result ``` A fresh key pair from the OS CSPRNG. # Errors `VoiceError::Rng` when the CSPRNG fails. ### `from_seed` ```rust pub fn from_seed(seed: &[u8; 32]) -> Result ``` The key pair of an X-Wing seed (the X-Wing decapsulation key, draft the protocol). Tests and known-answer vectors only; real sessions use `Self::generate`. # Errors `VoiceError::PublicKey` if the derived public key does not re-parse (never expected). ### `public_key` ```rust pub const fn public_key(&self) -> &VoicePublicKey ``` The public half, published in the key package. ## Trait implementations `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/identity/struct.VoiceIdentity.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-voicepublickey/ --- # Struct crypto::voice::VoicePublicKey > An X-Wing encapsulation key (ML-KEM-768 ‖ X25519, 1 216 bytes), validated on parse. `zaun_community_protocol::crypto::voice::VoicePublicKey` · Struct ```rust pub struct VoicePublicKey { … } ``` An X-Wing encapsulation key (ML-KEM-768 ‖ X25519, 1 216 bytes), validated on parse. ## Methods ### `from_bytes` ```rust pub fn from_bytes(bytes: &[u8]) -> Result ``` Parses and validates the encoding (the ML-KEM-768 part must be canonical). # Errors `VoiceError::PublicKey` for an invalid key, `VoiceError::Length` for a wrong length. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 1216] ``` The 1 216-byte encoding. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/identity/struct.VoicePublicKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-voicesessionid/ --- # Struct crypto::voice::VoiceSessionId > One participation in a voice channel. A member draws a fresh one on every join, so KIDs and epochs never repeat across joins. `zaun_community_protocol::crypto::voice::VoiceSessionId` · Struct ```rust pub struct VoiceSessionId(…) ``` One participation in a voice channel. A member draws a fresh one on every join, so KIDs and epochs never repeat across joins. ## Methods ### `random` ```rust pub fn random() -> Result ``` A fresh, non-zero session id. # Errors `RngError` when the CSPRNG fails. ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Unpadded base64url, like every other id. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Parses unpadded base64url. # Errors `b64::B64Error` for bad text or the wrong length. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/session/struct.VoiceSessionId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-wrapcontext/ --- # Struct crypto::voice::WrapContext > Who wraps, for which channel and epoch: bound into the HPKE `info`. `zaun_community_protocol::crypto::voice::WrapContext` · Struct ```rust pub struct WrapContext { … } ``` Who wraps, for which channel and epoch: bound into the HPKE `info`. ## Fields ### `community_id: CommunityId` The community. ### `channel_id: ChannelId` The voice channel. ### `sender_member: MemberId` The sender. ### `sender_session: VoiceSessionId` The sender's voice session. ### `epoch: u32` The sender's epoch. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.WrapContext.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-crypto-voice-wrappedkey/ --- # Struct crypto::voice::WrappedKey > A base key wrapped to one recipient: X-Wing `enc` ‖ AES-256-GCM ciphertext ‖ tag. `zaun_community_protocol::crypto::voice::WrappedKey` · Struct ```rust pub struct WrappedKey(…) ``` A base key wrapped to one recipient: X-Wing `enc` ‖ AES-256-GCM ciphertext ‖ tag. ## Methods ### `from_bytes` ```rust pub fn from_bytes(bytes: &[u8]) -> Result ``` Parses the wire form. # Errors `VoiceError::Length` unless exactly `WRAPPED_KEY_LEN` bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 1168] ``` The wire form. ### `hash` ```rust pub fn hash(&self) -> [u8; 32] ``` `SHA3-256` of the wire form, as signed in `SenderKeys`. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/crypto/voice/sender/struct.WrappedKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-encoding-reader/ --- # Struct encoding::Reader > Reads canonical encodings from a byte slice. Lengths and counts are checked against the field's limit and the remaining input before anything is allocated. `zaun_community_protocol::encoding::Reader` · Struct ```rust pub struct Reader<'a> { … } ``` Reads canonical encodings from a byte slice. Lengths and counts are checked against the field's limit and the remaining input before anything is allocated. ## Methods ### `bytes` ```rust pub fn bytes(&mut self, max: usize) -> Result<&'a [u8], DecodeError> ``` Variable `bytes` of at most `max` bytes. # Errors `DecodeError::OverLimit` or `DecodeError::Truncated`. ### `string` ```rust pub fn string(&mut self, max: usize) -> Result<&'a str, DecodeError> ``` `string` of at most `max` bytes; valid UTF-8, not normalised. # Errors As `Self::bytes`, or `DecodeError::InvalidUtf8`. ### `option` ```rust pub fn option Result>(&mut self, f: impl FnOnce(&mut Self) -> Result) -> Result, DecodeError> ``` `option` with the value read by `f`; tags other than `0x00`/`0x01` are errors. # Errors `DecodeError::InvalidOptionTag`, or whatever `f` returns. ### `list` ```rust pub fn list Result>(&mut self, max: usize, f: impl FnMut(&mut Self) -> Result) -> Result, DecodeError> ``` `list` of at most `max` elements, each read by `f`. # Errors `DecodeError::OverLimit`, `DecodeError::Truncated`, or whatever `f` returns. ### `new` ```rust pub const fn new(input: &'a [u8]) -> Self ``` A reader over `input`. ### `remaining` ```rust pub const fn remaining(&self) -> usize ``` Bytes not yet read. ### `finish` ```rust pub const fn finish(self) -> Result<(), DecodeError> ``` Ends a top-level decode. # Errors `DecodeError::TrailingBytes` when input remains. ### `fixed` ```rust pub fn fixed(&mut self, n: usize) -> Result<&'a [u8], DecodeError> ``` `bytes[n]`: the next `n` bytes. # Errors `DecodeError::Truncated`. ### `array` ```rust pub fn array(&mut self) -> Result<[u8; N], DecodeError> ``` `bytes[N]` as an array. # Errors `DecodeError::Truncated`. ### `peek_u8` ```rust pub fn peek_u8(&self) -> Result ``` The next byte without consuming it. # Errors `DecodeError::Truncated`. ### `u8` ```rust pub fn u8(&mut self) -> Result ``` `u8`. # Errors `DecodeError::Truncated`. ### `u16` ```rust pub fn u16(&mut self) -> Result ``` `u16`, big-endian. # Errors `DecodeError::Truncated`. ### `u32` ```rust pub fn u32(&mut self) -> Result ``` `u32`, big-endian. # Errors `DecodeError::Truncated`. ### `u64` ```rust pub fn u64(&mut self) -> Result ``` `u64`, big-endian. # Errors `DecodeError::Truncated`. ### `bool` ```rust pub fn bool(&mut self) -> Result ``` `bool`: only `0x00` and `0x01`. # Errors `DecodeError::InvalidBool` or `DecodeError::Truncated`. ### `get` ```rust pub fn get(&mut self) -> Result ``` Reads a value with a canonical decoding. # Errors Whatever the value's decoder returns. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/reader/struct.Reader.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-encoding-writer/ --- # Struct encoding::Writer > Appends canonical encodings to a buffer. Variable fields take their limit and fail above it, mirroring `super::Reader`. `zaun_community_protocol::encoding::Writer` · Struct ```rust pub struct Writer { … } ``` Appends canonical encodings to a buffer. Variable fields take their limit and fail above it, mirroring `super::Reader`. ## Methods ### `new` ```rust pub fn new() -> Self ``` An empty writer. ### `into_bytes` ```rust pub fn into_bytes(self) -> Vec ``` The encoding so far. ### `u8` ```rust pub fn u8(&mut self, value: u8) ``` `u8`. ### `u16` ```rust pub fn u16(&mut self, value: u16) ``` `u16`, big-endian. ### `u32` ```rust pub fn u32(&mut self, value: u32) ``` `u32`, big-endian. ### `u64` ```rust pub fn u64(&mut self, value: u64) ``` `u64`, big-endian. ### `bool` ```rust pub fn bool(&mut self, value: bool) ``` `bool`: `0x00` or `0x01`. ### `fixed` ```rust pub fn fixed(&mut self, bytes: &[u8]) ``` `bytes[N]`: the bytes, no prefix. ### `bytes` ```rust pub fn bytes(&mut self, bytes: &[u8], max: usize) -> Result<(), EncodeError> ``` Variable `bytes`: `u32` length, then the bytes. # Errors `EncodeError::OverLimit` when longer than `max`. ### `string` ```rust pub fn string(&mut self, text: &str, max: usize) -> Result<(), EncodeError> ``` `string`: `u32` byte length, then UTF-8. `max` is in bytes. # Errors `EncodeError::OverLimit` when longer than `max` bytes. ### `option` ```rust pub fn option Result<(), EncodeError>>(&mut self, value: Option<&T>, f: impl FnOnce(&mut Self, &T) -> Result<(), EncodeError>) -> Result<(), EncodeError> ``` `option`: `0x00`, or `0x01` then the value written by `f`. # Errors Whatever `f` returns. ### `list` ```rust pub fn list Result<(), EncodeError>>(&mut self, items: &[T], max: usize, f: impl FnMut(&mut Self, &T) -> Result<(), EncodeError>) -> Result<(), EncodeError> ``` `list`: `u32` count, then each element written by `f`. # Errors `EncodeError::OverLimit` when more than `max` elements, or whatever `f` returns. ### `put` ```rust pub fn put(&mut self, value: &T) -> Result<(), EncodeError> ``` Writes a value with a canonical encoding. # Errors Whatever the value's encoder returns. ## Trait implementations `Clone`, `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/writer/struct.Writer.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-bodyhash/ --- # Struct envelope::BodyHash > SHA3-256 of a command's `body` JSON text **exactly as received**: reformatting the same JSON gives a different hash, which is why retries must resend byte-identical bodies. `zaun_community_protocol::envelope::BodyHash` · Struct ```rust pub struct BodyHash(…) ``` SHA3-256 of a command's `body` JSON text **exactly as received**: reformatting the same JSON gives a different hash, which is why retries must resend byte-identical bodies. ## Methods ### `of` ```rust pub fn of(body: &RawValue) -> Self ``` Hashes a received body. ### `of_text` ```rust pub fn of_text(text: &str) -> Self ``` Hashes body JSON text. ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps a stored hash. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The digest bytes, for storage. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/idempotency/struct.BodyHash.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-commandenvelope/ --- # Struct envelope::CommandEnvelope > `{ "v", "type", "request_id", "community_id", "channel_id"?, "body" }`. `zaun_community_protocol::envelope::CommandEnvelope` · Struct ```rust pub struct CommandEnvelope { … } ``` `{ "v", "type", "request_id", "community_id", "channel_id"?, "body" }`. Parse received text with `super::parse_command`; serialise with serde (client side). `body` is the command's body object exactly as received, for the `command` module to parse by `type` and for the idempotency hash. ## Fields ### `v: u16` Envelope version. ### `kind: String` Command name. ### `request_id: Option` Correlation id; `None` (`null`) only for `signal.*` commands. ### `community_id: Option` The bound community, or the target of `community.create` / `invite.redeem`; else `null`. ### `channel_id: Option` Present for channel-scoped commands. ### `body: Box` The body object, `{}` when empty. ## Methods ### `new` ```rust pub fn new>(kind: impl Into, request_id: Option, community_id: Option, channel_id: Option, body: Box) -> Self ``` A command at `PROTOCOL_VERSION`. ### `is_signal` ```rust pub fn is_signal(&self) -> bool ``` Whether this is an ephemeral signal (`signal.*`): no response, no idempotency record. ### `is_mutating` ```rust pub fn is_mutating(&self) -> bool ``` Whether the command is mutating, hence idempotency-recorded. ### `body_hash` ```rust pub fn body_hash(&self) -> BodyHash ``` SHA3-256 of the body JSON text as received. ## Trait implementations `Clone`, `Debug`, `Serialize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/command_envelope/struct.CommandEnvelope.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-errorbody/ --- # Struct envelope::ErrorBody > An error object: `code`, `message`, and the code's extra fields placed next to `code`. Build it with the constructors (one per `ErrorCode`, see `errors.rs`); they use fixed message `zaun_community_protocol::envelope::ErrorBody` · Struct ```rust pub struct ErrorBody { … } ``` An error object: `code`, `message`, and the code's extra fields placed next to `code`. Build it with the constructors (one per `ErrorCode`, see `errors.rs`); they use fixed messages so no secret, connection detail, member key or other member's data can reach the wire. The extras are boxed to keep `Result<_, ErrorBody>` small. ## Fields ### `code: ErrorCode` What went wrong; clients branch on this only. ### `message: String` Human-readable English text; informative, never branched on. ### `extras: Box` The code's extra fields, serialised next to `code` (absent ones are omitted). ## Methods ### `bad_request` ```rust pub fn bad_request(field: Option<&str>) -> Self ``` `BAD_REQUEST`, naming the offending field path when known (`"body.content"`). The path names a schema field; never put a received value in it. ### `payload_too_large` ```rust pub fn payload_too_large(limit: u64) -> Self ``` `PAYLOAD_TOO_LARGE` with the limit exceeded, in bytes or items. ### `unsupported_version` ```rust pub fn unsupported_version(supported: VersionRange) -> Self ``` `UNSUPPORTED_VERSION` with the host's supported range. ### `unsupported_feature` ```rust pub fn unsupported_feature>>(feature: impl Into>) -> Self ``` `UNSUPPORTED_FEATURE` naming the feature (`"attachments"`, `"voice"`, a reserved command name). The name may be dynamic (`BodyError::UnsupportedFeature`) but must be a protocol name, never text taken from a secret or another member. ### `forbidden` ```rust pub fn forbidden(missing: Option, reason: Option) -> Self ``` `FORBIDDEN`, with the missing permission bits and the cause when known. ### `suspended` ```rust pub fn suspended(until: Option) -> Self ``` `SUSPENDED`, with the end of the suspension when it has one. ### `conflict` ```rust pub fn conflict(reason: Reason) -> Self ``` `CONFLICT` with its reason. ### `invalid_signature` ```rust pub fn invalid_signature(object: &'static str) -> Self ``` `INVALID_SIGNATURE` naming the signed object (`"descriptor"`, `"delegation"`, …). ### `slowmode_active` ```rust pub fn slowmode_active(retry_after_ms: u64) -> Self ``` `SLOWMODE_ACTIVE` (message as in the the protocol example). ### `rate_limited` ```rust pub fn rate_limited(retry_after_ms: u64, scope: RateScope, category: Option) -> Self ``` `RATE_LIMITED` with the scope and, when one applies, the category. ### `timed_out` ```rust pub fn timed_out(until: u64) -> Self ``` `TIMED_OUT` until the given time. ### `busy` ```rust pub fn busy(retry_after_ms: u64) -> Self ``` `BUSY`: the host's bounded queues are full. ### `resync_required_member` ```rust pub fn resync_required_member() -> Self ``` `RESYNC_REQUIRED` for the member stream. ### `resync_required_channel` ```rust pub fn resync_required_channel(channel_id: ChannelId) -> Self ``` `RESYNC_REQUIRED` for a channel stream. ### `new` ```rust pub fn new(code: ErrorCode, message: &'static str) -> Self ``` A body with only `code` and `message`. ### `with_message` ```rust pub fn with_message(self, message: &'static str) -> Self ``` Replaces the default message with another fixed one. ### `is_recorded` ```rust pub const fn is_recorded(&self) -> bool ``` Whether a response carrying this error is stored as the idempotency record. ### `unsupported_command` ```rust pub fn unsupported_command() -> Self ``` `UNSUPPORTED_COMMAND`: unknown `type`. ### `hello_required` ```rust pub fn hello_required() -> Self ``` `HELLO_REQUIRED`: a command before a successful `session.hello`. ### `not_bound` ```rust pub fn not_bound() -> Self ``` `NOT_BOUND`: a bound-only command on an unbound connection. ### `wrong_community` ```rust pub fn wrong_community() -> Self ``` `WRONG_COMMUNITY`: `community_id` differs from the binding. ### `host_not_authorized` ```rust pub fn host_not_authorized() -> Self ``` `HOST_NOT_AUTHORIZED`: no valid delegation for the community. ### `pending_approval` ```rust pub fn pending_approval() -> Self ``` `PENDING_APPROVAL`: the member is pending. ### `admission_closed` ```rust pub fn admission_closed() -> Self ``` `ADMISSION_CLOSED` (one code for every cause, so it is not an oracle). ### `not_found` ```rust pub fn not_found() -> Self ``` `NOT_FOUND` (missing and invisible are indistinguishable). ### `invite_invalid` ```rust pub fn invite_invalid() -> Self ``` `INVITE_INVALID` (one code for every cause, so it is not an oracle). ### `banned` ```rust pub fn banned() -> Self ``` `BANNED`: sent once, then the session ends. ### `internal` ```rust pub fn internal() -> Self ``` `INTERNAL`: details are logged on the host, never sent. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/error_body/struct.ErrorBody.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-errorextras/ --- # Struct envelope::ErrorExtras > The extra fields of the protocol Each applies to the codes named on it. `zaun_community_protocol::envelope::ErrorExtras` · Struct ```rust pub struct ErrorExtras { … } ``` The extra fields of the protocol Each applies to the codes named on it. ## Fields ### `field: Option` `BAD_REQUEST`: the offending field, when known (`"body.content"`, `"request_id"`). ### `limit: Option` `PAYLOAD_TOO_LARGE`: the limit exceeded. ### `supported: Option` `UNSUPPORTED_VERSION`: the host's range. ### `feature: Option` `UNSUPPORTED_FEATURE`: the feature. ### `missing: Option` `FORBIDDEN`: the missing permission bits, as a JSON decimal string. ### `reason: Option` `FORBIDDEN` (`hierarchy`, `probation`, `lockdown`) or `CONFLICT` reason. ### `until: Option` `SUSPENDED` / `TIMED_OUT`: end of the restriction, ms since the Unix epoch. ### `retry_after_ms: Option` `SLOWMODE_ACTIVE`, `RATE_LIMITED`, `BUSY`: milliseconds to wait. ### `scope: Option` `RATE_LIMITED`: the scope whose limit was hit. ### `category: Option` `RATE_LIMITED`: the category, when one applies. ### `stream: Option` `RESYNC_REQUIRED`: the stream to resynchronise. ### `channel_id: Option` `RESYNC_REQUIRED`: the channel, for a channel stream. ### `object: Option` `INVALID_SIGNATURE`: which signed object failed (`"descriptor"`, `"delegation"`, …). ## Trait implementations `Clone`, `Debug`, `Default`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/error_body/struct.ErrorExtras.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-eventenvelope/ --- # Struct envelope::EventEnvelope > `{ "v", "type", "community_id", "channel_id"?, "stream", "sequence"?, "timestamp", "actor_id", "body" }`. Deserialisation validates with `EventEnvelope::validate`. `zaun_community_protocol::envelope::EventEnvelope` · Struct ```rust pub struct EventEnvelope { … } ``` `{ "v", "type", "community_id", "channel_id"?, "stream", "sequence"?, "timestamp", "actor_id", "body" }`. Deserialisation validates with `EventEnvelope::validate`. ## Fields ### `v: u16` Envelope version. ### `kind: String` Event name. ### `community_id: CommunityId` The community. ### `channel_id: Option` Present for channel-stream and channel-related member-stream events. ### `stream: Stream` The stream. ### `sequence: Option` `channel_seq` or `member_seq`; absent on the live stream. ### `timestamp: u64` Host time of acceptance, ms since the Unix epoch. ### `actor_id: Option` The member who caused the event; `null` for host-initiated events. ### `body: Box` The event body object. ## Methods ### `validate` ```rust pub fn validate(&self) -> Result<(), EventError> ``` Checks the the protocol rules: `sequence` present on channel/member streams and absent on live, `channel_id` on the channel stream, integers below `2^53`, an object body. # Errors The first rule broken. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Serialize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/event_envelope/struct.EventEnvelope.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-eventsbatch/ --- # Struct envelope::EventsBatch > A validated `events` batch. Its events are processed in order, exactly as individual events; the batch itself has no stream, sequence or timestamp. `zaun_community_protocol::envelope::EventsBatch` · Struct ```rust pub struct EventsBatch { … } ``` A validated `events` batch. Its events are processed in order, exactly as individual events; the batch itself has no stream, sequence or timestamp. ## Fields ### `v: u16` Envelope version. ### `community_id: CommunityId` The community; every element carries the same one. ### `events: Vec` The events, in order. ## Methods ### `new` ```rust pub const fn new(community_id: CommunityId, events: Vec) -> Self ``` A batch of `events` for `community_id` at `PROTOCOL_VERSION`. ### `parse` ```rust pub fn parse(json: &str) -> Result ``` Parses a whole (reassembled) batch envelope. All or nothing: the first bad element fails the batch. SPEC: the protocol says each element's `v` and `community_id` MUST equal the batch's; a batch carrying `stream`, `sequence` or `timestamp` is not rejected (unknown fields are ignored). # Errors `BatchError` for the first rule broken. ### `serialize` ```rust pub fn serialize(&self) -> Result ``` The batch envelope as JSON text, after checking the same rules as `Self::parse`. # Errors `BatchError` for the first rule an element breaks. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/events_batch/struct.EventsBatch.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-rejection/ --- # Struct envelope::Rejection > A command the host rejects before dispatch; send `Rejection::into_response` back. `zaun_community_protocol::envelope::Rejection` · Struct ```rust pub struct Rejection { … } ``` A command the host rejects before dispatch; send `Rejection::into_response` back. ## Fields ### `request_id: Option` The command's `request_id` when it could be read, else `None` (`null`). ### `error: ErrorBody` The error to answer with. ## Methods ### `into_response` ```rust pub fn into_response(self) -> ResponseEnvelope ``` The response envelope to send. ## Trait implementations `Clone`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/inbound/struct.Rejection.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-responseenvelope/ --- # Struct envelope::ResponseEnvelope > `{ "v", "type": "response", "request_id", "ok", "body" | "error" }`. `zaun_community_protocol::envelope::ResponseEnvelope` · Struct ```rust pub struct ResponseEnvelope { … } ``` `{ "v", "type": "response", "request_id", "ok", "body" | "error" }`. `request_id` is `null` when the command's id could not be read. ## Fields ### `v: u16` Envelope version. ### `request_id: Option` The command's `request_id`, or `None` (`null`). ### `outcome: Outcome` Success body or error. ## Methods ### `ok` ```rust pub fn ok(request_id: RequestId, body: Box) -> Self ``` A success response at `PROTOCOL_VERSION`. ### `ok_json` ```rust pub fn ok_json(request_id: RequestId, body: &T) -> Result ``` A success response whose body is serialised from `body`. # Errors `body` fails to serialise as JSON. ### `error` ```rust pub fn error(request_id: Option, error: ErrorBody) -> Self ``` An error response at `PROTOCOL_VERSION`. ### `error_body` ```rust pub fn error_body(&self) -> Option<&ErrorBody> ``` The error, if this is a failure. ### `is_recorded` ```rust pub fn is_recorded(&self) -> bool ``` Whether this response is stored as the idempotency record: every success and every error except `BUSY`, `RATE_LIMITED`, `INTERNAL` and `SLOWMODE_ACTIVE`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Serialize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/response/struct.ResponseEnvelope.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-envelope-versionrange/ --- # Struct envelope::VersionRange > An inclusive protocol version range (`session.hello.versions`, `UNSUPPORTED_VERSION`). `zaun_community_protocol::envelope::VersionRange` · Struct ```rust pub struct VersionRange { … } ``` An inclusive protocol version range (`session.hello.versions`, `UNSUPPORTED_VERSION`). ## Fields ### `min: u16` Lowest supported version. ### `max: u16` Highest supported version. ## Methods ### `contains` ```rust pub const fn contains(&self, v: u16) -> bool ``` Whether `v` lies in the range. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/struct.VersionRange.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-botremoved/ --- # Struct event::BotRemoved > `bot.removed`: `{bot_id, member_id}`. `zaun_community_protocol::event::BotRemoved` · Struct ```rust pub struct BotRemoved { … } ``` `bot.removed`: `{bot_id, member_id}`. ## Fields ### `bot_id: BotId` The bot. ### `member_id: MemberId` Its member. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.BotRemoved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-channelcreated/ --- # Struct event::ChannelCreated > `channel.created`: the channel object plus `reason?: "access_gained"`. `zaun_community_protocol::event::ChannelCreated` · Struct ```rust pub struct ChannelCreated { … } ``` `channel.created`: the channel object plus `reason?: "access_gained"`. ## Fields ### `channel: Channel` The channel. ### `reason: Option` Set when the channel became visible rather than created. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/struct.ChannelCreated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-channeldeleted/ --- # Struct event::ChannelDeleted > `channel.deleted`: `{channel_id, reason?: "access_lost"}`. `zaun_community_protocol::event::ChannelDeleted` · Struct ```rust pub struct ChannelDeleted { … } ``` `channel.deleted`: `{channel_id, reason?: "access_lost"}`. ## Fields ### `channel_id: ChannelId` The channel. ### `reason: Option` Set when the channel became invisible rather than deleted. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/struct.ChannelDeleted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-channelsreordered/ --- # Struct event::ChannelsReordered > `channel.reordered`: `positions` (only channels the member can see). `zaun_community_protocol::event::ChannelsReordered` · Struct ```rust pub struct ChannelsReordered { … } ``` `channel.reordered`: `positions` (only channels the member can see). SPEC: the entry shape is not given; the `channel.reorder` entry is reused. ## Fields ### `positions: Vec` New positions and parents. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/struct.ChannelsReordered.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-commandsupdated/ --- # Struct event::CommandsUpdated > `command.updated`: one bot's whole command list (`[]` while disabled or removed). `zaun_community_protocol::event::CommandsUpdated` · Struct ```rust pub struct CommandsUpdated { … } ``` `command.updated`: one bot's whole command list (`[]` while disabled or removed). ## Fields ### `bot_id: BotId` The bot. ### `commands: Vec` Its commands. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.CommandsUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-descriptorupdated/ --- # Struct event::DescriptorUpdated > `community.descriptor_updated`: signed `descriptor` and `delegation`. `zaun_community_protocol::event::DescriptorUpdated` · Struct ```rust pub struct DescriptorUpdated { … } ``` `community.descriptor_updated`: signed `descriptor` and `delegation`. ## Fields ### `descriptor: SignedJson` The new signed descriptor; verify before use. ### `delegation: SignedJson` The signed delegation it references. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/struct.DescriptorUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-dmclosed/ --- # Struct event::DmClosed > `dm.closed`: to the closer's own stream. `zaun_community_protocol::event::DmClosed` · Struct ```rust pub struct DmClosed { … } ``` `dm.closed`: to the closer's own stream. ## Fields ### `channel_id: ChannelId` The DM. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.DmClosed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-interactionautocomplete/ --- # Struct event::InteractionAutocomplete > `interaction.autocomplete`: suggestions, to the invoker only. `zaun_community_protocol::event::InteractionAutocomplete` · Struct ```rust pub struct InteractionAutocomplete { … } ``` `interaction.autocomplete`: suggestions, to the invoker only. ## Fields ### `interaction_id: InteractionId` The interaction. ### `choices: Vec` ≤ 25. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.InteractionAutocomplete.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-interactionfailed/ --- # Struct event::InteractionFailed > `interaction.failed`, to the invoker only. `zaun_community_protocol::event::InteractionFailed` · Struct ```rust pub struct InteractionFailed { … } ``` `interaction.failed`, to the invoker only. ## Fields ### `interaction_id: InteractionId` The interaction. ### `reason: FailReason` Why. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.InteractionFailed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-interactionmessage/ --- # Struct event::InteractionMessage > `interaction.message`: an ephemeral message, to the invoker only. `zaun_community_protocol::event::InteractionMessage` · Struct ```rust pub struct InteractionMessage { … } ``` `interaction.message`: an ephemeral message, to the invoker only. ## Fields ### `interaction_id: InteractionId` The interaction. ### `op: EphemeralOp` What happened. ### `message: Option>` The message (absent for `deleted`). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.InteractionMessage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-interactionmodal/ --- # Struct event::InteractionModal > `interaction.modal`: open a modal, to the invoker only. `zaun_community_protocol::event::InteractionModal` · Struct ```rust pub struct InteractionModal { … } ``` `interaction.modal`: open a modal, to the invoker only. ## Fields ### `interaction_id: InteractionId` The interaction that opened it; submit with it as `modal_id`. ### `custom_id: String` The modal's `custom_id`. ### `title: String` 1–45 scalars. ### `components: Vec` 1–5 labels or text displays. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/bot/struct.InteractionModal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-memberleft/ --- # Struct event::MemberLeft > `member.left`: `{member_id}`. `zaun_community_protocol::event::MemberLeft` · Struct ```rust pub struct MemberLeft { … } ``` `member.left`: `{member_id}`. ## Fields ### `member_id: MemberId` The member. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.MemberLeft.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-memberremoved/ --- # Struct event::MemberRemoved > `member.removed`: `{reason}`, to the subject only; then the session ends. `zaun_community_protocol::event::MemberRemoved` · Struct ```rust pub struct MemberRemoved { … } ``` `member.removed`: `{reason}`, to the subject only; then the session ends. ## Fields ### `reason: RemovalReason` Why. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.MemberRemoved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-memberrolesupdated/ --- # Struct event::MemberRolesUpdated > `member.roles_updated`: `{member_id, role_ids}`. `zaun_community_protocol::event::MemberRolesUpdated` · Struct ```rust pub struct MemberRolesUpdated { … } ``` `member.roles_updated`: `{member_id, role_ids}`. ## Fields ### `member_id: MemberId` The member. ### `role_ids: Vec` The member's roles now. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.MemberRolesUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-membershipupdated/ --- # Struct event::MembershipUpdated > `membership.updated`: `{member_id, state, until?}`. `zaun_community_protocol::event::MembershipUpdated` · Struct ```rust pub struct MembershipUpdated { … } ``` `membership.updated`: `{member_id, state, until?}`. ## Fields ### `member_id: MemberId` The member. ### `state: MembershipState` The new state. ### `until: Option` End of a suspension, ms. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.MembershipUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-membertimedout/ --- # Struct event::MemberTimedOut > `member.timed_out`: `{member_id, until}`. `zaun_community_protocol::event::MemberTimedOut` · Struct ```rust pub struct MemberTimedOut { … } ``` `member.timed_out`: `{member_id, until}`. SPEC: `until` is nullable here because `member.timeout` with `null` clears a timeout and emits the same event. ## Fields ### `member_id: MemberId` The member. ### `until: Option` End of the timeout, ms; `null` = cleared. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.MemberTimedOut.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-messagecreated/ --- # Struct event::MessageCreated > `message.created`. `zaun_community_protocol::event::MessageCreated` · Struct ```rust pub struct MessageCreated { … } ``` `message.created`. SPEC: the protocol says "message object", but the the protocol example body has only `message_id`, `author_id`, `content`, `reply_to`, `mentions` and `attachments`; `channel_id`, `sequence` and `created_at` are on the envelope, and a new message has no reactions. This type follows the protocol; a host sending the full the protocol object still parses (extra fields are ignored). ## Fields ### `message_id: MessageId` Host-assigned id. ### `author_id: MemberId` The author. ### `content: String` ≤ 4 000 scalars; empty only when the message has an attachment or an embed. ### `embeds: Vec` Rich embeds; absent when none. ### `components: Vec` Components (bots only); absent when none. ### `flags: u32` Message flags; absent when 0. ### `interaction_metadata: Option>` The interaction this message answers. ### `reply_to: Option` The message replied to. ### `mentions: Mentions` Who is mentioned (as honoured by the host). ### `attachments: Vec` Attachments, in the order the author listed them. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/message/struct.MessageCreated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-messagedeleted/ --- # Struct event::MessageDeleted > `message.deleted`: `{message_id}`. `zaun_community_protocol::event::MessageDeleted` · Struct ```rust pub struct MessageDeleted { … } ``` `message.deleted`: `{message_id}`. ## Fields ### `message_id: MessageId` The message. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/message/struct.MessageDeleted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-messagesbulkdeleted/ --- # Struct event::MessagesBulkDeleted > `messages.bulk_deleted`: `{message_ids}` (≤ 1 000). `zaun_community_protocol::event::MessagesBulkDeleted` · Struct ```rust pub struct MessagesBulkDeleted { … } ``` `messages.bulk_deleted`: `{message_ids}` (≤ 1 000). ## Fields ### `message_ids: Vec` The deleted messages. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/message/struct.MessagesBulkDeleted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-messageupdated/ --- # Struct event::MessageUpdated > `message.updated`: `{message_id, content, embeds?, components?, flags?, mentions?, edited_at}`. `zaun_community_protocol::event::MessageUpdated` · Struct ```rust pub struct MessageUpdated { … } ``` `message.updated`: `{message_id, content, embeds?, components?, flags?, mentions?, edited_at}`. ## Fields ### `message_id: MessageId` The message. ### `content: String` New content. ### `embeds: Option>` As in `message.edit`: absent when the edit left the embeds unchanged, else the message's new embeds (`[]` when the edit removed them all). ### `components: Option>` As `embeds`, for components. ### `flags: Option` The new flags, when they changed (a deferred reply loses `LOADING`). ### `mentions: Option` As `embeds`, for mentions: the ones the host honoured, absent when the edit left them unchanged. ### `edited_at: u64` Edit time, ms. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/message/struct.MessageUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-presencesignal/ --- # Struct event::PresenceSignal > `signal.presence` live event. `zaun_community_protocol::event::PresenceSignal` · Struct ```rust pub struct PresenceSignal { … } ``` `signal.presence` live event. SPEC: never defined; this crate uses `{member_id, status, activity?}` and never forwards the sender's `viewing`. ## Fields ### `member_id: MemberId` The member. ### `status: PresenceStatus` Presence status. ### `activity: Option` What the member is doing; never with `offline`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.PresenceSignal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-reactionchanged/ --- # Struct event::ReactionChanged > `reaction.added` and `reaction.removed`: `{message_id, emoji, member_id}`. `zaun_community_protocol::event::ReactionChanged` · Struct ```rust pub struct ReactionChanged { … } ``` `reaction.added` and `reaction.removed`: `{message_id, emoji, member_id}`. ## Fields ### `message_id: MessageId` The message. ### `emoji: String` The emoji. ### `member_id: MemberId` Whose reaction. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/message/struct.ReactionChanged.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-roledeleted/ --- # Struct event::RoleDeleted > `role.deleted`: `{role_id}`. `zaun_community_protocol::event::RoleDeleted` · Struct ```rust pub struct RoleDeleted { … } ``` `role.deleted`: `{role_id}`. ## Fields ### `role_id: RoleId` The role. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/struct.RoleDeleted.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-rolesreordered/ --- # Struct event::RolesReordered > `role.reordered`: `positions`. SPEC: the `role.reorder` entry is reused. `zaun_community_protocol::event::RolesReordered` · Struct ```rust pub struct RolesReordered { … } ``` `role.reordered`: `positions`. SPEC: the `role.reorder` entry is reused. ## Fields ### `positions: Vec` New positions. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/structure/struct.RolesReordered.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-typingsignal/ --- # Struct event::TypingSignal > `signal.typing` live event: `{channel_id, member_ids}` in a `named` channel, `{channel_id, count}` in an `anonymous` one (who is typing is never sent there). `zaun_community_protocol::event::TypingSignal` · Struct ```rust pub struct TypingSignal { … } ``` `signal.typing` live event: `{channel_id, member_ids}` in a `named` channel, `{channel_id, count}` in an `anonymous` one (who is typing is never sent there). ## Fields ### `channel_id: ChannelId` The channel. ### `member_ids: Vec` Members typing in it (`named` channels); absent in `anonymous` ones. ### `count: Option` How many others are typing (`anonymous` channels): 1, 2, or 3 meaning "three or more" (`TYPING_COUNT_CAP`). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/body/member/struct.TypingSignal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-voicejoined/ --- # Struct event::VoiceJoined > `voice.joined`: a member entered a voice channel. Its `key_package` is present only for the channel's other participants. `zaun_community_protocol::event::VoiceJoined` · Struct ```rust pub struct VoiceJoined { … } ``` `voice.joined`: a member entered a voice channel. Its `key_package` is present only for the channel's other participants. ## Fields ### `channel_id: ChannelId` The voice channel. ### `participant: VoiceParticipant` The new participant. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/voice/struct.VoiceJoined.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-voicekeys/ --- # Struct event::VoiceKeys > `voice.keys`: another participant's media key for `epoch`: its signed sender-keys message and the key wrapped for this participant only (never another's). `zaun_community_protocol::event::VoiceKeys` · Struct ```rust pub struct VoiceKeys { … } ``` `voice.keys`: another participant's media key for `epoch`: its signed sender-keys message and the key wrapped for this participant only (never another's). ## Fields ### `from: MemberId` The sender. ### `voice_session: VoiceSessionId` The sender's stay. ### `epoch: u64` The sender's key epoch. ### `sender_keys: Opaque` The sender's signed message for this epoch, opaque. ### `wrapped: Opaque` The key, wrapped for the recipient, opaque. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/voice/struct.VoiceKeys.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-voiceleft/ --- # Struct event::VoiceLeft > `voice.left`: a member left a voice channel. The member itself receives it too. `zaun_community_protocol::event::VoiceLeft` · Struct ```rust pub struct VoiceLeft { … } ``` `voice.left`: a member left a voice channel. The member itself receives it too. ## Fields ### `channel_id: ChannelId` The voice channel. ### `member_id: MemberId` Who left. ### `voice_session: VoiceSessionId` The stay that ended. ### `reason: VoiceLeftReason` Why. ### `moved_to: Option` `moved`: the channel the moderator moved the member to; its client joins it. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/voice/struct.VoiceLeft.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-voicesignal/ --- # Struct event::VoiceSignal > `voice.signal`: WebRTC signalling from another participant, to this one only. `zaun_community_protocol::event::VoiceSignal` · Struct ```rust pub struct VoiceSignal { … } ``` `voice.signal`: WebRTC signalling from another participant, to this one only. ## Fields ### `from: MemberId` The sender. ### `voice_session: VoiceSessionId` The sender's stay. ### `data: Opaque` SDP or ICE, opaque. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/voice/struct.VoiceSignal.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-event-voiceupdated/ --- # Struct event::VoiceUpdated > `voice.updated`: a participant's mute, deafen or `can_speak` changed. `zaun_community_protocol::event::VoiceUpdated` · Struct ```rust pub struct VoiceUpdated { … } ``` `voice.updated`: a participant's mute, deafen or `can_speak` changed. ## Fields ### `channel_id: ChannelId` The voice channel. ### `participant: VoiceParticipant` The participant, without its key package. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/event/voice/struct.VoiceUpdated.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-framing-encodedframe/ --- # Struct framing::EncodedFrame > The transport messages of one frame, in sending order. `zaun_community_protocol::framing::EncodedFrame` · Struct ```rust pub struct EncodedFrame { … } ``` The transport messages of one frame, in sending order. ## Methods ### `messages` ```rust pub fn messages(&self) -> &[String] ``` The text messages to send, in order. ### `into_messages` ```rust pub fn into_messages(self) -> Vec ``` Consumes the frame into its messages. ### `smp_messages` ```rust pub fn smp_messages(&self) -> usize ``` SMP messages this frame costs against the in-flight window: one per message. ### `is_whole` ```rust pub fn is_whole(&self) -> bool ``` Whether the frame is a single whole message. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/encode/struct.EncodedFrame.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-framing-fragid/ --- # Struct framing::FragId > A fragment id: 8 random bytes, unique per sender per connection among open reassemblies. `zaun_community_protocol::framing::FragId` · Struct ```rust pub struct FragId(…) ``` A fragment id: 8 random bytes, unique per sender per connection among open reassemblies. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 8]) -> Self ``` Wraps raw bytes (deterministic encoding, tests). ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG. # Errors `RngError` when the CSPRNG fails. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 8] ``` The raw bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Option ``` Strict base64url of exactly `FRAG_ID_CHARS` characters. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding (11 characters). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/struct.FragId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-framing-fragment/ --- # Struct framing::Fragment > One fragment message, borrowing its chunk from the received text. `zaun_community_protocol::framing::Fragment` · Struct ```rust pub struct Fragment<'a> { … } ``` One fragment message, borrowing its chunk from the received text. ## Fields ### `frag_id: FragId` The reassembly this fragment belongs to. ### `index: usize` Position, `0 ≤ index < count`. ### `count: usize` Number of fragments in the frame, `2 ≤ count ≤ 64` syntactically; over 32 is discarded. ### `chunk: &'a str` A piece of the envelope JSON text (valid UTF-8 by construction). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/parse/struct.Fragment.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-framing-reassembler/ --- # Struct framing::Reassembler > Per-connection reassembly state machine. `zaun_community_protocol::framing::Reassembler` · Struct ```rust pub struct Reassembler { … } ``` Per-connection reassembly state machine. ## Methods ### `new` ```rust pub fn new() -> Self ``` A reassembler with the protocol's `max_frame` (`MAX_FRAME`). ### `with_max_frame` ```rust pub fn with_max_frame(max_frame: usize) -> Self ``` A reassembler with a stricter host `max_frame`; never above `MAX_FRAME`. ### `expire` ```rust pub fn expire(&mut self, now_ms: u64) -> usize ``` Discards reassemblies whose first fragment arrived more than 60 s before `now_ms` (exactly 60 s is still accepted). Returns how many were discarded. ### `push` ```rust pub fn push(&mut self, fragment: Fragment<'_>, now_ms: u64) -> Pushed ``` Pushes one fragment received at `now_ms`. Expired reassemblies are discarded first. ### `open_count` ```rust pub fn open_count(&self) -> usize ``` Number of open reassemblies (≤ `MAX_OPEN_REASSEMBLIES`). ### `buffered_bytes` ```rust pub fn buffered_bytes(&self) -> usize ``` Chunk bytes currently buffered (≤ `MAX_OPEN_REASSEMBLIES × max_frame`). ## Trait implementations `Debug`, `Default` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/framing/reassembly/struct.Reassembler.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-attachmentid/ --- # Struct ids::AttachmentId > An attachment. `zaun_community_protocol::ids::AttachmentId` · Struct ```rust pub struct AttachmentId(…) ``` An attachment. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.AttachmentId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-auditid/ --- # Struct ids::AuditId > An audit-log entry. `zaun_community_protocol::ids::AuditId` · Struct ```rust pub struct AuditId(…) ``` An audit-log entry. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.AuditId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-banid/ --- # Struct ids::BanId > A ban record. `zaun_community_protocol::ids::BanId` · Struct ```rust pub struct BanId(…) ``` A ban record. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.BanId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-botid/ --- # Struct ids::BotId > An installed bot. `zaun_community_protocol::ids::BotId` · Struct ```rust pub struct BotId(…) ``` An installed bot. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.BotId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-challenge/ --- # Struct ids::Challenge > A host-issued challenge that a signed proof must echo. `zaun_community_protocol::ids::Challenge` · Struct ```rust pub struct Challenge(…) ``` A host-issued challenge that a signed proof must echo. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Deserialize<'de>`, `Display`, `Encode`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.Challenge.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-channelid/ --- # Struct ids::ChannelId > A channel or category. `zaun_community_protocol::ids::ChannelId` · Struct ```rust pub struct ChannelId(…) ``` A channel or category. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.ChannelId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-commandid/ --- # Struct ids::CommandId > An application command of a bot. `zaun_community_protocol::ids::CommandId` · Struct ```rust pub struct CommandId(…) ``` An application command of a bot. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.CommandId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-communityid/ --- # Struct ids::CommunityId > `SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root public key)`. `zaun_community_protocol::ids::CommunityId` · Struct ```rust pub struct CommunityId(…) ``` `SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root public key)`. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Deserialize<'de>`, `Display`, `Encode`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.CommunityId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-descriptorhash/ --- # Struct ids::DescriptorHash > `SHA3-256` of a signed descriptor's bytes. The descriptor names its delegation's hash, so this identifies the descriptor/delegation pair. `zaun_community_protocol::ids::DescriptorHash` · Struct ```rust pub struct DescriptorHash(…) ``` `SHA3-256` of a signed descriptor's bytes. The descriptor names its delegation's hash, so this identifies the descriptor/delegation pair. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.DescriptorHash.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-hostid/ --- # Struct ids::HostId > `SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key)`. `zaun_community_protocol::ids::HostId` · Struct ```rust pub struct HostId(…) ``` `SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key)`. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Deserialize<'de>`, `Display`, `Encode`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.HostId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-interactionid/ --- # Struct ids::InteractionId > An interaction: one use of a command, component or modal. `zaun_community_protocol::ids::InteractionId` · Struct ```rust pub struct InteractionId(…) ``` An interaction: one use of a command, component or modal. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.InteractionId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-inviteid/ --- # Struct ids::InviteId > An invitation (public handle; the secret is `InviteSecret`). `zaun_community_protocol::ids::InviteId` · Struct ```rust pub struct InviteId(…) ``` An invitation (public handle; the secret is `InviteSecret`). ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.InviteId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-invitesecret/ --- # Struct ids::InviteSecret > An invitation secret: 32 random bytes, shown once. Never logged: `Debug` is redacted and it has no `Display`. Zeroized on drop. `zaun_community_protocol::ids::InviteSecret` · Struct ```rust pub struct InviteSecret(…) ``` An invitation secret: 32 random bytes, shown once. Never logged: `Debug` is redacted and it has no `Display`. Zeroized on drop. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `random` ```rust pub fn random() -> Result ``` A fresh secret. # Errors `RngError` when the CSPRNG fails. ### `expose` ```rust pub const fn expose(&self) -> &[u8; 32] ``` The raw bytes (for hashing before storage; hosts store only a hash). ### `expose_b64` ```rust pub fn expose_b64(&self) -> String ``` Base64url, for the one place it is shown: the invitation link. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Drop`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq`, `Zeroize` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.InviteSecret.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-lockdownid/ --- # Struct ids::LockdownId > An emergency lockdown. `zaun_community_protocol::ids::LockdownId` · Struct ```rust pub struct LockdownId(…) ``` An emergency lockdown. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.LockdownId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-memberid/ --- # Struct ids::MemberId > A community-scoped member identity, host-assigned. `zaun_community_protocol::ids::MemberId` · Struct ```rust pub struct MemberId(…) ``` A community-scoped member identity, host-assigned. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.MemberId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-messageid/ --- # Struct ids::MessageId > A message. `zaun_community_protocol::ids::MessageId` · Struct ```rust pub struct MessageId(…) ``` A message. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.MessageId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-nonce/ --- # Struct ids::Nonce > A single-use value in signed objects. `zaun_community_protocol::ids::Nonce` · Struct ```rust pub struct Nonce(…) ``` A single-use value in signed objects. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Deserialize<'de>`, `Display`, `Encode`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.Nonce.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-publisherid/ --- # Struct ids::PublisherId > `SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher public key)`. `zaun_community_protocol::ids::PublisherId` · Struct ```rust pub struct PublisherId(…) ``` `SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher public key)`. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 32]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 32] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.PublisherId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-reportid/ --- # Struct ids::ReportId > A member report. `zaun_community_protocol::ids::ReportId` · Struct ```rust pub struct ReportId(…) ``` A member report. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.ReportId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-requestid/ --- # Struct ids::RequestId > Correlates a command with its response; client-assigned. `zaun_community_protocol::ids::RequestId` · Struct ```rust pub struct RequestId(…) ``` Correlates a command with its response; client-assigned. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.RequestId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-rngerror/ --- # Struct ids::RngError > The operating system's CSPRNG failed. `zaun_community_protocol::ids::RngError` · Struct ```rust pub struct RngError ``` The operating system's CSPRNG failed. ## Trait implementations `Clone`, `Copy`, `Debug`, `Display`, `Eq`, `Error`, `From`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.RngError.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-roleid/ --- # Struct ids::RoleId > A role. `RoleId::EVERYONE` is the reserved all-zero id. `zaun_community_protocol::ids::RoleId` · Struct ```rust pub struct RoleId(…) ``` A role. `RoleId::EVERYONE` is the reserved all-zero id. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ### `is_everyone` ```rust pub fn is_everyone(&self) -> bool ``` Whether this is the `@everyone` role. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.RoleId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-ids-voicesessionid/ --- # Struct ids::VoiceSessionId > One stay of a member in a voice channel, host-assigned at `voice.join`. `zaun_community_protocol::ids::VoiceSessionId` · Struct ```rust pub struct VoiceSessionId(…) ``` One stay of a member in a voice channel, host-assigned at `voice.join`. ## Methods ### `from_bytes` ```rust pub const fn from_bytes(bytes: [u8; 16]) -> Self ``` Wraps raw bytes. ### `as_bytes` ```rust pub const fn as_bytes(&self) -> &[u8; 16] ``` The raw bytes. ### `from_slice` ```rust pub fn from_slice(bytes: &[u8]) -> Option ``` Parses a byte slice of exactly `Self::LEN` bytes. ### `from_b64` ```rust pub fn from_b64(text: &str) -> Result ``` Strict base64url. # Errors A non-canonical encoding or a wrong length. ### `to_b64` ```rust pub fn to_b64(&self) -> String ``` Base64url without padding. ### `random` ```rust pub fn random() -> Result ``` A fresh id from the OS CSPRNG; never all-zero (all-zero is reserved, the protocol). # Errors `RngError` when the CSPRNG fails. ## Trait implementations `Clone`, `Copy`, `Debug`, `Deserialize<'de>`, `Display`, `Eq`, `Hash`, `Ord`, `PartialEq`, `PartialOrd`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/ids/struct.VoiceSessionId.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-json-signedjson/ --- # Struct json::SignedJson > A signed object as it travels in JSON: the canonical bytes `B` and the composite signature, both base64url. Receivers verify `sig` over `bytes` with the context of the object type `zaun_community_protocol::json::SignedJson` · Struct ```rust pub struct SignedJson { … } ``` A signed object as it travels in JSON: the canonical bytes `B` and the composite signature, both base64url. Receivers verify `sig` over `bytes` with the context of the object type they expect before decoding `bytes`. ## Fields ### `bytes: Vec` Canonical encoding `B` of the object. ### `sig: Vec` Encoded `Signature`. ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `From>`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/json/struct.SignedJson.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-keys-publickey/ --- # Struct keys::PublicKey > A composite public key, 1 985 bytes. `zaun_community_protocol::keys::PublicKey` · Struct ```rust pub struct PublicKey(…) ``` A composite public key, 1 985 bytes. ## Methods ### `from_bytes` ```rust pub fn from_bytes(bytes: &[u8]) -> Result ``` Parses the encoding, checking the suite byte and length. # Errors `KeyEncodingError` for an unknown suite or a wrong length. ### `as_bytes` ```rust pub fn as_bytes(&self) -> &[u8] ``` The full encoding, suite byte first. ### `suite` ```rust pub fn suite(&self) -> Suite ``` The suite. ### `mldsa` ```rust pub fn mldsa(&self) -> &[u8] ``` The ML-DSA-65 component (RFC 10073 serialisation, first part). ### `ed25519` ```rust pub fn ed25519(&self) -> &[u8] ``` The Ed25519 component (RFC 10073 serialisation, second part). ## Trait implementations `Clone`, `Debug`, `Decode`, `Deserialize<'de>`, `Encode`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/struct.PublicKey.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-keys-signature/ --- # Struct keys::Signature > A composite signature, 3 374 bytes. `zaun_community_protocol::keys::Signature` · Struct ```rust pub struct Signature(…) ``` A composite signature, 3 374 bytes. ## Methods ### `from_bytes` ```rust pub fn from_bytes(bytes: &[u8]) -> Result ``` Parses the encoding, checking the suite byte and length. # Errors `KeyEncodingError` for an unknown suite or a wrong length. ### `as_bytes` ```rust pub fn as_bytes(&self) -> &[u8] ``` The full encoding, suite byte first. ### `suite` ```rust pub fn suite(&self) -> Suite ``` The suite. ### `mldsa` ```rust pub fn mldsa(&self) -> &[u8] ``` The ML-DSA-65 component (RFC 10073 serialisation, first part). ### `ed25519` ```rust pub fn ed25519(&self) -> &[u8] ``` The Ed25519 component (RFC 10073 serialisation, second part). ## Trait implementations `Clone`, `Debug`, `Deserialize<'de>`, `Eq`, `Hash`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/keys/struct.Signature.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-activelockdown/ --- # Struct permissions::ActiveLockdown > The lockdown currently in force, as lockdown management sees it. `zaun_community_protocol::permissions::ActiveLockdown` · Struct ```rust pub struct ActiveLockdown { … } ``` The lockdown currently in force, as lockdown management sees it. ## Fields ### `enabled_by: Top` The enabling actor's top position, recorded at enable time. ### `mask: Permissions` Its whole permission mask, `Lockdown::max_mask`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/safety/struct.ActiveLockdown.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-channel/ --- # Struct permissions::Channel > The channel context of a channel-level resolution. `zaun_community_protocol::permissions::Channel` · Struct ```rust pub struct Channel<'a> { … } ``` The channel context of a channel-level resolution. ## Fields ### `kind: ChannelKind` The channel kind; it decides which bits apply. ### `overrides: &'a [Override]` The channel's own stored overrides. ### `parent_overrides: Option<&'a [Override]>` The parent category's overrides, when the channel has a parent. ### `sync_with_parent: bool` Whether the channel follows its parent's overrides. ### `locked: bool` The channel `locked` flag. ### `participants: Option<[MemberId; 2]>` A `dm` channel's two members: only they get anything in it, owner and administrators included. ## Methods ### `effective_overrides` ```rust pub fn effective_overrides(&self) -> &'a [Override] ``` The overrides that apply: the parent's while synced, else the channel's own. A category never syncs. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/input/struct.Channel.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-context/ --- # Struct permissions::Context > Community-wide inputs shared by every resolution in one request. `zaun_community_protocol::permissions::Context` · Struct ```rust pub struct Context<'a> { … } ``` Community-wide inputs shared by every resolution in one request. ## Fields ### `now_ms: u64` The current time in ms since the epoch. ### `everyone: Permissions` The `@everyone` role's permissions. ### `newcomer_restrictions: Permissions` The admission policy's `newcomer_restrictions` (step 7b). ### `waiting_period_ms: u64` The admission policy's `waiting_period_s`, in ms. ### `lockdown: Option<&'a Lockdown>` The community's lockdown row, if any; ignored once expired. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/input/struct.Context.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-denial/ --- # Struct permissions::Denial > A failed permission or hierarchy check. `zaun_community_protocol::permissions::Denial` · Struct ```rust pub struct Denial { … } ``` A failed permission or hierarchy check. ## Fields ### `missing: Permissions` Required bits the actor lacks; empty when a non-bit rule failed. ### `reason: Option` The rule that caused it, when the bits were granted but then restricted, or when a hierarchy rule failed. ## Methods ### `hierarchy` ```rust pub const fn hierarchy() -> Self ``` A hierarchy denial (H1, H2, H4). ### `missing` ```rust pub const fn missing(bits: Permissions) -> Self ``` A denial for missing bits with no specific cause. ### `error_code` ```rust pub const fn error_code(&self) -> ErrorCode ``` The response code: `TIMED_OUT` when the timeout caused it, otherwise `FORBIDDEN`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `From`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/denial/struct.Denial.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-invites-inviterequest/ --- # Struct permissions::invites::InviteRequest > The parts of an `invite.create` body the checks need. `zaun_community_protocol::permissions::invites::InviteRequest` · Struct ```rust pub struct InviteRequest<'a> { … } ``` The parts of an `invite.create` body the checks need. ## Fields ### `rule: InviteCreation` The policy's `invite_creation` rule. ### `default_roles: &'a [Role]` The roles named by `default_role_ids`, joined from the role table. ### `requires_approval: bool` `requires_approval`. ### `pre_approved: bool` `pre_approved`. ### `overrides_stricter: bool` Whether `admission_overrides` (if any) are all at least as strict as the policy; the engine compares the fields. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/invites/struct.InviteRequest.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-lockdown/ --- # Struct permissions::Lockdown > The community's lockdown row. `zaun_community_protocol::permissions::Lockdown` · Struct ```rust pub struct Lockdown { … } ``` The community's lockdown row. ## Fields ### `restrictions: LockdownRestrictions` The named restrictions. ### `expires_at_ms: u64` Expiry in ms since the epoch; the lockdown is active while `now < expires_at_ms`. ### `newcomer_window_ms: u64` `newcomer_window_s` in ms: `restrict_newcomers` covers members admitted this recently. ## Methods ### `is_active` ```rust pub const fn is_active(&self, now_ms: u64) -> bool ``` Whether the lockdown is in force at `now_ms`. ### `limits_expensive` ```rust pub const fn limits_expensive(&self, is_owner: bool, now_ms: u64) -> bool ``` Whether `restrict_expensive` binds a member at `now_ms`: the lockdown is in force, names it, and the member is not the owner (the only exemption, ADR-0016). ### `max_mask` ```rust pub fn max_mask(restrictions: LockdownRestrictions, newcomers: Permissions) -> Permissions ``` The whole permission mask the lockdown can remove from anyone, given the policy's newcomer mask. H3 checks a lockdown enable against this (permissions the protocol). ### `mask_for` ```rust pub fn mask_for(&self, admitted_at_ms: u64, newcomers: Permissions, now_ms: u64) -> Permissions ``` The mask for one member admitted at `admitted_at_ms`; empty once expired. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/lockdown/struct.Lockdown.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-lockdownrestrictions/ --- # Struct permissions::LockdownRestrictions > The restrictions a lockdown names. `zaun_community_protocol::permissions::LockdownRestrictions` · Struct ```rust pub struct LockdownRestrictions(…) ``` The restrictions a lockdown names. ## Methods ### `empty` ```rust pub const fn empty() -> Self ``` Get a flags value with all bits unset. ### `all` ```rust pub const fn all() -> Self ``` Get a flags value with all known bits set. ### `bits` ```rust pub const fn bits(&self) -> u16 ``` Get the underlying bits value. The returned value is exactly the bits set in this flags value. ### `from_bits` ```rust pub const fn from_bits(bits: u16) -> Option ``` Convert from a bits value. This method will return `None` if any unknown bits are set. ### `from_bits_truncate` ```rust pub const fn from_bits_truncate(bits: u16) -> Self ``` Convert from a bits value, unsetting any unknown bits. ### `from_bits_retain` ```rust pub const fn from_bits_retain(bits: u16) -> Self ``` Convert from a bits value exactly. ### `from_name` ```rust pub fn from_name(name: &str) -> Option ``` Get a flags value with the bits of a flag with the given name set. This method will return `None` if `name` is empty or doesn't correspond to any named flag. ### `is_empty` ```rust pub const fn is_empty(&self) -> bool ``` Whether all bits in `self` are unset. ### `is_all` ```rust pub const fn is_all(&self) -> bool ``` Whether all known bits in this flags value are set. ### `intersects` ```rust pub const fn intersects(&self, other: Self) -> bool ``` Whether any set bits in `other` are also set in `self`. ### `contains` ```rust pub const fn contains(&self, other: Self) -> bool ``` Whether all set bits in `other` are also set in `self`. ### `insert` ```rust pub fn insert(&mut self, other: Self) ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `remove` ```rust pub fn remove(&mut self, other: Self) ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `remove` won't truncate `other`, but the `!` operator will. ### `toggle` ```rust pub fn toggle(&mut self, other: Self) ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `set` ```rust pub fn set(&mut self, other: Self, value: bool) ``` Call `insert` when `value` is `true` or `remove` when `value` is `false`. ### `intersection` ```rust pub const fn intersection(self, other: Self) -> Self ``` The bitwise and (`&`) of the bits in `self` and `other`. ### `union` ```rust pub const fn union(self, other: Self) -> Self ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `difference` ```rust pub const fn difference(self, other: Self) -> Self ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `difference` won't truncate `other`, but the `!` operator will. ### `symmetric_difference` ```rust pub const fn symmetric_difference(self, other: Self) -> Self ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `complement` ```rust pub const fn complement(self) -> Self ``` The bitwise negation (`!`) of the bits in `self`, truncating the result. ### `iter` ```rust pub const fn iter(&self) -> Iter ``` Yield a set of contained flags values. Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value. ### `iter_names` ```rust pub const fn iter_names(&self) -> IterNames ``` Yield a set of contained named flags values. This method is like [`iter`](#method.iter), except only yields bits in contained named flags. Any unknown bits, or bits not corresponding to a contained flag will not be yielded. ### `from_wire` ```rust pub fn from_wire(name: &str) -> Option ``` Parses one wire name; `None` for an unknown restriction. ### `permission_mask` ```rust pub fn permission_mask(self) -> Permissions ``` The bits every member loses while these restrictions are active, before the per-member `restrict_newcomers` part (permissions the protocol). ## Trait implementations `Binary`, `BitAnd`, `BitAndAssign`, `BitOr`, `BitOrAssign`, `BitXor`, `BitXorAssign`, `Clone`, `Copy`, `Debug`, `Default`, `Eq`, `Extend`, `Flags`, `FromIterator`, `Hash`, `IntoIterator`, `LowerHex`, `Not`, `Octal`, `PartialEq`, `PublicFlags`, `StructuralPartialEq`, `Sub`, `SubAssign`, `UpperHex` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/lockdown/restrictions/struct.LockdownRestrictions.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-override/ --- # Struct permissions::Override > A permission override on one channel or category (permissions the protocol). `zaun_community_protocol::permissions::Override` · Struct ```rust pub struct Override { … } ``` A permission override on one channel or category (permissions the protocol). ## Fields ### `target: OverrideTarget` The role or member it applies to. ### `allow: Permissions` Bits explicitly allowed. ### `deny: Permissions` Bits explicitly denied. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/input/struct.Override.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-party/ --- # Struct permissions::Party > An actor or target member as the hierarchy sees it. Build it with `Resolver::party`. `zaun_community_protocol::permissions::Party` · Struct ```rust pub struct Party { … } ``` An actor or target member as the hierarchy sees it. Build it with `Resolver::party`. ## Fields ### `id: MemberId` The member id. ### `is_owner: bool` Whether this is the owner bound in the current descriptor. ### `is_admin: bool` Whether the member holds `ADMINISTRATOR` (exempt from H3 only). ### `top: Top` The member's top position. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/hierarchy/struct.Party.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-requirement/ --- # Struct permissions::Requirement > What a command requires (permissions the protocol, the protocol). `zaun_community_protocol::permissions::Requirement` · Struct ```rust pub struct Requirement { … } ``` What a command requires (permissions the protocol, the protocol). ## Fields ### `access: Access` Who may send it. ### `scope: Scope` Where the bits are evaluated. ### `all: Permissions` Bits that must all be effective. ### `any: Permissions` When non-empty, at least one of these must be effective as well. ### `others: Option` When acting on another member's object (message, reaction, nickname, invitation, report), these bits replace `all`. ### `conditional: Permissions` Bits needed only for some bodies: the engine passes the ones that apply (attachments, links, a new emoji, a pre-approved invitation, a channel stream, a full record). ### `not_timed_out: bool` Refused with `TIMED_OUT` while timed out, even when the bits survive the timeout. ### `not_waiting: bool` Refused with `FORBIDDEN{reason:"probation"}` during the waiting period. ### `reserved: bool` Reserved (P1/P2): a v1 host answers `UNSUPPORTED_FEATURE` before any check. ## Methods ### `access` ```rust pub const fn access(access: Access) -> Self ``` A row with no bits. ### `bits` ```rust pub const fn bits(scope: Scope, all: Permissions) -> Self ``` A member command needing `all` in `scope`. ### `check` ```rust pub fn check(&self, resolved: &Resolved, other: bool, conditional: Permissions) -> Result<(), Denial> ``` Checks the resolved permissions in the requirement's scope. `other` is true when the actor acts on another member's object; `conditional` holds the conditional bits the body needs (masked by `Requirement::conditional`). ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/requirement/struct.Requirement.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-resolved/ --- # Struct permissions::Resolved > One resolved permission set (`cp` or `chp`). `zaun_community_protocol::permissions::Resolved` · Struct ```rust pub struct Resolved { … } ``` One resolved permission set (`cp` or `chp`). ## Fields ### `effective: Permissions` The effective permissions after step 7. Always a subset of `KNOWN`. ### `grants: Permissions` The grants of steps 1–6 (after dependencies), before any restriction. ### `before_lockdown: Permissions` The permissions after steps 7a–7b but before the lockdown (7c) and the `locked` flag (7d). H3 for lockdown management compares against this, so a lockdown never prevents its own management. ### `steps: Steps` What each restriction removed. ### `timed_out: bool` Whether step 7a applied. ### `waiting: bool` Whether the waiting period applied. ## Methods ### `unrestricted` ```rust pub fn unrestricted(p: Permissions) -> Self ``` A result with no restriction (owner, or a member the state gate zeroes). ### `has` ```rust pub const fn has(&self, bits: Permissions) -> bool ``` Whether every bit of `bits` is effective. ### `require` ```rust pub fn require(&self, bits: Permissions) -> Result<(), Denial> ``` `Ok` when every bit of `bits` is effective, else a denial naming the missing bits. ### `require_any` ```rust pub fn require_any(&self, bits: Permissions) -> Result<(), Denial> ``` `Ok` when at least one bit of `bits` is effective (or `bits` is empty). ### `explain` ```rust pub fn explain(&self, missing: Permissions) -> Denial ``` Attributes missing bits to a restriction. A reason is given only when the restrictions are the whole cause (every missing bit was granted); then it names the first step, in order 7a–7d, that removed one of them or its prerequisite. ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolved/struct.Resolved.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-resolver/ --- # Struct permissions::Resolver > Per-member state computed once; then `Resolver::community` and `Resolver::channel` are cheap enough to call for every channel of a snapshot. `zaun_community_protocol::permissions::Resolver` · Struct ```rust pub struct Resolver<'a> { … } ``` Per-member state computed once; then `Resolver::community` and `Resolver::channel` are cheap enough to call for every channel of a snapshot. ## Methods ### `base` ```rust pub const fn base(&self) -> Permissions ``` `base(m)` (steps 1–2), before any restriction; empty for a non-admitted member. ### `is_owner` ```rust pub const fn is_owner(&self) -> bool ``` Whether the member is the owner. ### `is_admin` ```rust pub const fn is_admin(&self) -> bool ``` Whether the member holds `ADMINISTRATOR` (and is admitted); false for the owner. ### `is_timed_out` ```rust pub const fn is_timed_out(&self) -> bool ``` Whether step 7a applies (never to the owner or an administrator). ### `in_waiting_period` ```rust pub const fn in_waiting_period(&self) -> bool ``` Whether the admission policy's waiting period still applies. ### `party` ```rust pub fn party(&self) -> Party ``` The member as the management hierarchy sees it. ### `new` ```rust pub fn new(subject: Subject<'a>, ctx: &Context<'_>) -> Self ``` Phase one: the membership gate, `base(m)` and the member's restriction masks. ### `community` ```rust pub fn community(&self) -> Resolved ``` `community_permissions(m, ctx)`: `cp(A)` of the protocol ### `channel` ```rust pub fn channel(&self, ch: &Channel<'_>) -> Resolved ``` `channel_permissions(m, ch, ctx)`: `chp(A, ch)` of the protocol ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/restrict/struct.Resolver.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-role/ --- # Struct permissions::Role > A role as the resolver sees it (permissions the protocol). `zaun_community_protocol::permissions::Role` · Struct ```rust pub struct Role { … } ``` A role as the resolver sees it (permissions the protocol). ## Fields ### `id: RoleId` The role id; `RoleId::EVERYONE` for `@everyone`. ### `permissions: Permissions` Granted bits, unknown bits retained. ### `position: u32` Position: 0 is `@everyone`, higher means more authority. Used only by the protocol ## Trait implementations `Clone`, `Copy`, `Debug`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/input/struct.Role.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-steps/ --- # Struct permissions::Steps > The masks each step 7 restriction removed, in application order. `zaun_community_protocol::permissions::Steps` · Struct ```rust pub struct Steps { … } ``` The masks each step 7 restriction removed, in application order. ## Fields ### `timeout: Permissions` 7a: everything but `TIMEOUT_KEEP` while timed out. ### `probation: Permissions` 7b: the newcomer mask during probation and the waiting-period mask. ### `lockdown: Permissions` 7c: the active lockdown's mask for this member. ### `lock: Permissions` 7d: `LOCK_MASK` when the channel flag applies. ## Trait implementations `Clone`, `Copy`, `Debug`, `Default`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/resolved/struct.Steps.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-permissions-subject/ --- # Struct permissions::Subject > The member whose permissions are resolved. `zaun_community_protocol::permissions::Subject` · Struct ```rust pub struct Subject<'a> { … } ``` The member whose permissions are resolved. ## Fields ### `id: MemberId` The member id (matches member overrides). ### `is_owner: bool` Whether this member is the owner bound in the current descriptor. ### `state: MembershipState` The lifecycle state. ### `roles: &'a [Role]` The roles the member holds, joined from the role table. `@everyone` need not be listed (its permissions come from `Context::everyone`); listing it is harmless. ### `timeout_until_ms: Option` `members.timeout_until` in ms since the epoch. ### `admitted_at_ms: u64` When the member was admitted (left `Pending`), in ms since the epoch. Drives the waiting period and a lockdown's `restrict_newcomers` window. ## Trait implementations `Clone`, `Copy`, `Debug` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/permissions/input/struct.Subject.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-acceptedstate/ --- # Struct signed::AcceptedState > What a verifier stores per community for anti-rollback (rule 5). `zaun_community_protocol::signed::AcceptedState` · Struct ```rust pub struct AcceptedState { … } ``` What a verifier stores per community for anti-rollback (rule 5). ## Fields ### `revision: u64` Highest accepted descriptor revision. ### `descriptor_hash: [u8; 32]` `SHA3-256` of that descriptor's bytes (an equal revision must have equal bytes). ### `delegation: Option` Highest accepted delegation epoch and its hash; none before the first delegation. ### `rotation_seq: u64` Highest accepted `rotation_seq` (0 when never rotated). ### `root_key_hash: [u8; 32]` `SHA3-256` of the root key accepted at `rotation_seq`; every later chain must pass through that key, so a retired key cannot fork the chain. ### `min_suite: u8` Highest accepted `min_suite`. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/validity/struct.AcceptedState.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-admissionsummary/ --- # Struct signed::AdmissionSummary > `AdmissionSummary = mode u8 ‖ level u8`: the owner's public claim; the host's policy is authoritative for enforcement. `zaun_community_protocol::signed::AdmissionSummary` · Struct ```rust pub struct AdmissionSummary { … } ``` `AdmissionSummary = mode u8 ‖ level u8`: the owner's public claim; the host's policy is authoritative for enforcement. ## Fields ### `mode: AdmissionMode` Admission mode. ### `level: VerificationLevel` Verification level. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Encode`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/descriptor/parts/struct.AdmissionSummary.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-botpackage/ --- # Struct signed::BotPackage > The signed header of a bot package, signed by the publisher key inside it. `zaun_community_protocol::signed::BotPackage` · Struct ```rust pub struct BotPackage { … } ``` The signed header of a bot package, signed by the publisher key inside it. ## Fields ### `app_id: String` 3: lowercase reverse-DNS, 3–64 bytes. ### `version: String` 4: Semantic Versioning 2.0.0 without build metadata, ≤ 64 bytes. ### `publisher_key: Option` 5: the publisher key; the signer. `None` (written as `PUBLIC_KEY_LEN` zero bytes) only in an unsigned development package, whose signature is all zero too. ### `world: String` 6: `zaun:bot/bot@`, ≤ 64 bytes. ### `manifest_sha3: [u8; 32]` 7: `SHA3-256` of the manifest bytes. ### `component_sha3: [u8; 32]` 8: `SHA3-256` of the component bytes. ### `created_at: u64` 9: ms since the epoch. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/struct.BotPackage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-chainhead/ --- # Struct signed::ChainHead > Every root key of a verified chain, `K₀` (genesis) to `Kₙ` (current). Only `super::verify_chain` creates one. `zaun_community_protocol::signed::ChainHead` · Struct ```rust pub struct ChainHead { … } ``` Every root key of a verified chain, `K₀` (genesis) to `Kₙ` (current). Only `super::verify_chain` creates one. ## Methods ### `genesis` ```rust pub fn genesis(&self) -> &PublicKey ``` `K₀`, from which the community id derives. ### `key` ```rust pub fn key(&self) -> &PublicKey ``` The current root key `Kₙ`. ### `key_at` ```rust pub fn key_at(&self, rotation_seq: u64) -> Option<&PublicKey> ``` The root key after rotation `rotation_seq` (`K₀` for 0), if the chain is that long. ### `rotation_seq` ```rust pub fn rotation_seq(&self) -> u64 ``` `n`: the last `rotation_seq`, 0 when never rotated. ### `suite` ```rust pub const fn suite(&self) -> u8 ``` The suite of the current key (the last `new_suite`). ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/rotation/head/struct.ChainHead.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-communitydescriptor/ --- # Struct signed::CommunityDescriptor > The community's public, owner-signed statement. Signed by the current root key. `zaun_community_protocol::signed::CommunityDescriptor` · Struct ```rust pub struct CommunityDescriptor { … } ``` The community's public, owner-signed statement. Signed by the current root key. ## Fields ### `community_id: CommunityId` 2: derives from the **genesis** root key. ### `revision: u64` 3: ≥ 1; strictly increasing per community. ### `root_public_key: PublicKey` 4: the current root key (genesis, or `new_root` of the last rotation). ### `rotations: Vec` 5: ≤ 1: only the most recent rotation; empty when never rotated. ### `min_suite: u8` 6: ≥ `0x01`; never decreases across revisions. ### `name: String` 7: 2–100 scalars, ≤ 400 bytes. ### `description: Option` 8: ≤ 1 000 scalars, ≤ 4 000 bytes. ### `icon: Option<[u8; 32]>` 9: `SHA3-256` of the icon bytes. ### `languages: Vec` 10: ≤ 8 BCP 47 tags, each ≤ 35 bytes. ### `categories: Vec` 11: ≤ 8 topic tags, each 1–32 scalars. ### `rules: Vec` 12: ≤ 20 rules, each 1–500 scalars, ≤ 8 192 bytes encoded in total. ### `moderation_policy: Option` 13: ≤ 4 000 scalars. ### `operator_contact: Option` 14: ≤ 256 scalars. ### `abuse_contact: Option` 15: ≤ 256 scalars. ### `admission_summary: AdmissionSummary` 16: the owner's public claim about admission. ### `discovery: Discovery` 17: private, unlisted or listed. ### `protocol_min: u16` 18: ≥ 1. ### `protocol_max: u16` 19: ≥ `protocol_min`. ### `owner_member_key: PublicKey` 20: the owner binding (ADR-0005). ### `delegation: Option` 21: none = no host authorised (community suspended). ### `public_channel_links: Vec` 22: experimental (Appendix A); ≤ 4, each ≤ 2 048 B; empty in v1-conformant descriptors. ### `issued_at: u64` 23: ms. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/descriptor/struct.CommunityDescriptor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-delegationref/ --- # Struct signed::DelegationRef > `DelegationRef = epoch u64 ‖ delegation_hash bytes32`, where `delegation_hash` is `SHA3-256` of the delegation's canonical bytes (not its signature). `zaun_community_protocol::signed::DelegationRef` · Struct ```rust pub struct DelegationRef { … } ``` `DelegationRef = epoch u64 ‖ delegation_hash bytes[32]`, where `delegation_hash` is `SHA3-256` of the delegation's canonical bytes (not its signature). ## Fields ### `epoch: u64` The delegation's epoch. ### `delegation_hash: [u8; 32]` `SHA3-256(delegation bytes)`. ## Trait implementations `Clone`, `Copy`, `Debug`, `Decode`, `Encode`, `Eq`, `Hash`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/descriptor/parts/struct.DelegationRef.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-exportmanifest/ --- # Struct signed::ExportManifest > Signed by the exporting host's key (and, in a later version, the root key when the owner exports). The key is inside the bytes: an importer trusts it only once it matches a host de `zaun_community_protocol::signed::ExportManifest` · Struct ```rust pub struct ExportManifest { … } ``` Signed by the exporting host's key (and, in a later version, the root key when the owner exports). The key is inside the bytes: an importer trusts it only once it matches a host delegation signed by the community's root (ADR-0013). ## Fields ### `community_id: CommunityId` 2: the community. ### `host_public_key: PublicKey` 3: the exporting host's key; the signer. ### `schema_version: u32` 4: the exporter's `host.db` schema version. ### `revision: u64` 5: the descriptor revision the exporter held. ### `delegation_epoch: u64` 6: the delegation epoch the exporter held. ### `exported_at: u64` 7: ms since the epoch. ### `entries: Vec` 8: every chunk, in bundle order. ## Methods ### `verify_self_signed` ```rust pub fn verify_self_signed(json: &SignedJson, min_suite: u8) -> Result, SignedError> ``` Verifies a manifest under the host key inside its own bytes. The key is read before verification and decides nothing else; the importer must then match it to a delegation the community's root signed. # Errors `SignedError` when the bytes do not decode or the signature does not verify. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/export_manifest/struct.ExportManifest.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-hostdelegation/ --- # Struct signed::HostDelegation > The root key's authorisation of one host to operate the community. `zaun_community_protocol::signed::HostDelegation` · Struct ```rust pub struct HostDelegation { … } ``` The root key's authorisation of one host to operate the community. ## Fields ### `community_id: CommunityId` 2: the community. ### `host_id: HostId` 3: MUST equal the derivation from `host_public_key`. ### `host_public_key: PublicKey` 4: the host key. ### `host_addresses: Vec` 5: 1–4 SimpleX contact addresses of the host, each ≤ 2 048 bytes. ### `scopes: Scopes` 6: scopes. ### `epoch: u64` 7: ≥ 1. ### `not_before: u64` 8: ms. ### `expires_at: Option` 9: ms; none = until replaced or revoked. ### `issued_at: u64` 10: ms. ## Methods ### `grants` ```rust pub fn grants(&self, required: Scopes) -> bool ``` Whether the delegation grants every scope in `required` (unknown bits never count). ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/delegation/struct.HostDelegation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-hostsessionproof/ --- # Struct signed::HostSessionProof > The host's proof of key possession in `session.welcome`. Signed by the host key. `zaun_community_protocol::signed::HostSessionProof` · Struct ```rust pub struct HostSessionProof { … } ``` The host's proof of key possession in `session.welcome`. Signed by the host key. ## Fields ### `host_id: HostId` 2: the host. ### `client_nonce: Nonce` 3: from `session.hello`. ### `host_challenge: Challenge` 4: the challenge sent in this welcome. ### `community_id: Option` 5: the bound or requested community. ### `delegation_epoch: Option` 6: the epoch the host operates under for field 5. ### `issued_at: u64` 7: ms since the epoch. ## Methods ### `verify_for_client` ```rust pub fn verify_for_client(signed: &SignedJson, host_public_key: &PublicKey, client_nonce: &Nonce, pair: Option<&ValidPair>) -> Result, SessionProofError> ``` The client's check: verifies under `host_public_key`, requires `host_id` to derive from it and `client_nonce` to be the client's fresh nonce. When a community is named, `pair` must be a (descriptor, delegation) pair already validated by `super::validate_pair` for that community, delegating to this `host_id` under this epoch; its `min_suite` then applies to the proof's signature. # Errors `SessionProofError` for a bad signature, encoding or mismatch. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/session/struct.HostSessionProof.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-manifestentry/ --- # Struct signed::ManifestEntry > One chunk: what it is, its length and its `SHA3-256`. `zaun_community_protocol::signed::ManifestEntry` · Struct ```rust pub struct ManifestEntry { … } ``` One chunk: what it is, its length and its `SHA3-256`. ## Fields ### `name: String` `table//` or `file//`. ### `size: u64` Bytes. ### `sha3_256: [u8; 32]` `SHA3-256` of the chunk. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/export_manifest/struct.ManifestEntry.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-memberkeyregistration/ --- # Struct signed::MemberKeyRegistration > Proves that the client holds the private key of the member key it registers. Signed by that key. `zaun_community_protocol::signed::MemberKeyRegistration` · Struct ```rust pub struct MemberKeyRegistration { … } ``` Proves that the client holds the private key of the member key it registers. Signed by that key. ## Fields ### `purpose: Purpose` 2: why the key is registered. ### `community_id: CommunityId` 3: the community. ### `host_id: HostId` 4: the host this registration is made to. ### `host_challenge: Challenge` 5: from this connection's latest `session.welcome`. ### `member_public_key: PublicKey` 6: the key being registered; the signer. ### `issued_at: u64` 7: ms since the epoch. ## Methods ### `verify_for_host` ```rust pub fn verify_for_host(signed: &SignedJson, member_public_key: &PublicKey, expected: &RegistrationExpectation, min_suite: u8) -> Result, RegistrationError> ``` The host's check: verifies under the command's `member_public_key` (the signer, supplied by the caller rather than read from the unverified bytes), then requires field 6 to be that key and fields 2–5 to match. Consuming the challenge is the caller's job. # Errors `RegistrationError` for a bad signature, encoding or mismatch. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/member_key/struct.MemberKeyRegistration.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-memberreauth/ --- # Struct signed::MemberReauth > Signed by the member key. Binds the challenge to the community, the new host and the delegation epoch it operates under, so a proof made for one host or epoch is useless at another `zaun_community_protocol::signed::MemberReauth` · Struct ```rust pub struct MemberReauth { … } ``` Signed by the member key. Binds the challenge to the community, the new host and the delegation epoch it operates under, so a proof made for one host or epoch is useless at another. ## Fields ### `community_id: CommunityId` 2: the community. ### `host_id: HostId` 3: the host this proof is made to. ### `delegation_epoch: u64` 4: the delegation epoch of that host (from its welcome's proof). ### `host_challenge: Challenge` 5: from this connection's latest `session.welcome`. ### `member_public_key: PublicKey` 6: the member key; the signer. ### `issued_at: u64` 7: ms since the epoch. ## Methods ### `verify_for_host` ```rust pub fn verify_for_host(signed: &SignedJson, member_public_key: &PublicKey, expected: &ReauthExpectation, min_suite: u8) -> Result, RegistrationError> ``` The host's check: verifies under the command's `member_public_key` (never a key read from the bytes), then requires field 6 to be that key and fields 2–5 to match. Consuming the challenge is the caller's job. # Errors `RegistrationError` for a bad signature, encoding or mismatch (an epoch mismatch is [`RegistrationError::Host`]: the proof was made for another delegation of a host). ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/member_reauth/struct.MemberReauth.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-parsedpackage/ --- # Struct signed::ParsedPackage > The parts of a `.zbot` file, not yet verified. `zaun_community_protocol::signed::ParsedPackage` · Struct ```rust pub struct ParsedPackage { … } ``` The parts of a `.zbot` file, not yet verified. ## Fields ### `header: BotPackage` The decoded header (read only to find the publisher key until verified). ### `header_bytes: Vec` The header's canonical bytes, which the signature covers. ### `signature: Vec` The 3 374 signature bytes (all zero for an unsigned package). ### `manifest: Vec` The manifest JSON bytes. ### `component: Vec` The WebAssembly component bytes. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/struct.ParsedPackage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-reauthexpectation/ --- # Struct signed::ReauthExpectation > What the host expects of a reauthentication: the envelope's community, this host, the epoch it operates under and the connection's current challenge. `zaun_community_protocol::signed::ReauthExpectation` · Struct ```rust pub struct ReauthExpectation { … } ``` What the host expects of a reauthentication: the envelope's community, this host, the epoch it operates under and the connection's current challenge. ## Fields ### `community_id: CommunityId` The envelope's community. ### `host_id: HostId` This host. ### `delegation_epoch: u64` The delegation epoch this host operates the community under. ### `host_challenge: Challenge` The connection's current, unused challenge. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/member_reauth/struct.ReauthExpectation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-registrationexpectation/ --- # Struct signed::RegistrationExpectation > What the host expects of a registration: the command's fields and the connection's current challenge. `zaun_community_protocol::signed::RegistrationExpectation` · Struct ```rust pub struct RegistrationExpectation { … } ``` What the host expects of a registration: the command's fields and the connection's current challenge. ## Fields ### `purpose: Purpose` The command's purpose. ### `community_id: CommunityId` The command's community. ### `host_id: HostId` This host. ### `host_challenge: Challenge` The connection's current, unused challenge. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/member_key/struct.RegistrationExpectation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-rootrotation/ --- # Struct signed::RootRotation > The replacement of the community's root key, signed by the old **and** the new key. `zaun_community_protocol::signed::RootRotation` · Struct ```rust pub struct RootRotation { … } ``` The replacement of the community's root key, signed by the old **and** the new key. ## Fields ### `community_id: CommunityId` 2: the community. ### `rotation_seq: u64` 3: 1 for the first rotation, then +1. ### `old_root: PublicKey` 4: the root key being retired. ### `new_root: PublicKey` 5: the root key taking over. ### `new_suite: u8` 6: the suite of `new_root`; ≥ the old key's suite. ### `issued_at: u64` 7: ms. ## Trait implementations `Clone`, `Debug`, `Decode`, `Encode`, `Eq`, `PartialEq`, `SignedObject`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/rotation/struct.RootRotation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-scopes/ --- # Struct signed::Scopes > Delegation scopes (field 6). Unknown bits are kept for re-encoding, are ignored and grant nothing. `zaun_community_protocol::signed::Scopes` · Struct ```rust pub struct Scopes(…) ``` Delegation scopes (field 6). Unknown bits are kept for re-encoding, are ignored and grant nothing. ## Methods ### `empty` ```rust pub const fn empty() -> Self ``` Get a flags value with all bits unset. ### `all` ```rust pub const fn all() -> Self ``` Get a flags value with all known bits set. ### `bits` ```rust pub const fn bits(&self) -> u64 ``` Get the underlying bits value. The returned value is exactly the bits set in this flags value. ### `from_bits` ```rust pub const fn from_bits(bits: u64) -> Option ``` Convert from a bits value. This method will return `None` if any unknown bits are set. ### `from_bits_truncate` ```rust pub const fn from_bits_truncate(bits: u64) -> Self ``` Convert from a bits value, unsetting any unknown bits. ### `from_bits_retain` ```rust pub const fn from_bits_retain(bits: u64) -> Self ``` Convert from a bits value exactly. ### `from_name` ```rust pub fn from_name(name: &str) -> Option ``` Get a flags value with the bits of a flag with the given name set. This method will return `None` if `name` is empty or doesn't correspond to any named flag. ### `is_empty` ```rust pub const fn is_empty(&self) -> bool ``` Whether all bits in `self` are unset. ### `is_all` ```rust pub const fn is_all(&self) -> bool ``` Whether all known bits in this flags value are set. ### `intersects` ```rust pub const fn intersects(&self, other: Self) -> bool ``` Whether any set bits in `other` are also set in `self`. ### `contains` ```rust pub const fn contains(&self, other: Self) -> bool ``` Whether all set bits in `other` are also set in `self`. ### `insert` ```rust pub fn insert(&mut self, other: Self) ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `remove` ```rust pub fn remove(&mut self, other: Self) ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `remove` won't truncate `other`, but the `!` operator will. ### `toggle` ```rust pub fn toggle(&mut self, other: Self) ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `set` ```rust pub fn set(&mut self, other: Self, value: bool) ``` Call `insert` when `value` is `true` or `remove` when `value` is `false`. ### `intersection` ```rust pub const fn intersection(self, other: Self) -> Self ``` The bitwise and (`&`) of the bits in `self` and `other`. ### `union` ```rust pub const fn union(self, other: Self) -> Self ``` The bitwise or (`|`) of the bits in `self` and `other`. ### `difference` ```rust pub const fn difference(self, other: Self) -> Self ``` The intersection of `self` with the complement of `other` (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `difference` won't truncate `other`, but the `!` operator will. ### `symmetric_difference` ```rust pub const fn symmetric_difference(self, other: Self) -> Self ``` The bitwise exclusive-or (`^`) of the bits in `self` and `other`. ### `complement` ```rust pub const fn complement(self) -> Self ``` The bitwise negation (`!`) of the bits in `self`, truncating the result. ### `iter` ```rust pub const fn iter(&self) -> Iter ``` Yield a set of contained flags values. Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value. ### `iter_names` ```rust pub const fn iter_names(&self) -> IterNames ``` Yield a set of contained named flags values. This method is like [`iter`](#method.iter), except only yields bits in contained named flags. Any unknown bits, or bits not corresponding to a contained flag will not be yielded. ## Trait implementations `Binary`, `BitAnd`, `BitAndAssign`, `BitOr`, `BitOrAssign`, `BitXor`, `BitXorAssign`, `Clone`, `Copy`, `Debug`, `Eq`, `Extend`, `Flags`, `FromIterator`, `Hash`, `IntoIterator`, `LowerHex`, `Not`, `Octal`, `PartialEq`, `PublicFlags`, `StructuralPartialEq`, `Sub`, `SubAssign`, `UpperHex` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/delegation/struct.Scopes.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-signed/ --- # Struct signed::Signed > A signed object whose signature has been made or verified, with its exact bytes. `zaun_community_protocol::signed::Signed` · Struct ```rust pub struct Signed { … } ``` A signed object whose signature has been made or verified, with its exact bytes. ## Methods ### `verify_and_decode` ```rust pub fn verify_and_decode(bytes: &[u8], sig: &Signature, key: &PublicKey, min_suite: u8) -> Result ``` Verifies `sig` over `bytes` under `key` with `T`'s context, **then** decodes. # Errors `SignedError::Signature` before any decoding, or `SignedError::Decode`. ### `from_json` ```rust pub fn from_json(json: &SignedJson, key: &PublicKey, min_suite: u8) -> Result ``` `Self::verify_and_decode` for the JSON form `{bytes, sig}`. # Errors `SignedError::SignatureEncoding` for a malformed `sig`, else as `verify_and_decode`. ### `object` ```rust pub const fn object(&self) -> &T ``` The decoded object. ### `into_object` ```rust pub fn into_object(self) -> T ``` The decoded object, consuming the wrapper. ### `bytes` ```rust pub fn bytes(&self) -> &[u8] ``` The canonical bytes `B`. ### `signature` ```rust pub const fn signature(&self) -> &Signature ``` The signature. ### `hash` ```rust pub fn hash(&self) -> [u8; 32] ``` `SHA3-256(B)`: the object's identity (never the signature, the protocol). ### `to_json` ```rust pub fn to_json(&self) -> SignedJson ``` The JSON form `{bytes, sig}`. ## Trait implementations `Clone`, `Debug`, `Eq`, `From>`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/object/struct.Signed.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-signedrootrotation/ --- # Struct signed::SignedRootRotation > A rotation with both signatures, unverified (verify with `super::verify_chain`). `zaun_community_protocol::signed::SignedRootRotation` · Struct ```rust pub struct SignedRootRotation { … } ``` A rotation with both signatures, unverified (verify with `super::verify_chain`). JSON: `{bytes, sig_old, sig_new}`; canonical: `bytes ‖ sig_old ‖ sig_new`, each as `bytes`. ## Fields ### `bytes: Vec` Canonical bytes of the `RootRotation`. ### `sig_old: Signature` Signature by `old_root`. ### `sig_new: Signature` Signature by `new_root`. ## Methods ### `sign` ```rust pub fn sign(rotation: &RootRotation, old: &SecretKey, new: &SecretKey) -> Result ``` Encodes `rotation` once and signs it (hedged) with the retiring key `old` and the new key `new`, proving possession of both. # Errors `SignedError` when the rotation does not encode or signing fails. ### `sign_deterministic` ```rust pub fn sign_deterministic(rotation: &RootRotation, old: &SecretKey, new: &SecretKey) -> Result ``` As `Self::sign`, deterministically. **Golden test vectors only.** # Errors `SignedError` when the rotation does not encode or signing fails. ## Trait implementations `Clone`, `Debug`, `Decode`, `Deserialize<'de>`, `Encode`, `Eq`, `PartialEq`, `Serialize`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/rotation/link/struct.SignedRootRotation.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-validdescriptor/ --- # Struct signed::ValidDescriptor > A descriptor that passed rule 1 and the descriptor parts of rule 5. `zaun_community_protocol::signed::ValidDescriptor` · Struct ```rust pub struct ValidDescriptor { … } ``` A descriptor that passed rule 1 and the descriptor parts of rule 5. ## Methods ### `descriptor` ```rust pub const fn descriptor(&self) -> &Signed ``` The verified descriptor. ### `chain` ```rust pub const fn chain(&self) -> &ChainHead ``` The verified rotation chain. ### `accepted_state` ```rust pub fn accepted_state(&self, previous: Option<&AcceptedState>) -> AcceptedState ``` The state to store after accepting this descriptor alone (for example a suspension): the delegation part is carried over from `previous`. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/validity/struct.ValidDescriptor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-validpair/ --- # Struct signed::ValidPair > A (descriptor, delegation) pair valid at the time it was checked, with the state to store. Only `validate_pair` creates one. `zaun_community_protocol::signed::ValidPair` · Struct ```rust pub struct ValidPair { … } ``` A (descriptor, delegation) pair valid at the time it was checked, with the state to store. Only `validate_pair` creates one. ## Methods ### `descriptor` ```rust pub const fn descriptor(&self) -> &Signed ``` The verified descriptor. ### `delegation` ```rust pub const fn delegation(&self) -> &Signed ``` The verified delegation. ### `chain` ```rust pub const fn chain(&self) -> &ChainHead ``` The verified rotation chain. ### `state` ```rust pub const fn state(&self) -> &AcceptedState ``` The anti-rollback state to store for the community after accepting this pair. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/validity/pair/struct.ValidPair.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/struct-signed-verifiedpackage/ --- # Struct signed::VerifiedPackage > A package whose signature (unless unsigned was allowed), hashes and manifest ids were checked. `zaun_community_protocol::signed::VerifiedPackage` · Struct ```rust pub struct VerifiedPackage { … } ``` A package whose signature (unless unsigned was allowed), hashes and manifest ids were checked. ## Fields ### `header: BotPackage` The header. ### `header_hash: [u8; 32]` `SHA3-256` of the header bytes: the package's identity. ### `publisher: Option` The publisher, or `None` for an unsigned development package. ### `manifest: Vec` The manifest JSON bytes. ### `component: Vec` The component bytes. ## Methods ### `signed` ```rust pub const fn signed(&self) -> bool ``` Whether a publisher signed it. ## Trait implementations `Clone`, `Debug`, `Eq`, `PartialEq`, `StructuralPartialEq` [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/bot_package/container/struct.VerifiedPackage.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/trait-command-body/ --- # Trait command::Body > A command body type: its wire name and response body type. `zaun_community_protocol::command::Body` · Trait ```rust pub trait Body { … } ``` A command body type: its wire name and response body type. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/trait.Body.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/trait-command-bodyvisitor/ --- # Trait command::BodyVisitor > Something done with a command body of a type known only at run time (`Command::visit`). `zaun_community_protocol::command::BodyVisitor` · Trait ```rust pub trait BodyVisitor { … } ``` Something done with a command body of a type known only at run time (`Command::visit`). ## Methods ### `visit` ```rust fn visit(self, body: &B) -> ::Output; ``` Called with the typed body. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/trait.BodyVisitor.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/trait-command-validate/ --- # Trait command::Validate > State-free checks of one body. `zaun_community_protocol::command::Validate` · Trait ```rust pub trait Validate { … } ``` State-free checks of one body. ## Methods ### `validate` ```rust fn validate(&self) -> Result<(), BodyError>; ``` Checks the protocol limits, ranges and spec rules that need no community state. # Errors The first violated rule. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/command/trait.Validate.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/trait-encoding-decode/ --- # Trait encoding::Decode > A type with a canonical decoding. `zaun_community_protocol::encoding::Decode` · Trait ```rust pub trait Decode { … } ``` A type with a canonical decoding. ## Methods ### `decode` ```rust fn decode(r: &mut Reader<'_>) -> Result; ``` Reads one value. # Errors `DecodeError` for truncated, oversized or invalid input. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/trait.Decode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/trait-encoding-encode/ --- # Trait encoding::Encode > A type with a canonical encoding (fixed-size or self-limiting). `zaun_community_protocol::encoding::Encode` · Trait ```rust pub trait Encode { … } ``` A type with a canonical encoding (fixed-size or self-limiting). ## Methods ### `encode` ```rust fn encode(&self, w: &mut Writer) -> Result<(), EncodeError>; ``` Appends the canonical encoding. # Errors `EncodeError` when a field breaks its limit or rule. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/encoding/trait.Encode.html) --- url: https://zaunchat.github.io/docs/reference/rust/zaun-community-protocol/trait-signed-signedobject/ --- # Trait signed::SignedObject > A signed object type: its canonical encoding (format byte first) and its context. `zaun_community_protocol::signed::SignedObject` · Trait ```rust pub trait SignedObject { … } ``` A signed object type: its canonical encoding (format byte first) and its context. ## Methods ### `to_bytes` ```rust fn to_bytes(&self) -> Result, EncodeError>; ``` The canonical bytes `B`. # Errors `EncodeError` when a field breaks its rule. ### `decode_unverified` ```rust fn decode_unverified(bytes: &[u8]) -> Result; ``` Decodes canonical bytes **without verifying** them. Receivers use `Signed::verify_and_decode`. # Errors `DecodeError` for non-canonical input or a broken field rule. ### `sign` ```rust fn sign(self, sk: &SecretKey) -> Result, SignedError>; ``` Encodes and signs (hedged). # Errors `SignedError` when the object does not encode or signing fails. ### `sign_deterministic` ```rust fn sign_deterministic(self, sk: &SecretKey) -> Result, SignedError>; ``` Encodes and signs deterministically. **Golden test vectors only.** # Errors `SignedError` when the object does not encode or signing fails. [Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/signed/object/trait.SignedObject.html) --- url: https://zaunchat.github.io/docs/reference/wit/ --- # Bot WIT interface > The zaun:bot WebAssembly world every Zaun bot is built against, generated from zaun-bot's wit/ directory. Every Zaun bot is a WebAssembly component built against the `zaun:bot` world, defined in [WIT](https://component-model.bytecodealliance.org/design/wit.html) in zaun-bot's `wit/` directory. The SDKs wrap it; read this when you write a new SDK or want the exact shapes. - **The world** (`world bot`) lists what a bot imports from the host (messages, interactions, commands, community, storage, http, timers, log) and what it exports (`init`, `on-event`, `on-interaction`, `on-autocomplete`, `on-timer`). - **Interfaces** group the host's functions; `types` holds every shared record and variant. The pages in this section are generated from the WIT on every deploy. If they are missing, this is a local preview built without `npm run gen`. --- url: https://zaunchat.github.io/docs/reference/wit/interface-audio/ --- # Interface: audio > Low-level audio output (capability `voice`): the bot writes the audio itself, packet by packet or sample by sample, instead of naming tracks for the player. For synthesisers, text to speech, mixers, a Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Low-level audio output (capability `voice`): the bot writes the audio itself, packet by packet or sample by sample, instead of naming tracks for the player. For synthesisers, text to speech, mixers, and bots that decode formats of their own. Output only: members' audio is never delivered to a bot. One stream at a time, in the bot's voice channel. Opening it pauses the player (`voice`); closing it resumes the player. `voice-event.audio-low` asks for more, so a bot can write as it plays without timers. ## Uses - `use types.{host-error}` ## Functions ### `open` ```wit open: func(options: stream-options) -> result<_, host-error>; ``` Opens the stream in the bot's voice channel, pausing the player. `CONFLICT` when the bot is in no voice channel or a stream is open; `UNSUPPORTED` for a format the host cannot take; `BAD_REQUEST` for a rate, channel count or low-water mark out of range. ### `write-opus` ```wit write-opus: func(packets: list>) -> result; ``` Opus packets, for an `opus` stream. Returns the audio buffered, in ms; `BUSY` past 3 s. ### `write-pcm` ```wit write-pcm: func(samples: list) -> result; ``` Interleaved samples, for a `pcm` stream; any count (the host frames them). Returns the audio buffered, in ms; `BUSY` past 3 s. ### `buffered-ms` ```wit buffered-ms: func() -> u32; ``` The audio written and not yet played, in ms (0 without a stream). ### `clear` ```wit clear: func() -> result<_, host-error>; ``` Drops everything buffered at once, keeping the stream open (to interrupt speech). ### `close` ```wit close: func(drain: bool); ``` Closes the stream: once the buffer has played (`drain`), or at once. The player resumes. Nothing happens without a stream. ## Types ### `pcm-format` *record* PCM the host encodes to Opus. | Member | Description | |---|---| | `sample-rate: u32` | 8000, 12000, 16000, 24000 or 48000 Hz (Opus's own rates; nothing is resampled). | | `channels: u8` | 1 (mono) or 2 (stereo, interleaved left-right). | ### `audio-format` *variant* How the bot's audio is encoded. | Member | Description | |---|---| | `opus` | Opus packets (2.5-120 ms each, at most 1000 bytes), sent as they are. | | `pcm(pcm-format)` | Signed 16-bit PCM, encoded to Opus by the host: `UNSUPPORTED` on hosts without an Opus encoder. | ### `stream-options` *record* | Member | Description | |---|---| | `format: audio-format` | | | `low-water-ms: option` | Send `audio-low` when less than this is buffered, in ms (20-2000; default 200). | | `title: option` | Shown as the current title in `voice-state` while the stream plays. | --- url: https://zaunchat.github.io/docs/reference/wit/interface-commands/ --- # Interface: commands > The bot's application commands. `init`'s registration is applied at start; this replaces them at run time (`command.set`, bulk overwrite). Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. The bot's application commands. `init`'s registration is applied at start; this replaces them at run time (`command.set`, bulk overwrite). ## Uses - `use types.{host-error, application-command, registered-command}` ## Functions ### `set` ```wit set: func(commands: list) -> result, host-error>; ``` --- url: https://zaunchat.github.io/docs/reference/wit/interface-community/ --- # Interface: community > Reads and moderation, all checked by the host against the bot's grants and permissions. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Reads and moderation, all checked by the host against the bot's grants and permissions. ## Uses - `use types.{id, host-error, member, channel, role, timestamp}` ## Functions ### `get-member` ```wit get-member: func(member-id: id) -> result; ``` Needs capability `members` for members the bot has not seen. ### `list-members` ```wit list-members: func(after: option, limit: u32) -> result, host-error>; ``` ### `get-channel` ```wit get-channel: func(channel-id: id) -> result; ``` ### `list-channels` ```wit list-channels: func() -> result, host-error>; ``` ### `get-role` ```wit get-role: func(role-id: id) -> result; ``` ### `list-roles` ```wit list-roles: func() -> result, host-error>; ``` ### `add-role` ```wit add-role: func(member-id: id, role-id: id) -> result<_, host-error>; ``` `member.roles.update`. ### `remove-role` ```wit remove-role: func(member-id: id, role-id: id) -> result<_, host-error>; ``` ### `timeout` ```wit timeout: func(member-id: id, until: option, reason: option) -> result<_, host-error>; ``` `member.timeout`; `none` clears. ### `kick` ```wit kick: func(member-id: id, reason: option) -> result<_, host-error>; ``` `member.kick`. --- url: https://zaunchat.github.io/docs/reference/wit/interface-dms/ --- # Interface: dms > Direct-message channels with members (capability `dms`, the protocol). The member decides: `FORBIDDEN` (`dms_closed`) when they turned DMs from bots off or closed this one. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Direct-message channels with members (capability `dms`, the protocol). The member decides: `FORBIDDEN` (`dms_closed`) when they turned DMs from bots off or closed this one. ## Uses - `use types.{id, host-error, channel}` ## Functions ### `open` ```wit open: func(member-id: id) -> result; ``` `dm.open`: the DM with `member-id`, created when there is none. ### `close` ```wit close: func(channel-id: id) -> result<_, host-error>; ``` `dm.close`: hides it from the bot's list. ### `list-open` ```wit list-open: func() -> result, host-error>; ``` `dm.list`: the DMs the bot has open. --- url: https://zaunchat.github.io/docs/reference/wit/interface-http/ --- # Interface: http > Outbound HTTPS to hosts in the bot's `network` grant. The request leaves from the host, so the remote server learns the host's address. The `local_network` grant adds exact `host:port` addresses next Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Outbound HTTPS to hosts in the bot's `network` grant. The request leaves from the host, so the remote server learns the host's address. The `local_network` grant adds exact `host:port` addresses next to the host (a media server on the same machine, say), reached over `http://` or `https://`. Only those addresses skip the private-address refusal; the operator's ceiling decides whether any may be granted. ## Functions ### `fetch` ```wit fetch: func(req: request) -> result; ``` ## Types ### `request` *record* | Member | Description | |---|---| | `method: string` | | | `url: string` | | | `headers: list>` | | | `body: option>` | | | `timeout-ms: option` | | ### `response` *record* | Member | Description | |---|---| | `status: u16` | | | `headers: list>` | | | `body: list` | | ### `http-error` *variant* | Member | Description | |---|---| | `not-granted(string)` | The host (or `host:port`) is not in the bot's `network` or `local_network` grant, or not in the operator's ceiling. | | `refused-address` | The name resolved to a loopback, private, link-local or reserved address, and the address is not a `local_network` grant. | | `invalid-url` | Malformed, or not `https://` (`http://` only for `local_network` addresses). | | `timeout` | | | `too-large` | | | `transport(string)` | | --- url: https://zaunchat.github.io/docs/reference/wit/interface-interactions/ --- # Interface: interactions > Answers to interactions. Only the bot that received an interaction may answer it. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Answers to interactions. Only the bot that received an interaction may answer it. ## Uses - `use types.{id, host-error, message-body, response}` ## Functions ### `respond` ```wit respond: func(interaction-id: id, response: response) -> result, host-error>; ``` The initial response, within 3 s (the runtime defers automatically at 2.5 s). Returns the message id when the response created a channel message. ### `followup` ```wit followup: func(interaction-id: id, body: message-body) -> result, host-error>; ``` A follow-up message, within 15 minutes; at most 10. ### `edit-original` ```wit edit-original: func(interaction-id: id, body: message-body) -> result<_, host-error>; ``` Edits the original response (ends a deferred "thinking" state). ### `delete-original` ```wit delete-original: func(interaction-id: id) -> result<_, host-error>; ``` Deletes the original response. --- url: https://zaunchat.github.io/docs/reference/wit/interface-log/ --- # Interface: log > Bot output for the operator (`zaun-host bot logs`); rate-limited. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Bot output for the operator (`zaun-host bot logs`); rate-limited. ## Functions ### `write` ```wit write: func(level: level, message: string); ``` ## Types ### `level` *enum* | Member | Description | |---|---| | `trace` | | | `debug` | | | `info` | | | `warn` | | | `error` | | --- url: https://zaunchat.github.io/docs/reference/wit/interface-messages/ --- # Interface: messages > Messages and reactions. Every call is an ordinary command on the bot's member, checked by the host's permission engine exactly as for any member. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Messages and reactions. Every call is an ordinary command on the bot's member, checked by the host's permission engine exactly as for any member. ## Uses - `use types.{id, host-error, message, message-body}` ## Functions ### `send` ```wit send: func(channel-id: id, body: message-body, reply-to: option) -> result; ``` `message.send`. Returns the new message id. ### `edit` ```wit edit: func(channel-id: id, message-id: id, body: message-body) -> result<_, host-error>; ``` `message.edit` of one of the bot's messages. ### `delete` ```wit delete: func(channel-id: id, message-id: id) -> result<_, host-error>; ``` `message.delete`. ### `react` ```wit react: func(channel-id: id, message-id: id, emoji: string) -> result<_, host-error>; ``` `reaction.add`. ### `unreact` ```wit unreact: func(channel-id: id, message-id: id, emoji: string) -> result<_, host-error>; ``` `reaction.remove` of the bot's own reaction. ### `history` ```wit history: func(channel-id: id, before: option, limit: u32) -> result, host-error>; ``` `message.history`: up to `limit` (1-100) messages before `before`. ### `upload` ```wit upload: func(channel-id: id, name: string, mime: string, bytes: list) -> result; ``` Uploads a file for the bot's next message (capability `attachments`). Returns the attachment id to put in `message-body.attachments`. ### `dm` ```wit dm: func(member-id: id, body: message-body) -> result, host-error>; ``` A direct message to member `member-id` (capability `dms`): opens the DM when needed, then sends. Returns the DM's channel id and the message id. --- url: https://zaunchat.github.io/docs/reference/wit/interface-presence/ --- # Interface: presence > The bot's own presence and custom status, shown to every member next to its name: 'Listening to lofi radio', '🎵 Type /play'. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. The bot's own presence and custom status, shown to every member next to its name: "Listening to lofi radio", "🎵 Type /play". ## Uses - `use types.{host-error, timestamp, activity}` ## Functions ### `set` ```wit set: func(status: status, activity: option); ``` Sets the bot's status and activity (`signal.presence`). The host shows changes at most every 3 s: a later call within that time replaces an earlier one that has not gone out. The bot is `online` without an activity when it starts. ### `set-status-text` ```wit set-status-text: func(text: option, emoji: option, expires-at: option) -> result<_, host-error>; ``` Sets the custom status text and emoji (`member.status.set`), kept until `expires-at` (or changed); `none` for both clears it. ## Types ### `status` *enum* `invisible` looks offline to everyone. | Member | Description | |---|---| | `online` | | | `idle` | | | `dnd` | | | `invisible` | | --- url: https://zaunchat.github.io/docs/reference/wit/interface-storage/ --- # Interface: storage > Per-bot key-value storage, limited by the `storage_bytes` grant. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Per-bot key-value storage, limited by the `storage_bytes` grant. ## Uses - `use types.{host-error}` ## Functions ### `get` ```wit get: func(key: string) -> result>, host-error>; ``` ### `set` ```wit set: func(key: string, value: list) -> result<_, host-error>; ``` `QUOTA_EXCEEDED` when the grant is used up. ### `delete` ```wit delete: func(key: string) -> result<_, host-error>; ``` ### `list-keys` ```wit list-keys: func(prefix: string, after: option, limit: u32) -> result, host-error>; ``` Keys starting with `prefix`, in order, after `after`, at most `limit` (≤ 1000). --- url: https://zaunchat.github.io/docs/reference/wit/interface-timers/ --- # Interface: timers > Timers (capability `timers`). Each fires `on-timer` with its id and tag. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Timers (capability `timers`). Each fires `on-timer` with its id and tag. ## Uses - `use types.{host-error}` ## Functions ### `after` ```wit after: func(ms: u64, tag: string) -> result; ``` Fires once after `ms`. ### `every` ```wit every: func(ms: u64, tag: string) -> result; ``` Fires every `ms` (≥ 1000). ### `cancel` ```wit cancel: func(id: u64); ``` --- url: https://zaunchat.github.io/docs/reference/wit/interface-types/ --- # Interface: types > Shared data types. Shapes follow the protocol. WIT has no recursive types, so nesting (containers, sections, sub-commands) is Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/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. ## Types ### `id` *type* A Zaun id: base64url without padding (22 characters for 16-byte ids). ```wit type id = string; ``` ### `timestamp` *type* Milliseconds since the Unix epoch. ```wit type timestamp = u64; ``` ### `permissions` *type* A permission bitfield (permissions.md the protocol). ```wit type permissions = u64; ``` ### `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` | The `reason` or `field` the host gave, if any. | | `retry-after-ms: option` | For `RATE_LIMITED` and `BUSY`. | ### `member` *record* | Member | Description | |---|---| | `member-id: id` | | | `display-name: string` | | | `role-ids: list` | | | `joined-at: timestamp` | | | `bot-id: option` | Present only for bots. | | `voice-channel: option` | 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. | ### `role` *record* | Member | Description | |---|---| | `role-id: id` | | | `name: string` | | | `color: option` | | | `position: u32` | | | `permissions: permissions` | | | `managed-by: option` | Set on a bot's managed role. | ### `channel` *record* | Member | Description | |---|---| | `channel-id: id` | | | `name: string` | | | `kind: string` | `text`, `announcement`, `voice`, `category`, `dm`, ... | | `topic: option` | | | `parent-id: option` | | | `position: u32` | | | `participants: list` | A `dm` channel's two members (the bot and the person); empty otherwise. | ### `attachment` *record* | Member | Description | |---|---| | `attachment-id: id` | | | `name: string` | | | `size: u64` | | | `mime: string` | | | `sha3-256: string` | base64url SHA3-256. | ### `embed-author` *record* | Member | Description | |---|---| | `name: string` | | | `url: option` | | | `icon: option` | | ### `embed-footer` *record* | Member | Description | |---|---| | `text: string` | | | `icon: option` | | ### `embed-field` *record* | Member | Description | |---|---| | `name: string` | | | `value: string` | | | `inline: bool` | | ### `embed` *record* | Member | Description | |---|---| | `title: option` | | | `description: option` | | | `url: option` | `https://` only. | | `color: option` | | | `timestamp: option` | | | `author: option` | | | `footer: option` | | | `image: option` | Attachment ids of the same message, never URLs. | | `thumbnail: option` | | | `fields: list` | | ### `button-style` *enum* Button styles 1-5; premium (6) is not supported. | Member | Description | |---|---| | `primary` | | | `secondary` | | | `success` | | | `danger` | | | `link` | | ### `button` *record* Type 2. | Member | Description | |---|---| | `id: option` | | | `style: button-style` | | | `label: option` | | | `emoji: option` | A Unicode emoji. | | `custom-id: option` | Styles 1-4. | | `url: option` | Style 5 only: an `https://` link, opened after the reader confirms. | | `disabled: bool` | | ### `select-option` *record* | Member | Description | |---|---| | `label: string` | | | `value: string` | | | `description: option` | | | `emoji: option` | | | `is-default: bool` | | ### `string-select` *record* Type 3. | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `options: list` | | | `placeholder: option` | | | `min-values: option` | | | `max-values: option` | | | `required: option` | In a modal. | | `disabled: bool` | | ### `entity-kind` *enum* Types 5 (user), 6 (role), 7 (mentionable), 8 (channel). | Member | Description | |---|---| | `user` | | | `role` | | | `mentionable` | | | `channel` | | ### `default-value-kind` *enum* | Member | Description | |---|---| | `user` | | | `role` | | | `channel` | | ### `default-value` *record* | Member | Description | |---|---| | `id: id` | | | `kind: default-value-kind` | | ### `entity-select` *record* | Member | Description | |---|---| | `id: option` | | | `kind: entity-kind` | | | `custom-id: string` | | | `placeholder: option` | | | `min-values: option` | | | `max-values: option` | | | `default-values: list` | | | `channel-types: list` | Channel select only. | | `required: option` | | | `disabled: bool` | | ### `row-item` *variant* | Member | Description | |---|---| | `button(button)` | | | `string-select(string-select)` | | | `entity-select(entity-select)` | | ### `action-row` *record* Type 1: up to 5 buttons, or one select. | Member | Description | |---|---| | `id: option` | | | `components: list` | | ### `text-display` *record* Type 10. | Member | Description | |---|---| | `id: option` | | | `content: string` | | ### `thumbnail` *record* Type 11: an image attachment of the same message. | Member | Description | |---|---| | `id: option` | | | `media: id` | | | `description: option` | | | `spoiler: bool` | | ### `section-accessory` *variant* | Member | Description | |---|---| | `button(button)` | | | `thumbnail(thumbnail)` | | ### `section` *record* Type 9: 1-3 text displays and an accessory. | Member | Description | |---|---| | `id: option` | | | `components: list` | | | `accessory: section-accessory` | | ### `media-item` *record* | Member | Description | |---|---| | `media: id` | | | `description: option` | | | `spoiler: bool` | | ### `media-gallery` *record* Type 12: 1-10 items. | Member | Description | |---|---| | `id: option` | | | `items: list` | | ### `file` *record* Type 13. | Member | Description | |---|---| | `id: option` | | | `file: id` | | | `spoiler: bool` | | ### `separator-spacing` *enum* | Member | Description | |---|---| | `small` | | | `large` | | ### `separator` *record* Type 14. | Member | Description | |---|---| | `id: option` | | | `divider: bool` | | | `spacing: separator-spacing` | | ### `container-child` *variant* | Member | Description | |---|---| | `action-row(action-row)` | | | `text-display(text-display)` | | | `section(section)` | | | `media-gallery(media-gallery)` | | | `file(file)` | | | `separator(separator)` | | ### `container` *record* Type 17. | Member | Description | |---|---| | `id: option` | | | `components: list` | | | `accent-color: option` | | | `spoiler: bool` | | ### `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` *enum* | Member | Description | |---|---| | `short` | | | `paragraph` | | ### `text-input` *record* Type 4. | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `style: text-input-style` | | | `min-length: option` | | | `max-length: option` | | | `required: option` | | | `value: option` | | | `placeholder: option` | | ### `file-upload` *record* Type 19. | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `min-values: option` | | | `max-values: option` | | | `required: option` | | ### `choice-option` *record* | Member | Description | |---|---| | `label: string` | | | `value: string` | | | `description: option` | | ### `radio-group` *record* Type 21: 2-10 options. | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `options: list` | | | `required: option` | | ### `checkbox-group` *record* Type 22: 1-10 options. | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `options: list` | | | `min-values: option` | | | `max-values: option` | | | `required: option` | | ### `checkbox` *record* Type 23. | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `is-default: bool` | | ### `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)` | | ### `label` *record* Type 18. | Member | Description | |---|---| | `id: option` | | | `label: string` | | | `description: option` | | | `component: label-child` | | ### `modal-item` *variant* | Member | Description | |---|---| | `label(label)` | | | `text-display(text-display)` | | ### `modal` *record* | Member | Description | |---|---| | `custom-id: string` | | | `title: string` | | | `components: list` | | ### `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` *record* | Member | Description | |---|---| | `everyone: bool` | | | `members: list` | | | `roles: list` | | ### `message-body` *record* What a bot sends: `message.send`, responses, follow-ups and edits. | Member | Description | |---|---| | `content: option` | | | `embeds: list` | | | `components: list` | | | `attachments: list` | Attachment ids the bot uploaded (`messages.upload`). | | `mentions: option` | | | `%flags: message-flags` | | ### `interaction-metadata` *record* | Member | Description | |---|---| | `interaction-id: id` | | | `kind: u8` | | | `name: option` | | | `member-id: id` | | ### `message` *record* | Member | Description | |---|---| | `message-id: id` | | | `channel-id: id` | | | `sequence: u64` | | | `author-id: id` | | | `created-at: timestamp` | | | `edited-at: option` | | | `content: string` | Empty when the bot lacks `message_content` (unless it is mentioned). | | `embeds: list` | | | `components: list` | | | `%flags: u32` | Raw flag bits. | | `reply-to: option` | | | `mentions: mentions` | | | `attachments: list` | | | `interaction: option` | | ### `command-kind` *enum* Type 1, 2, 3. | Member | Description | |---|---| | `chat-input` | | | `user` | | | `message` | | ### `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` *variant* | Member | Description | |---|---| | `text(string)` | | | `integer(s64)` | | | `number(f64)` | | ### `localized` *record* | Member | Description | |---|---| | `locale: string` | | | `text: string` | | ### `choice` *record* | Member | Description | |---|---| | `name: string` | | | `name-localizations: list` | | | `value: choice-value` | | ### `command-option` *record* | Member | Description | |---|---| | `kind: option-kind` | | | `name: string` | | | `name-localizations: list` | | | `description: string` | | | `description-localizations: list` | | | `required: bool` | | | `choices: list` | | | `channel-types: list` | | | `min-value: option` | | | `max-value: option` | | | `min-length: option` | | | `max-length: option` | | | `autocomplete: bool` | | ### `sub-command` *record* Type 1. | Member | Description | |---|---| | `name: string` | | | `name-localizations: list` | | | `description: string` | | | `description-localizations: list` | | | `options: list` | | ### `sub-command-group` *record* Type 2. | Member | Description | |---|---| | `name: string` | | | `name-localizations: list` | | | `description: string` | | | `description-localizations: list` | | | `sub-commands: list` | | ### `command-entry` *variant* | Member | Description | |---|---| | `value-option(command-option)` | | | `sub-command(sub-command)` | | | `group(sub-command-group)` | | ### `application-command` *record* | Member | Description | |---|---| | `kind: command-kind` | | | `name: string` | | | `name-localizations: list` | | | `description: string` | Empty for user and message commands. | | `description-localizations: list` | | | `options: list` | | | `default-member-permissions: option` | Bits the invoker needs in the channel. `some(0)`: owner only; `none`: everyone. | ### `registered-command` *record* | Member | Description | |---|---| | `command-id: id` | | | `kind: command-kind` | | | `name: string` | | ### `registration` *record* What `init` returns. | Member | Description | |---|---| | `commands: list` | | ### `option-value` *variant* | Member | Description | |---|---| | `text(string)` | | | `integer(s64)` | | | `boolean(bool)` | | | `number(f64)` | | | `id(id)` | | ### `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` *record* | Member | Description | |---|---| | `members: list` | | | `roles: list` | | | `channels: list` | | | `messages: list` | | | `attachments: list` | | ### `command-data` *record* | Member | Description | |---|---| | `command-id: id` | | | `name: string` | | | `kind: command-kind` | | | `group: option` | | | `sub-command: option` | | | `options: list` | | | `resolved: resolved` | | | `target-id: option` | The member (user commands) or message (message commands) acted on. | ### `component-data` *record* | Member | Description | |---|---| | `custom-id: string` | | | `component-type: u8` | | | `values: list` | | | `resolved: resolved` | | ### `modal-value` *record* | Member | Description | |---|---| | `id: option` | | | `custom-id: string` | | | `component-type: u8` | | | `value: option` | | | `values: list` | | ### `modal-data` *record* | Member | Description | |---|---| | `custom-id: string` | | | `components: list` | | | `resolved: resolved` | | ### `interaction-data` *variant* | Member | Description | |---|---| | `command(command-data)` | | | `component(component-data)` | | | `autocomplete(command-data)` | | | `modal-submit(modal-data)` | | ### `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` | | | `message: option` | For component interactions: the message holding the component. | | `data: interaction-data` | | | `created-at: timestamp` | | ### `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`. | ### `ready` *record* The bot's own identity, once its connection is up. | Member | Description | |---|---| | `bot-id: id` | | | `member-id: id` | | | `community-id: id` | | ### `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` *record* | Member | Description | |---|---| | `channel-id: id` | | | `message-id: id` | | ### `messages-deleted` *record* | Member | Description | |---|---| | `channel-id: id` | | | `message-ids: list` | | ### `reaction` *record* | Member | Description | |---|---| | `channel-id: id` | | | `message-id: id` | | | `emoji: string` | | | `member-id: id` | | ### `member-roles` *record* | Member | Description | |---|---| | `member-id: id` | | | `role-ids: list` | | ### `member-timeout` *record* `until` is `none` when the timeout was cleared. | Member | Description | |---|---| | `member-id: id` | | | `until: option` | | ### `typing` *record* | Member | Description | |---|---| | `channel-id: id` | | | `member-ids: list` | | ### `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` *record* What a member (or the bot) is doing. | Member | Description | |---|---| | `kind: activity-type` | | | `name: string` | 1-128 characters. | | `details: option` | <= 128: e.g. the track. | | `state: option` | <= 128: e.g. the artist. | | `url: option` | `streaming` only: an `https://` link (open only after the reader confirms). | | `started-at: option` | When it started, ms since the epoch. | | `emoji: option` | `custom` only: a Unicode emoji. | ### `presence` *record* `status`: `online`, `idle`, `dnd` or `offline` (invisible members look offline). | Member | Description | |---|---| | `member-id: id` | | | `status: string` | | | `activity: option` | | ### `community-profile` *record* | Member | Description | |---|---| | `system-channel-id: option` | | | `default-slowmode-s: u32` | | ### `event` *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` *record* | Member | Description | |---|---| | `kind: string` | | | `json: string` | | --- url: https://zaunchat.github.io/docs/reference/wit/interface-voice/ --- # Interface: voice > Voice channels (capability `voice`, ADR-0020). The host joins as the bot, end-to-end encrypted like any member, and plays audio for it in real time: the bot only says what to play. One stay per bot; ` Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. Voice channels (capability `voice`, ADR-0020). The host joins as the bot, end-to-end encrypted like any member, and plays audio for it in real time: the bot only says what to play. One stay per bot; `CONNECT` and `SPEAK` apply as for members. Nothing is transcoded, so audio is Opus: Ogg Opus files and streams (`.opus`, `.ogg` holding Opus), WebM Opus (`audio/webm`, YouTube's itag 251) on hosts that demux it, or Opus packets the bot makes. ## Uses - `use types.{id, host-error}` ## Functions ### `join` ```wit join: func(channel: id) -> result<_, host-error>; ``` Joins voice channel `channel` (leaving another one first). Returns once media can flow (at most about 10 s). `FORBIDDEN` without `voice`, `CONNECT` or `SPEAK`. ### `leave` ```wit leave: func(); ``` Leaves; playback stops and the queue is cleared. ### `play` ```wit play: func(track: track) -> result<_, host-error>; ``` Plays `track` now, replacing the current one; the queue stays. ### `enqueue` ```wit enqueue: func(track: track) -> result; ``` Adds `track` to the queue (≤ 100); returns the queue's length. ### `skip` ```wit skip: func(); ``` Ends the current track; the next one starts. ### `stop` ```wit stop: func(); ``` Ends the current track and clears the queue. ### `remove` ```wit remove: func(index: u32) -> result, host-error>; ``` Removes the queued track at `index` (0 plays next); returns its title. `NOT_FOUND` past the end. ### `move` ```wit move: func(%from: u32, to: u32) -> result<_, host-error>; ``` Moves the queued track at `from` to `to` (both 0-based); the tracks between shift. `NOT_FOUND` past the end. ### `shuffle` ```wit shuffle: func() -> result<_, host-error>; ``` Puts the queue in a random order (the current track keeps playing). ### `clear-queue` ```wit clear-queue: func() -> result<_, host-error>; ``` Empties the queue; the current track keeps playing. ### `set-loop` ```wit set-loop: func(mode: loop-mode) -> result<_, host-error>; ``` Sets what happens when a track ends (`off` when the bot joins). ### `seek` ```wit seek: func(ms: u64) -> result<_, host-error>; ``` Jumps to `ms` into the current track (past the end: the track ends). `UNSUPPORTED` for live streams and pushed audio, and on hosts that cannot seek; `CONFLICT` when nothing plays. ### `set-volume` ```wit set-volume: func(percent: u16) -> result<_, host-error>; ``` Sets the playback volume, 0-200 % (100 when the bot joins; `BAD_REQUEST` above 200). Changing it means decoding and re-encoding the Opus audio, so hosts without an Opus encoder answer `UNSUPPORTED`: call it anyway and tell the member. ### `pause` ```wit pause: func(); ``` ### `resume` ```wit resume: func(); ``` ### `push` ```wit push: func(packets: list>) -> result; ``` Opus packets (2.5 to 120 ms each, ≤ 1000 bytes) for the current `pushed` track. Returns the audio buffered, in ms; `BUSY` past 3 s, so push about as fast as it plays. ### `end-stream` ```wit end-stream: func(); ``` The `pushed` track ends once its buffered packets have played. ### `state` ```wit state: func() -> voice-state; ``` Where the bot is and what it plays. ## Types ### `source` *variant* Where a track's audio comes from. | Member | Description | |---|---| | `url(string)` | An `https://` Ogg Opus or WebM Opus file or stream (WebM where the host demuxes it; elsewhere a `track-error`), fetched by the host under the bot's `network` grant (the server learns the host's address) and played as it arrives. `http://` and `https://` URLs to a `local_network` address are fetched the same way, without leaving the host's machine or network. | | `ogg(list)` | Ogg Opus bytes the bot already holds (≤ 16 MiB). | | `pushed` | Opus packets the bot pushes with `push`, until `end-stream`. | ### `track` *record* Something to play. | Member | Description | |---|---| | `source: source` | | | `title: option` | Shown in events and `state`. | ### `player-status` *enum* | Member | Description | |---|---| | `idle` | | | `playing` | | | `paused` | | | `auto-paused` | | ### `loop-mode` *enum* What happens when a track ends: go on (`off`), play it again (`track`), or put it at the end of the queue (`queue`). | Member | Description | |---|---| | `off` | | | `track` | | | `queue` | | ### `voice-state` *record* | Member | Description | |---|---| | `channel: option` | The voice channel the bot is in. | | `status: player-status` | | | `current: option` | The current track's title. | | `queued: list>` | The queued tracks' titles, in order (index 0 plays next). | | `loop-mode: loop-mode` | What happens when a track ends. | | `position-ms: u64` | How far into the current track playback is, in ms (0 when idle). Paused time does not count. | | `duration-ms: option` | The current track's length in ms, when known: `none` for live streams, pushed audio, and files whose length the host cannot tell yet. | | `participants: list` | The members in the bot's voice channel, the bot itself left out (empty when it is in none). Empty means the bot is alone. | ### `voice-event` *variant* What happened, for `on-voice-event`. | Member | Description | |---|---| | `track-start(option)` | A track started (its title). | | `track-end(option)` | A track ended: played out, skipped, stopped or failed. | | `track-error(string)` | A track could not be read (the text names no URL). | | `member-joined(id)` | A member joined the bot's voice channel. | | `member-left(id)` | A member left it. | | `ended(option)` | The bot's stay ended (left, moved, disconnected, the host or relay went away). | | `queue-ended` | The last track played out with nothing queued (and no loop): the player is idle. Not sent after `stop` or `leave`. | | `audio-low(u32)` | The `audio` stream's buffer fell below its low-water mark: write more. The audio still buffered, in ms. Sent again only after a write. | | `audio-closed` | The `audio` stream closed: drained after `close`, closed at once, or the stay ended. | --- url: https://zaunchat.github.io/docs/reference/wit/world-bot/ --- # World: bot > A Zaun bot. The host calls one export at a time. Generated from `zaun:bot@0.2.0` (`wit/` in [zaun-bot](https://github.com/zaunchat/zaun-bot)). Do not edit. A Zaun bot. The host calls one export at a time. ## Uses - `import messages` - `import interactions` - `import commands` - `import dms` - `import community` - `import storage` - `import http` - `import timers` - `import voice` - `import audio` - `import log` - `import presence` - `use types.{event, interaction, choice, registration}` - `use voice.{voice-event}` ## Functions ### `init` ```wit export init: func(config: list>) -> registration; ``` Called once per instance start with the bot's configuration: the keys its manifest declares in `[config]`, each with the owner's value or else the declared default (keys with neither are left out). Secret values are passed like any other. ### `on-config-change` ```wit export on-config-change: func(config: list>); ``` The owner changed the configuration while the bot runs: every value again, as for `init`. The instance is not restarted and its commands stay registered. ### `on-event` ```wit export on-event: func(event: event); ``` A subscribed event. ### `on-interaction` ```wit export on-interaction: func(interaction: interaction); ``` An application command, component click or modal submit. ### `on-autocomplete` ```wit export on-autocomplete: func(interaction: interaction) -> list; ``` Autocomplete: return up to 25 choices for the focused option. ### `on-timer` ```wit export on-timer: func(id: u64, tag: string); ``` A timer fired. ### `on-voice-event` ```wit export on-voice-event: func(event: voice-event); ``` Something happened in the bot's voice stay or player. --- url: https://zaunchat.github.io/docs/reference/ --- # Reference > API reference for @zaun/bot (TypeScript), zaun-client, the zaun-bot Rust SDK and the protocol crate, plus the zaun-host command line, configuration and limits. The reference is **generated** from the code on every deploy (and daily), so it matches the `main` branch of each repository. Guides explain; the reference lists everything. ## APIs - [TypeScript bot API (@zaun/bot)](/docs/reference/typescript-bots/): The SDK for writing bots in TypeScript: builders, interactions, events, DMs, voice, storage. - [JavaScript client API (zaun-client)](/docs/reference/javascript/): zaun-client's JavaScript/TypeScript package for browsers, Node.js and Bun. - [Rust API](/docs/reference/rust/): zaun-client, the zaun-bot SDK and zaun-community-protocol: every public type and function. - [Bot WIT interface](/docs/reference/wit/): The zaun:bot WebAssembly world every bot is built against. ## The host - [zaun-host command line](/docs/reference/zaun-host-cli/): Every command and option. - [Configuration](/docs/reference/configuration/): Every key of zaun-host.toml. - [Limits](/docs/reference/limits/): Sizes, counts and timings for messages, embeds, commands, components and bots. --- url: https://zaunchat.github.io/docs/reference/zaun-host-cli/ --- # zaun-host command line > Every zaun-host command and option, with what it reads, writes and prints. ``` zaun-host [--config F | --data-dir D] … ``` The configuration defaults to `$ZAUN_HOST_CONFIG`, else `/etc/zaun-host/zaun-host.toml`; with `--data-dir D` it is `D/zaun-host.toml`. The store passphrase comes from `$ZAUN_HOST_PASSPHRASE` or the passphrase file, never the configuration. No command prints keys, passphrases or message content. ## Setup and serving | Command | What it does | |---|---| | `init --data-dir D [--smp smp://…]… [--xftp xftp://…]… [--config F]` | Creates `D` with `host.key` and `simplex.key` (mode 0600), `host.db` and a configuration. Refuses to overwrite. Without `--smp`, the official SimpleX servers. `D` defaults to `$ZAUN_HOST_DATA_DIR`. | | `run` (alias `serve`) | Serves until stopped (SIGTERM is safe). Writes the address to `D/address`. A second `run` on the same store is refused. | | `address` | Prints the SimpleX address (after one run). | | `id` | Prints the host id and public key, for owners creating a community. | | `status` | Checks the configuration, files and permissions; non-zero exit on a failure. | | `doctor` | Offline, read-only checks (configuration, directory modes, keys, lock, database schema and integrity, SimpleX store, relays, memory), each ok / warn / FAIL; non-zero exit on any FAIL. Safe while `run` is serving. | | `help`, `version` | As named. | ## Moving communities | Command | What it does | |---|---| | `export --community ID --out FILE --passphrase-file P` | Writes one community (members, roles, channels, bans, admission policy, history, audit log, stored attachments) to a new bundle, signed by this host and encrypted with the passphrase in `P` (mode 0600, at least 16 bytes). Invitation secrets never leave. Stop `run` first. | | `import --passphrase-file P [--descriptor F] FILE` | Loads a bundle after checking every signature and hash. The owner's delegation must name this host: it is in the bundle when published before the export, otherwise give it as `F` (JSON with `descriptor` and `delegation`). Stop `run` first. | ## Bots These talk to the running host through `D/control.sock`. Every one also takes `--config F | --data-dir D`. | Command | What it does | |---|---| | `bot install --community ID [--grant-all \| --grant CAP,…] [--yes] FILE` | Installs a `.zbot` package. Shows what it asks for in plain words and asks first, unless `--yes`. | | `bot list [--community ID]` | The installed bots and their state. | | `bot info --community ID BOT` | One bot's card, including what its manifest asks for. | | `bot update --community ID BOT FILE` | Installs a newer version (same publisher, higher version). Wider requests wait for approval. | | `bot grant --community ID BOT [--permissions DECIMAL] [--capabilities CAP,…]` | Replaces the bot's grants, within its request and the host's ceiling. | | `bot enable` / `bot disable` / `bot remove --community ID BOT` | As named. Removing deletes its role, commands and storage. | `CAP` is a permission name (`SEND_MESSAGES`) or a capability: `message_content`, `members`, `presence`, `timers`, `attachments`, `storage:`, `network:`. > **Note: Planned** > > `bot logs`, `bot update --all` and installing from an `https://` URL are accepted by the parser but not > yet implemented by the host. --- url: https://zaunchat.github.io/docs/reference/configuration/ --- # Configuration > Every key of zaun-host.toml, its default and its allowed values. Unknown keys are refused, and the file must never hold secrets. See [Configuring a host](/docs/guide/host/configuration/) for the reasoning behind each section. ## Top level | Key | Default | Meaning | |---|---|---| | `data_dir` | (required) | the data directory | | `smp_servers` | `[]` | SMP relays; empty means the official SimpleX servers. Addresses with an embedded password are refused | | `xftp_servers` | `[]` | XFTP file servers; empty means the official ones when `smp_servers` is empty too | | `max_connections` | `1000` | connected or connecting, before new requests are refused | | `in_flight_window` | `48` | per-member messages in flight, 32–64 | | `community_creation` | `"closed"` | `"closed"`, `"allow_list"` or `"open"` | | `creation_allow_list` | `[]` | community ids (base64url) allowed with `"allow_list"` | | `log_level` | `"info"` | `off`, `error`, `warn`, `info`, `debug` | | `passphrase_file` | `D/simplex.key` | the store passphrase file (mode 0600); `ZAUN_HOST_PASSPHRASE` overrides it | ## `[attachments]` | Key | Default | Range | |---|---|---| | `enabled` | `true` | | | `max_file_mb` | `25` | 1–1024 | | `community_quota_mb` | `2048` | 1–1 048 576 | | `transfers` | `8` | 1–12, host-wide | ## `[voice]` | Key | Default | Meaning | |---|---|---| | `enabled` | `true` | | | `mesh_max` | `8` | participants per voice channel, 2–10 | | `ice_servers` | `[]` | STUN/TURN URLs given to clients | | `ice_policy` | — | `"relay"` (TURN only; needs a `turn:` server) or `"all"` | | `ice_credentials_file` | — | a file (mode 0600) with the TURN `username` and `credential` | ## `[bots]` Every value is a ceiling: owners can grant less, never more. | Key | Default | Range / meaning | |---|---|---| | `enabled` | `true` | `false`: no bot runs, and owners can't install any | | `allow_remote_install` | `true` | owners may install bots from their app | | `allow_unsigned` | `false` | development only | | `max_bots` | `20` | per community, 1–50 | | `allow_network` | `false` | whether any bot may be granted internet access | | `network_allow_list` | `[]` | when set, granted hosts must be listed here exactly (lower-case names, an optional leading `*.`) | | `max_memory_mb` | `64` | per bot, 8–4096 | | `cpu_ms_per_call` | `500` | per handler call, 10–60 000 | | `max_storage_mb` | `64` | per bot, 1–1024 | | `allow_update_checks` | `false` | let the host fetch bots' `update_url` (planned) | | `allow_voice` | `true` | whether any bot may be granted `voice` (join voice channels and play audio) | | `allow_dms` | `true` | whether any bot may be granted `dms` (direct messages with members) | | `http_proxy` | — | `socks5h://…` or `http://…`, no credentials: route bots' requests through it | --- url: https://zaunchat.github.io/docs/reference/limits/ --- # Limits > Sizes, counts and timings for messages, embeds, application commands, interactions, components, presence and bots. Hosts may set stricter values. Text lengths count Unicode characters. ## Messages and embeds | Item | Limit | |---|---| | Message text | 1–4 000 (0 with an attachment, embed or components) | | Attachments per message | 10 | | Embeds per message | 10; 6 000 characters of embed text in all | | Embed title / description | 256 / 4 096 | | Embed fields | 25; name 256, value 1 024 | | Embed author name / footer text | 256 / 2 048 | | Links | `https://` only, 2 048 bytes | | Reactions | 20 distinct emoji per message | | Mentions per message | 50 members + 20 roles | | Content, embeds and components together, as JSON | 64 KiB | ## Application commands | Item | Limit | |---|---| | Commands per bot | 100 slash, 15 user, 15 message | | Options per command or sub-command | 25 | | Choices per option | 25 | | Name / description | 1–32 / 1–100 | | Text per command | 8 000 | | String option length | 0–6 000 | ## Interactions | Item | Limit | |---|---| | First response | 3 s after the host receives the interaction | | Follow-ups, edits, modal submission | 15 minutes | | Follow-ups | 10 per interaction | | Autocomplete choices | 25 | ## Components | Item | Limit | |---|---| | Action rows (classic messages) | 5; up to 5 buttons or 1 select each | | Components (V2 messages) | 40, counting nested ones | | `custom_id` | 1–100 bytes, unique per message or modal | | Button label | 80 | | Select options | 25 (label, value, description 100 each); placeholder 150 | | Text displays | 4 000 characters per message or modal | | Media gallery | 1–10 items | | Modal | title 45; 1–5 top-level labels or text displays | | Text input | 0–4 000 characters | | File upload | 0–10 files | ## Status and presence | Item | Limit | |---|---| | Activity name | 1–128 | | Activity details / state | 0–128 each | | Custom status text | 1–128 | | Emoji (activity or custom status) | one Unicode emoji, ≤ 64 bytes | | Presence changes shown | one per member every 3 s; the latest wins | ## Bots | Item | Limit | |---|---| | Bots per community | 50 (the host may set fewer) | | Package | header 4 KiB, manifest 64 KiB, component 64 MiB | | Network hosts per bot | 32 | | Storage per bot | 1 GiB (the host may set less) | | Crash limit | disabled after 5 crashes in 10 minutes | --- url: https://zaunchat.github.io/docs/reference/typescript-bots/ --- # TypeScript bot API (@zaun/bot) > The @zaun/bot SDK for writing Zaun bots in TypeScript; generated from its source. `@zaun/bot` is the TypeScript SDK for hosted bots. Its source (`sdk/js/src` in [zaun-bot](https://github.com/zaunchat/zaun-bot)) is the source of this reference, generated with TypeDoc on every deploy: see **@zaun/bot (TypeScript bots)** in the sidebar, or start at the [package overview](/docs/reference/js/zaun-bot/readme/). ## The main pieces | Export | What it does | |---|---| | `Bot` | `command(builder, execute, autocomplete?)`, `component(match, handler)`, `modal(match, handler)`, `on(event, listener)`, `exports()`; host APIs as `bot.messages`, `bot.dms`, `bot.voice`, `bot.presence`, `bot.storage`, `bot.timers`, `bot.http`, `bot.community`, `bot.log`; `bot.me` after `ready` | | `SlashCommandBuilder`, `ContextMenuCommandBuilder` | commands, sub-commands and groups, every option type, choices, bounds, autocomplete, localizations, default member permissions | | `EmbedBuilder` | rich embeds | | `ButtonBuilder`, `StringSelectMenuBuilder`, `UserSelectMenuBuilder`, `RoleSelectMenuBuilder`, `MentionableSelectMenuBuilder`, `ChannelSelectMenuBuilder`, `ActionRowBuilder` | message components | | `ContainerBuilder`, `SectionBuilder`, `TextDisplayBuilder`, `SeparatorBuilder`, `MediaGalleryBuilder`, `ThumbnailBuilder`, `FileBuilder` | Components V2 layouts | | `ModalBuilder`, `LabelBuilder`, `TextInputBuilder`, `RadioGroupBuilder`, `CheckboxGroupBuilder`, `CheckboxBuilder`, `FileUploadBuilder` | modals | | `ChatInputCommandInteraction`, `UserContextMenuCommandInteraction`, `MessageContextMenuCommandInteraction`, `MessageComponentInteraction`, `ModalSubmitInteraction`, `AutocompleteInteraction` | what handlers receive: `reply`, `deferReply`, `editReply`, `deleteReply`, `followUp`, `showModal`, `update`, `deferUpdate`, `respond`, `options.get*`, `fields.get*`, `is*()` | | `Activity` | the bot's activity for `bot.presence.set(status, activity?)`: `Activity.playing`, `streaming`, `listening`, `watching`, `competing`, `custom`, with `setDetails`, `setState`, `setStartedAt`, `setEmoji`; custom status text with `bot.presence.setStatusText`, `setStatus`, `clearStatus` | | `EventContext` | what event listeners receive: `send`, `reply`, `react`, `delete`, `dm`, `setPresence`, `setStatusText`, `isMe` | | `ZaunError`, `ZaunValidationError`, `HttpError` | refusals from the host, limit violations caught before sending, HTTP failures | | `PermissionFlagsBits`, `Limits` | permission bits and the protocol's limits | See the guide's [Bots](/docs/guide/bots/quickstart/) pages for usage, and [TypeScript or Rust?](/docs/guide/bots/typescript-or-rust/) for the rules specific to TypeScript. > **Note** > > If **@zaun/bot (TypeScript bots)** is missing from the sidebar, this build ran without the fetched > sources (a local preview). Run `npm run gen:fetch` and build again. --- url: https://zaunchat.github.io/docs/reference/javascript/ --- # JavaScript client API (zaun-client) > zaun-client's JavaScript/TypeScript package for browsers, Node.js and Bun; generated from its type definitions. `zaun-client`'s JavaScript package is the Rust client compiled to WebAssembly, with a JavaScript API on top. Its TypeScript definitions (`zaun/js/index.d.ts`) are the source of this reference, generated with TypeDoc on every deploy: see **zaun-client (JavaScript)** in the sidebar, or start at the [package overview](/docs/reference/js/zaun-client/readme/). ## The main classes | Class | What it does | |---|---| | `Client` | `start`, `join`, `createCommunity`, events (`on`, `once`, `off`), `save` | | `Community` | `channels`, `roles`, `members` (collections with `create`/`fetch`), `createInvite`, `leave` | | `Channel` | `send`, `messages.fetch`, `join` (voice), `delete` | | `Message` | `reply`, `edit`, `delete`, `react`, `unreact`, `attachments`, `embeds` | | `Member` | `kick`, `ban`, `timeout`, `roles.add`/`remove`, `permissions(channel)`, `fingerprint` | | `Role`, `Attachment`, `Embed`, `EmbedBuilder`, `Permissions`, `Collection` | as named | | `VoiceConnection` | `setTrack` (browsers), `sendAudio` and `play` (Node.js, Bun), `mute`, `deafen`, `disconnect` | | Bots | `community.commands`, `bots`, `installBot` (owners); `channel.invokeCommand`, `message.click`, `channel.submitModal`; as an external bot `community.setCommands` and the `Interaction` object | | Direct messages | `member.dm()`, `member.send(..)`, `community.dms`, `channel.isDM`, `channel.closeDm()`, `community.setDmsFromBots(..)` | | Presence | `client.setPresence(status, activity?)`, `community.setStatusText(..)`, `member.presence`, `member.statusText`, `community.presences`, the `presenceUpdate` event | | Typing | `channel.startTyping()`, `channel.typing`, `channel.typingMode`, `channel.setTypingMode(..)` | Ids are base64url strings; data objects use the protocol's snake_case names. See the guide's [Building a client](/docs/guide/client/installation/) pages for usage. > **Note** > > If **zaun-client (JavaScript)** is missing from the sidebar, this build ran without the fetched sources (a local > preview). Run `npm run gen:fetch` and build again. --- url: https://zaunchat.github.io/docs/resources/faq/ --- # FAQ > Short answers to common questions about Zaun hosts, privacy, clients and bots. ### Do I need an account? No. A member is a key their app makes when joining; there's no sign-up, email or phone number. ### Can the host read my messages? Channel messages, yes: the host stores and distributes them. Connections between each member and the host are end-to-end encrypted, and relays see only ciphertext. Voice is end-to-end encrypted between participants, so the host never hears it. See [SimpleX transport and trust](/docs/guide/concepts/transport-and-trust/). ### Does the host learn my IP address? No. SimpleX hides members' addresses from the host. In voice, media goes through the host's TURN relay by default so participants don't learn each other's addresses either. ### What happens if the host disappears? The owner can delegate the community to a new host and import a backup made with `zaun-host export`. Members' apps follow to the new host. ### Can I run a host on a Raspberry Pi? Yes: the Docker image and the binary are built for arm64, and a host runs in about 512 MB of memory. ### Is anything published to crates.io or npm? Not yet. Use the Git repositories; see [Installing zaun-client](/docs/guide/client/installation/). `zbot` binaries are attached to [zaun-bot releases](https://github.com/zaunchat/zaun-bot/releases). ### Can a member add a bot to a community? No. Only whoever controls the host (the operator, or the community's owner) installs bots, and every member can see each bot's card. ### Can a bot read every message? Only if granted `message_content`, which every member can see on the bot's card. Otherwise it gets only messages that mention it, replies to it, and interactions. ### Can a bot reach the internet? Only to hosts it was explicitly granted, within the operator's allow-list, over HTTPS, never to private addresses. By default, no. ### Which languages can I write a hosted bot in? TypeScript, with `@zaun/bot`, or Rust, with the `zaun-bot` crate. Both build the same kind of package and can do the same things; see [TypeScript or Rust?](/docs/guide/bots/typescript-or-rust/). Go and Python are planned as experimental ([Coming soon](/docs/resources/coming-soon/)). ### Is Zaun audited? No. It is alpha software and has not had a security review. --- url: https://zaunchat.github.io/docs/resources/glossary/ --- # Glossary > The words these docs use, in one place. | Term | Meaning | |---|---| | **Application command** | A command a bot registers: slash (`/name`), user (on a member) or message (on a message). | | **Attachment** | A file on a message, sent as an encrypted SimpleX file and kept by the host. | | **Bot card** | The public description of an installed bot: publisher, version, permissions, capabilities. | | **Capability** | Something a bot may do beyond permission bits: read message content, storage, timers, network. | | **Community** | A group with channels, roles and members, identified by its owner's root key. | | **Component** | A button, select, layout block or modal input in a bot's message or form. | | **Delegation** | The owner's signed statement that a host serves the community. | | **Descriptor** | The owner's signed community profile: name, description, icon, rules. | | **Direct message (DM)** | A private channel between one bot and one member, relayed by the host; only those two can see it. | | **Ephemeral reply** | A bot's reply only the invoker sees, never stored. | | **Event context** | What a bot's event handler acts with: send, reply, react, delete, DM. | | **External bot** | A bot that runs outside the host and joins with `zaun-client`. | | **Grant** | What a bot is allowed: permission bits (through its managed role) and capabilities. | | **Host** | A running `zaun-host`, which serves one or more communities. | | **Hosted bot** | A bot that runs as WebAssembly inside the host. | | **Interaction** | A member using a bot's command, clicking its component, or submitting its modal. | | **Managed role** | The role created for a bot, holding exactly its granted bits. | | **Manifest** | `zaun-bot.toml`: what a bot is and asks for. | | **Member key** | A member's composite ML-DSA-65 + Ed25519 key; their identity in a community. | | **Operator** | Whoever runs a host's machine and its configuration. | | **Owner** | The holder of a community's root key. | | **Root key** | The key a community is derived from; back it up, it can't be replaced. | | **SFrame** | The media encryption voice uses on top of WebRTC (RFC 9605). | | **SimpleX** | The private messaging network Zaun runs over, with no user identifiers. | | **SMP / XFTP** | SimpleX's message and file relay protocols. | | **Typing mode** | A channel's setting for typing indicators: `named`, `anonymous` (a count, never who) or `off`. | | **WIT** | The interface language WebAssembly components are described in; the `zaun:bot` world. | | **X-Wing** | The post-quantum hybrid key encapsulation used to share voice keys. | | **`.zbot`** | A signed bot package: manifest plus WebAssembly component. | | **`zbot`** | The command-line tool that builds, packs and inspects bots. | | **`@zaun/bot`** | The TypeScript SDK for hosted bots. | | **`zaun-bot` (crate)** | The Rust SDK for hosted bots. | --- url: https://zaunchat.github.io/docs/resources/coming-soon/ --- # Coming soon > Features in progress or planned; not available on main yet. These are in progress on branches or planned. They are **not** on the `main` branches these docs describe, and details may change. ## Bots - **Package signing in `zbot`**: `zbot keygen` and `zbot sign` with post-quantum publisher keys. - **More SDK languages**: Go and Python, experimental. - **Voice volume and more audio formats** (MP3, FLAC): both need an Opus encoder in the host. - **Host-side niceties**: `zaun-host bot logs`, automatic update checks, installing from a URL. ## Communities - **End-to-end encrypted channels** between members, with a post-quantum group protocol. - **Packages on crates.io and npm** (`zaun-bot`, `@zaun/bot`, `zaun-client`). --- url: https://zaunchat.github.io/docs/resources/for-ai-agents/ --- # Using these docs with AI > Machine-readable versions of these docs for AI assistants, coding agents and tools. These docs are built to be read by people and by AI tools alike. | What | Where | |---|---| | An index of every page, as Markdown links ([llmstxt.org](https://llmstxt.org) format) | [`/llms.txt`](/docs/llms.txt) | | Every page in one plain-text file | [`/llms-full.txt`](/docs/llms-full.txt) | | Any page as Markdown | add `.md` to its path, e.g. [`/guide/bots/quickstart.md`](/docs/guide/bots/quickstart.md), or use "View as Markdown" under each title | | A JSON list of pages (title, section, description, URLs) | [`/api/index.json`](/docs/api/index.json) | | The Rust API as Markdown, one page per item | under [`/reference/rust/`](/docs/reference/rust/) | | The full rustdoc HTML | under `/api/rust//` | | A sitemap | `/sitemap-index.xml` | ## Tips for agents - Start from `llms.txt`, then fetch only the pages you need as `.md`; `llms-full.txt` is large. - The guide explains *how*; the reference lists *everything*. For exact signatures, prefer the reference pages. - Code samples come in Rust and JavaScript; both appear in the Markdown, each under its own label. - These docs describe the `main` branches of `zaun-community`, `zaun-client` and `zaun-bot`. Features in progress are listed in [Coming soon](/docs/resources/coming-soon/) only. - `zaun-client` and `zaun-bot` each have an `AGENTS.md` with build, test and contribution rules for coding agents. --- url: https://zaunchat.github.io/docs/ --- # Zaun documentation > Run a private community host, build apps with zaun-client, and write bots that run inside your own host. ## Pick where to start ### Run a host A community lives on `zaun-host`, a single program you run on a PC, a VPS or a Raspberry Pi. Install it with Docker or one binary, and you own the community's data, rules and history. ### Build a client With `zaun-client`, apps and bots join communities, post, moderate and talk in voice. The same object-oriented API runs in Rust, browsers, Node.js and Bun. ### Write a bot A Zaun bot is a small WebAssembly package, written in **TypeScript or Rust**, that runs **inside your own host**, sandboxed, with slash commands, buttons, selects and modals. ### Read the reference Generated API reference for the TypeScript bot SDK, the JavaScript client, the Rust crates and the bot interface, plus the `zaun-host` command line and configuration. ## Bots you own On most platforms, a bot is somebody else's server that your community's messages are sent to. In Zaun, a bot is a package the person running the host installs, and it runs inside that host: - **No new reader.** The bot sees only what the host could already see, and only what it was granted. - **No extra network hops.** It talks to the community in-process, not over SimpleX. - **Sandboxed.** No files, no environment, no sockets; memory and CPU are capped. "No internet" is the default. - **Transparent.** Every member sees a BOT badge and can read the bot's card: exactly what it may do. - [Why bots run in the host](/docs/guide/bots/why-bots-in-the-host/): The idea, and what it gives you. - [Bot quick start](/docs/guide/bots/quickstart/): A /ping bot in five minutes, in TypeScript or Rust. ## For AI assistants and agents Every page is also plain Markdown: add `.md` to its path, or read [`/llms.txt`](/docs/llms.txt) for an index and [`/llms-full.txt`](/docs/llms-full.txt) for everything in one file. See [Using these docs with AI](/docs/resources/for-ai-agents/).