What It Does
The Add Discord skill:- Installs Discord channel code and dependencies
- Guides through Discord bot creation
- Configures bot token authentication
- Enables Message Content Intent for reading messages
- Registers Discord text channels
- Verifies connection and provides testing instructions
Prerequisites
- NanoClaw base installation complete
- Discord account
- Admin access to a Discord server (to invite bots)
How to Apply
Create Discord bot
If you don’t have a bot token:
- Go to Discord Developer Portal
- Click New Application and name it (e.g., “Andy Assistant”)
- Go to Bot tab → Click Reset Token → copy it immediately
- Under Privileged Gateway Intents, enable:
- Message Content Intent (required to read messages)
- Server Members Intent (optional, for member names)
- Go to OAuth2 > URL Generator:
- Scopes:
bot - Permissions:
Send Messages,Read Message History,View Channels
- Scopes:
- Copy the URL and open it to invite the bot to your server
Apply code changes
The skill runs
npx tsx scripts/apply-skill.ts .claude/skills/add-discord which:- Adds
src/channels/discord.ts - Adds unit tests with discord.js mock
- Installs
discord.jsdependency - Updates channel registry
Get channel ID
- In Discord: User Settings > Advanced > Enable Developer Mode
- Right-click the text channel → Copy Channel ID
- Format for NanoClaw:
dc:1234567890123456
What Changes
Files Created
src/channels/discord.ts- Discord channel implementationsrc/channels/discord.test.ts- Unit tests with discord.js mockgroups/discord_main/- Main channel workspace (if registered as main)
Files Modified
package.json- Addsdiscord.jsdependencysrc/channels/index.ts- Imports Discord channel.env- AddsDISCORD_BOT_TOKENdata/env/env- Synced environment for container.nanoclaw/state.yaml- Records skill applicationstore/messages.db- Adds registered channel entries
Dependencies Added
discord.js- Discord API library
Usage
Features Supported
- Text messages in registered channels
- Attachment descriptions (images, videos, files shown as placeholders)
- Reply context (shows who the user is replying to)
- @mention translation (Discord
<@botId>→ NanoClaw trigger format) - Message splitting for responses over 2000 characters
- Typing indicators while agent processes
Main Channel (No Trigger Required)
Additional Channels (Trigger Required)
In non-main channels, @mention the bot:Discord requires Message Content Intent to be enabled in the Developer Portal. Without it, the bot connects but can’t read message text.
Troubleshooting
Bot Not Responding
- Check
DISCORD_BOT_TOKENin.envANDdata/env/env - Check channel registered:
sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE 'dc:%'" - For non-main channels: must @mention the bot
- Service is running:
launchctl list | grep nanoclaw - Verify bot invited to server (check OAuth2 URL was used)
Bot Only Responds to @Mentions
This is the default for non-main channels (requiresTrigger: true). To change:
- Update registered group’s
requiresTriggertofalse - Or register the channel as the main channel
Message Content Intent Not Enabled
If the bot connects but can’t read messages:- Go to Discord Developer Portal
- Select your application → Bot tab
- Under Privileged Gateway Intents, enable Message Content Intent
- Restart NanoClaw
Getting Channel ID
If you can’t copy the channel ID:- Ensure Developer Mode enabled: User Settings > Advanced > Developer Mode
- Right-click channel name in server sidebar → Copy Channel ID