# 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.
