Build a Hexis bot

A bot is an account that a program drives. It sits in servers, answers what members send it, and posts messages. You write the program in Python, Node or Rust; the same runtime underneath handles the encryption, the reconnects and the storage.

What a bot is

Two kinds of bot

A server is end-to-end encrypted only if its owner chose that when creating it (public is the default, and the choice cannot be changed later). In an encrypted server a bot cannot just read the channel. The person installing it picks one of two kinds, and the install sheet says what it means.

ReaderNo-read
What it seesEvery message in the channels its role can see. It is a full encrypted member of the server.Only what members send it directly: slash commands, mentions of it, and button clicks. Messages in channels reach it without their text.
KeysHolds the server’s channel keys. Those keys cover the whole server, so the server’s permission checks, not the keys, decide which channels it receives.Never gets a channel key. Members’ apps do not give it one.
What it can doRead, post, react, moderate (within its role).Post, react, moderate (within its role), and answer the things sent to it.
Counts toward the encrypted-member capYesNo
Pick it whenThe bot has to read the chat: moderation, search, summaries.The bot only answers commands. This is the safe default.

The member-side parts of commands, mentions and buttons are not shipped yet arriving (#1436 to #1438). The sealed channel they use is shipped, and the command-line client’s /bot interact drives it today.

On a server that is not end-to-end encrypted there are no keys to hold back. The bot sees what its role can see, and the privileged message_content intent covers message text arriving.

The no-read choice is permanent for that bot account in that server. To read there, create a new app (a new bot account) and install it as a reader. See Concepts for how this is enforced.

Private and public bots

One bot per process

A process runs one bot, and one process uses one state directory. A second bot in the same process is refused, and two processes sharing a directory corrupt each other. To run several bots, run several processes with a directory each.

The token

Other credentials keep their old meaning: hxo_ OAuth tokens act on a person’s grant and cannot join servers, and hxk_ API keys are for your own account. Only hxb_ opens a bot socket.

Where to go next

Things that are not shipped yet are marked arriving. Treat those as plans, not promises.