Add Discord as a messaging channel for NanoClaw. Perfect for team collaboration and community management.Documentation Index
Fetch the complete documentation index at: https://docs.nanoclaw.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Discord integration uses discord.js to connect to Discord’s Gateway API. It supports text channels, DMs, threads, and rich message features.Features
- Text channels and DMs - Respond in server channels or direct messages
- Attachment handling - Detects and describes attachments in messages
- Reply context - Shows when users reply to previous messages
- @Mention translation - Converts Discord mentions to trigger format
- Message splitting - Automatically splits long responses (2000 char limit)
- Typing indicators - Shows when the assistant is working
Adding Discord
Use the/add-discord skill to add Discord support:
Choose deployment mode
- Replace existing channels - Discord becomes the only channel
- Alongside - Add Discord alongside existing channels
Apply code changes
The skill merges the
skill/discord branch which adds:src/channels/discord.ts(DiscordChannel implementation)src/channels/discord.test.ts(unit tests)- Multi-channel support in
src/index.ts - Discord config in
src/config.ts - The
discord.jsNPM package
Creating a Discord bot
If you don’t already have a Discord bot:Create application
- Go to the Discord Developer Portal
- Click New Application
- Give it a name (e.g., “Andy Assistant”)
- Click Create App
Create bot user
- Go to the Bot tab in the left sidebar
- Click Reset Token to generate a bot token
- Copy the token immediately (you can only see it once)
Enable intents
Under Privileged Gateway Intents, enable:
- Message Content Intent (required to read message text)
- Server Members Intent (optional, for member display names)
Generate invite URL
- Go to OAuth2 → URL Generator
- Select scopes:
bot
- Select bot permissions:
Send MessagesRead Message HistoryView Channels
- Copy the generated URL
Configuration
Environment variables
Add to.env:
Sync to container
Build and restart
Registering channels
Get channel ID
Register the channel
For your main channel (responds to all messages):Testing the connection
Send a message in your registered Discord channel:- For main channel: Any message works
- For non-main channels: @mention the bot (Discord will autocomplete it)
Check logs
JID format
Discord channels use thedc: prefix:
- Text channel:
dc:1234567890123456 - DM:
dc:1234567890123456 - Thread:
dc:1234567890123456(treated as a regular channel)
Message features
Attachment detection
When a message includes attachments:Reply context
When replying to previous messages:@Mention translation
Discord mentions like<@123456789> are translated to your trigger format:
Message splitting
Discord has a 2000 character limit per message. Long responses are automatically split:Implementation details
The Discord channel implements theChannel interface:
Troubleshooting
Bot not responding
Bot not responding
Check these items:
DISCORD_BOT_TOKENis set in.envAND synced todata/env/env- Channel is registered:
- For non-main channels: message must @mention the bot
- Service is running:
- Bot has been invited to the server (check OAuth2 URL was used)
Bot can't read messages
Bot can't read messages
The Message Content Intent must be enabled:
- Go to Discord Developer Portal
- Select your application → Bot tab
- Under Privileged Gateway Intents, enable Message Content Intent
- Restart NanoClaw
Bot only responds to @mentions
Bot only responds to @mentions
This is the behavior for non-main channels with
requiresTrigger: true.To make it respond to all messages:- Update the registered group’s
requiresTriggertofalse, or - Register the channel as your main channel
Can't copy channel ID
Can't copy channel ID
Ensure Developer Mode is enabled:User Settings → Advanced → Developer Mode → OnThen right-click the channel name → Copy Channel ID
Limitations
- Threads are treated as channels - Thread-aware routing (respond in-thread) requires pipeline-wide changes
- No typing indicator - Discord bots can’t show typing status via the Gateway API
- Basic message splitting - Long messages split at 2000 chars, may break mid-word
- No file upload support - Bot only processes text content
Removing Discord
Since Discord was added via a git merge, you remove it by reverting the merge commit:Find the merge commit
abc1234 Merge remote-tracking branch 'upstream/skill/discord'.Next steps
Add Slack
Add Slack support to your installation
Add Telegram
Add Telegram support to your installation
Skills system
Learn more about how skills work