# Cloak Bot SDK ## Docs - [Client](https://docs.cloak.chat/api-reference/client.md): The Client is your bot. It connects to Cloak, emits events, sends messages, and drives every action. - [Commands](https://docs.cloak.chat/api-reference/commands.md): The slash-command registry, declaration types, caps, and the text and sidecar helpers. - [Crypto](https://docs.cloak.chat/api-reference/crypto.md): The encryption surface the SDK exports, and the small parts of it a bot author ever touches. - [Cards and embeds](https://docs.cloak.chat/api-reference/embeds.md): Types, helpers, errors and caps for the encrypted card lane. - [Errors](https://docs.cloak.chat/api-reference/errors.md): The six error classes the SDK throws, and which one reaches you from where. - [Events](https://docs.cloak.chat/api-reference/events.md): All 32 events a Client emits, when they fire, and what they carry. - [Mention helpers](https://docs.cloak.chat/api-reference/mentions.md): userMention, roleMention, mentionPairs, parseMentions, and the mention types. - [Permissions](https://docs.cloak.chat/api-reference/permissions.md): All 31 permission names you can declare or check, their wire codes, and the runtime helpers. - [Protocol constants](https://docs.cloak.chat/api-reference/protocol.md): Op, MessageType, the exported wire column maps, and the frame model behind client.raw. - [REST client](https://docs.cloak.chat/api-reference/rest.md): client.rest, the RestClient class, and every type and constant on the HTTP lane. - [Types](https://docs.cloak.chat/api-reference/types.md): The objects the SDK hands you: Message, SendOptions, Member, Role, and the rest. - [Voice](https://docs.cloak.chat/api-reference/voice.md): Reference for every voice export in the Cloak Bot SDK: the media session, the player, the resource helpers, the runtime probe, and the encryption constants. - [Webhooks](https://docs.cloak.chat/api-reference/webhooks.md): Types, methods, caps and errors for the plaintext webhook embed lane. - [Changelog and migration](https://docs.cloak.chat/changelog.md): What changed in 0.2.0, what it breaks in a 0.1.x bot, and the checklist for moving across. - [Connection lifecycle](https://docs.cloak.chat/concepts/connection-lifecycle.md): What the connection is, what login() actually does, how a drop is detected and recovered, and how to shut down cleanly. - [What is encrypted, and what is not](https://docs.cloak.chat/concepts/encryption-lanes.md): Cloak encrypts message bodies end to end. A few lanes are deliberately plaintext. Know which is which before you pick one. - [How bots work](https://docs.cloak.chat/concepts/how-bots-work.md): A Cloak bot is a full end-to-end encrypted member of every server it joins. Here is what that means for you. - [Keys and the keystore](https://docs.cloak.chat/concepts/keys-and-keystore.md): Your bot's identity is published once and can never be republished. The keystore is what makes a second run possible. - [Message delivery](https://docs.cloak.chat/concepts/message-delivery.md): Your bot hears from every channel it can view, plus its direct messages, with no per-channel subscription. This is the firehose. - [Permissions](https://docs.cloak.chat/concepts/permissions.md): Your bot declares what it needs. A human approves what it gets. Here is how to work with both sides. - [Card bot](https://docs.cloak.chat/examples/card-bot.md): Post encrypted rich cards under the bot's own identity, and see exactly what a third-party media URL does. - [Command bot](https://docs.cloak.chat/examples/command-bot.md): A slash-command bot: two declarations, one handler API for both invocation lanes, and the filter that stops it answering twice. - [DJ bot (voice audio)](https://docs.cloak.chat/examples/dj-bot.md): A slash-command music bot that joins the voice channel you are sitting in and publishes audio. Based on examples/dj-bot.ts. - [DM echo bot](https://docs.cloak.chat/examples/dm-bot.md): A direct-message bot that opens a DM at startup and echoes every reply. Based on examples/dm-smoke.ts. - [Webhook embed bot](https://docs.cloak.chat/examples/embed-bot.md): Post rich embeds through the webhook lane, which is not end-to-end encrypted. Based on examples/embed-bot.ts. - [Moderation bot](https://docs.cloak.chat/examples/moderation-bot.md): A command-driven bot that exercises reactions, history, purges, timeouts, pins, mentions, and typed denials. - [Voice control-plane bot](https://docs.cloak.chat/examples/voice-bot.md): Join and leave voice channels, read the roster, and toggle self-mute. No audio and no native dependency. Based on examples/voice-bot.ts. - [Welcome bot](https://docs.cloak.chat/examples/welcome-bot.md): A complete bot that greets new members and answers !ping everywhere, including in DMs. Copy it and run it. - [Channels and groups](https://docs.cloak.chat/guides/channels-and-groups.md): Create, rename, move, and delete channels and groups. - [Direct messages](https://docs.cloak.chat/guides/direct-messages.md): Hold a 1:1 encrypted DM with a human: sendDM, inbound isDM messages, and what does not work in a DM. - [Editing, deleting, and pinning](https://docs.cloak.chat/guides/editing-and-pinning.md): Edit, delete, pin, and unpin server messages, and react to those changes. - [The guild() handle](https://docs.cloak.chat/guides/guild-handle.md): Bind a serverId once and call server-scoped methods without repeating it. - [Handling errors](https://docs.cloak.chat/guides/handling-errors.md): Every error class the SDK raises, which surface raises which, and the pattern for catching each one. - [Members and roles](https://docs.cloak.chat/guides/members-and-roles.md): Read a server's roles on demand, and what to do while the member roster read is out of service. - [Mentions and replies](https://docs.cloak.chat/guides/mentions-and-replies.md): Ping people with the two-part mention model, read inbound mentions, and send true replies. - [Message history](https://docs.cloak.chat/guides/message-history.md): Read past messages in a server channel with fetchMessages, using date or message cursors. - [Moderation](https://docs.cloak.chat/guides/moderation.md): Kick, ban, unban, and time out members, and read the ban list. - [Raw frames](https://docs.cloak.chat/guides/raw-frames.md): client.raw reaches opcodes the SDK does not map, and the raw event exposes every inbound frame. - [Reactions](https://docs.cloak.chat/guides/reactions.md): Add and remove reactions on server messages, and listen for reaction changes. - [The REST lane](https://docs.cloak.chat/guides/rest-api.md): client.rest reaches Cloak's HTTP API with a short-lived scoped credential, and it is off by default server-side. - [Rich cards](https://docs.cloak.chat/guides/rich-cards.md): Post an encrypted rich card under your bot's own identity with sendCard(). - [Sending messages](https://docs.cloak.chat/guides/sending-messages.md): Send encrypted text with the SendOptions object, and understand why a denied send never rejects. - [Slash commands](https://docs.cloak.chat/guides/slash-commands.md): Declare typed commands, publish them to the / picker, and handle invocations from either lane. - [Typing, presence, and profile](https://docs.cloak.chat/guides/typing-presence-and-profile.md): Show typing dots, set the bot's status, and change its avatar. - [Webhook embeds](https://docs.cloak.chat/guides/webhook-embeds.md): The plaintext embed lane: per-post personas, at the cost of end-to-end encryption. - [Cloak Bot SDK](https://docs.cloak.chat/index.md): Build end-to-end encrypted bots for Cloak with a familiar, discord.js-flavored API. - [Install and requirements](https://docs.cloak.chat/install.md): What the SDK needs from your host, what npm install actually pulls, and the two optional extras. - [Bot Developer Terms](https://docs.cloak.chat/legal/developer-terms.md): Terms that govern use of the Cloak Bot SDK and bot tokens. - [What the server must support](https://docs.cloak.chat/production/backend-requirements.md): Features that fail in ways your bot cannot detect, because the cause is a Cloak server setting. Read this before you debug an embed with no image. - [Deploying a bot](https://docs.cloak.chat/production/deploying.md): A Cloak bot is an ordinary Node process. What to run, what to keep secret, and the one thing that has to survive a restart. - [Keystore backends](https://docs.cloak.chat/production/keystore-backends.md): Where your bot's keys live. The file store, the environment-variable store, and how to write an adapter for a host with no writable disk. - [Known limitations](https://docs.cloak.chat/production/known-limitations.md): The honest list. What is broken, what is deliberately absent, and what will not be built. Check here before you spend an evening debugging. - [When a bot will not start](https://docs.cloak.chat/production/troubleshooting.md): Symptom-indexed triage: the dependency report, the login failures that stop retrying, and how to read a bot that is already running. - [Quickstart](https://docs.cloak.chat/quickstart.md): Create a bot, add it to a server, and watch it reply to a message. About five minutes. - [Publishing audio](https://docs.cloak.chat/voice/audio.md): Turn a voice credential into sound in the channel with VoiceMediaSession, VoicePlayer, and the resource helpers. - [Joining voice](https://docs.cloak.chat/voice/joining.md): The voice control plane: join and leave channels, read the roster, and handle the five voice events. No native dependency required. - [Voice keys and scopes](https://docs.cloak.chat/voice/keys.md): Voice frame keys are delivered to your bot, not derived by it. The scope inside the sealed key decides what your bot can hear. - [Voice overview](https://docs.cloak.chat/voice/overview.md): What a Cloak bot can and cannot do in a voice channel, and how the control plane and the audio layer differ. - [Voice runtime](https://docs.cloak.chat/voice/runtime.md): Installing and patching the media engine, host requirements, and how to diagnose a silent voice bot.