3.4 KiB
Multi-Machine Discord Channel Setup
Context
You have one Discord bot and multiple machines, each running Claude Code with the Discord plugin. You want messages sent to different Discord text channels to route to different machines — e.g., #desktop reaches your desktop, #laptop reaches your laptop.
This works because the Discord plugin's gate() function checks guild channel opt-in per access.json. Each machine connects with the same bot token, and Discord delivers all messages to all instances — but each instance only acts on messages from its opted-in channel(s), silently dropping the rest.
Prerequisites
- A Discord server where the bot is installed
- One text channel per machine (e.g.,
#desktop,#laptop,#server) - Channel IDs for each (Developer Mode → right-click channel → Copy Channel ID)
Steps
1. Create Discord channels
In your Discord server, create one text channel per machine. Name them however you like (machine name, location, etc.).
2. Copy bot token to each machine
On each machine:
mkdir -p ~/.claude/channels/discord
Write ~/.claude/channels/discord/.env:
DISCORD_BOT_TOKEN=MTQ4ODQ2... (same token on all machines)
chmod 600 ~/.claude/channels/discord/.env
The token is already saved on this machine. For others, copy the token value over (e.g., via NFS, ssh, or manually).
3. Configure each machine's access.json
On each machine, set up ~/.claude/channels/discord/access.json with only that machine's channel opted in.
Example for machine "desktop" (channel ID 111111111111111111):
{
"dmPolicy": "allowlist",
"allowFrom": ["YOUR_USER_SNOWFLAKE"],
"groups": {
"111111111111111111": {
"requireMention": false,
"allowFrom": []
}
}
}
Example for machine "laptop" (channel ID 222222222222222222):
{
"dmPolicy": "disabled",
"allowFrom": ["YOUR_USER_SNOWFLAKE"],
"groups": {
"222222222222222222": {
"requireMention": false,
"allowFrom": []
}
}
}
Key decisions:
- DMs: Enable on one machine only (
"dmPolicy": "allowlist") and disable on the rest ("dmPolicy": "disabled"), so DMs don't trigger all machines requireMention: Set tofalseif you want every message in the channel to reach Claude without @mentioning;trueif you prefer explicit mentionsallowFromin groups: Leave empty to allow any server member, or restrict to your snowflake
4. Start Claude Code with the Discord channel on each machine
claude --channels plugin:discord@claude-plugins-official
All machines connect simultaneously. Each only processes messages from its own channel.
DM handling
Since all instances receive DMs, only one machine should have DMs enabled. Set "dmPolicy": "disabled" on all others. Pick whichever machine you consider your primary for DM-based conversations.
Shared access.json via NFS (optional)
If you want allowlists to stay in sync without manual copying, you could put the .env on NFS and use per-machine access.json files. However, since each machine needs different groups, the access.json must be per-machine. The .env (same token) can be shared.
Verification
- Start Claude with
--channels plugin:discord@claude-plugins-officialon two machines - Send a message in machine A's channel → only machine A receives it
- Send a message in machine B's channel → only machine B receives it
- Send a DM → only the machine with DMs enabled receives it