Skip to content

JavaScript client API (zaun-client)

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.

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 pages for usage.