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
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
- 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
The bot is online but never answers
The bot is online but never answers
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.The bot answers in channels it should not
The bot answers in channels it should not
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.