Skip to main content
The Add Discord skill installs Discord support in NanoClaw. It handles code installation, bot creation in the Discord Developer Portal, authentication, and channel registration.

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

1

Invoke the skill

Run /add-discord in your NanoClaw context.
2

Create Discord bot

If you don’t have a bot token:
  1. Go to Discord Developer Portal
  2. Click New Application and name it (e.g., “Andy Assistant”)
  3. Go to Bot tab → Click Reset Token → copy it immediately
  4. Under Privileged Gateway Intents, enable:
    • Message Content Intent (required to read messages)
    • Server Members Intent (optional, for member names)
  5. Go to OAuth2 > URL Generator:
    • Scopes: bot
    • Permissions: Send Messages, Read Message History, View Channels
  6. Copy the URL and open it to invite the bot to your server
3

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.js dependency
  • Updates channel registry
4

Configure environment

The skill adds DISCORD_BOT_TOKEN to .env and syncs to container.
5

Get channel ID

  1. In Discord: User Settings > Advanced > Enable Developer Mode
  2. Right-click the text channel → Copy Channel ID
  3. Format for NanoClaw: dc:1234567890123456
6

Register channel

The skill registers the channel with:
  • Channel ID (format: dc:1234567890123456)
  • Server and channel name
  • Trigger requirement (main vs. trigger-only)

What Changes

Files Created

  • src/channels/discord.ts - Discord channel implementation
  • src/channels/discord.test.ts - Unit tests with discord.js mock
  • groups/discord_main/ - Main channel workspace (if registered as main)

Files Modified

  • package.json - Adds discord.js dependency
  • src/channels/index.ts - Imports Discord channel
  • .env - Adds DISCORD_BOT_TOKEN
  • data/env/env - Synced environment for container
  • .nanoclaw/state.yaml - Records skill application
  • store/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)

You: What's the weather?
Andy: [responds immediately]

Additional Channels (Trigger Required)

In non-main channels, @mention the bot:
You: @Andy what's the weather?
Andy: [responds]

You: regular message
Andy: [no response]
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

  1. Check DISCORD_BOT_TOKEN in .env AND data/env/env
  2. Check channel registered: sqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE 'dc:%'"
  3. For non-main channels: must @mention the bot
  4. Service is running: launchctl list | grep nanoclaw
  5. 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 requiresTrigger to false
  • Or register the channel as the main channel

Message Content Intent Not Enabled

If the bot connects but can’t read messages:
  1. Go to Discord Developer Portal
  2. Select your application → Bot tab
  3. Under Privileged Gateway Intents, enable Message Content Intent
  4. 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

Build docs developers (and LLMs) love