Skip to content

TypeScript bot API (@zaun/bot)

@zaun/bot is the TypeScript SDK for hosted bots. Its source (sdk/js/src in 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.

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 pages for usage, and TypeScript or Rust? for the rules specific to TypeScript.