Skip to main content
The Discord adapter connects out to the Discord Gateway over a WebSocket, so like Telegram it needs no public URL and opens no port. The bot reads every message in the channels and DMs it can see, so a required sender allow-list — on top of Discord’s own channel permissions — decides who it answers.

Set it up

1

Create the application and bot

In the Discord Developer Portal, create an application, add a Bot and copy its token.
2

Turn on the Message Content intent

Under Bot → Privileged Gateway Intents, enable Message Content Intent. The gateway requests it to read what people write; without it Discord refuses the connection.
3

Invite the bot

Use the OAuth2 URL generator with the bot scope and the permissions to read messages, send messages and attach files, then open the URL and add the bot to your server. Direct messages to the bot work as well.
4

Configure ChatCLI and start

Environment variables

Who can reach the bot

The bot answers messages from senders in CHATCLI_DISCORD_ALLOWED_USERS, in every server channel and DM it can read; it does not wait for a mention, and the adapter refuses to start without the list. Each message runs the agent with its tools and shell, so list only the people who should use it; set it to * only when the bot is meant to be public.
New in the security release: Discord now needs a sender allow-list like every other channel. IDs are the author’s snowflake. A sender who is not on the list gets no reply, and their voice notes and images are not downloaded. The public * value is an explicit opt-in that logs a warning at every start. See the security hardening upgrade.
Messages written by bots, including this one, are ignored.

Messages

  • Text: the message content. A server channel is one conversation shared by everyone in it; a DM is its own.
  • Voice: the first audio attachment is downloaded and transcribed before the agent runs.
  • Images: the first image attachment reaches the model.
  • Image replies are uploaded as a file on the reply; on failure the text is sent alone.
  • Long replies go out as several messages in order, split at line breaks or spaces, because Discord accepts at most 2000 characters per message.
  • Replies are posted in the channel, not as a reply to the original message.

Limits

  • A reply is cut at 3500 characters before it is split, so it arrives as at most two messages.
  • After a disconnect the bot reconnects with a new session; messages sent during the gap are not delivered to it.

Troubleshooting

Enable the Message Content Intent in the Developer Portal. Without it the gateway cannot read message text and the connection is refused; ~/.chatcli/gateway.log shows the error.
Remove its permission to read those channels in the server settings, or narrow CHATCLI_DISCORD_ALLOWED_USERS to the senders who should reach it.

See also

Chat gateway

How messages run, voice, images, continuity and the other channels.

Security

Harden what the agent may do when it runs unattended.