Skip to content

Claude Code Channels × Discord

Complete Setup Guide from Scratch

Claude Code Channels × Discord

從零開始設定完全指南


Imagine lying on the couch, picking up your phone, typing a message in Discord, and having Claude Code on your workstation start editing files, running tests, and committing code — all without touching your keyboard. That's exactly what Claude Code Channels makes possible.

想像一下,你躺在沙發上,拿起手機,在 Discord 裡打一段訊息,你工作站上的 Claude Code 就開始編輯檔案、跑測試、提交程式碼——完全不需要碰鍵盤。這就是 Claude Code Channels 能做到的事。


What Are Claude Code Channels?

Claude Code Channels is an official feature released in March 2026 that lets you control Claude Code sessions from messaging platforms like Discord and Telegram. At its core, it works as an MCP (Model Context Protocol) server that bridges your messaging platform with your running Claude Code session.

How the architecture works:

  1. A plugin runs as an MCP server alongside your Claude Code session
  2. The plugin connects to Discord via a bot you create
  3. When someone sends a message to the bot on Discord, the plugin pushes that message into your Claude Code session
  4. Claude processes the message and sends a response back through the bot

This is a bidirectional, push-based integration. Claude doesn't poll Discord — messages arrive in real-time as events. This is fundamentally different from Discord MCP servers (which we'll cover later) that use a pull model where Claude queries Discord on demand.

Key characteristics:

  • Real-time: Messages push instantly into your session
  • Local execution: All code runs on your machine — Claude Code doesn't move to the cloud
  • Session-dependent: The bot is only online while Claude Code is running
  • Secure: Two-layer access control with sender allowlists and session gating

什麼是 Claude Code Channels?

Claude Code Channels 是 2026 年 3 月推出的官方功能,讓你可以從 Discord、Telegram 等通訊平台控制 Claude Code 的工作階段。它的核心是一個 MCP(Model Context Protocol)伺服器,負責在通訊平台與你正在運行的 Claude Code 之間建立橋樑。

架構運作方式:

  1. 一個 plugin 以 MCP server 的形式與你的 Claude Code session 一起運行
  2. 這個 plugin 透過你建立的 bot 連接到 Discord
  3. 當有人在 Discord 上對 bot 發送訊息時,plugin 會將該訊息推送到你的 Claude Code session 中
  4. Claude 處理訊息後,透過 bot 將回應傳回 Discord

這是一個雙向的、推送式整合。Claude 不會輪詢 Discord——訊息以事件的形式即時抵達。這與 Discord MCP server(後面會介紹)有本質上的不同,後者使用的是拉取模型,由 Claude 按需查詢 Discord。

核心特性:

  • 即時性:訊息即時推送到你的 session
  • 本地執行:所有程式碼都在你的機器上執行——Claude Code 不會搬到雲端
  • 依賴 session:Bot 只在 Claude Code 運行時才上線
  • 安全性:兩層存取控制,包含發送者允許清單和 session 閘門

Prerequisites Checklist

Before you begin, make sure you have everything in place. Missing even one item can cause silent failures that are extremely difficult to debug.

RequirementDetailsHow to Check
Claude Code v2.1.80+Channels feature requires this version or laterclaude --version
Bun runtimeNOT Node.js — the plugin silently fails on Node.jsbun --version (need v1.0+)
Claude.ai subscriptionPro or Max plan with claude.ai loginCheck your account at claude.ai
Discord accountWith permission to create applicationsdiscord.com/developers
Discord serverA server where you have admin/manage permissionsYou need to be able to add bots

Critical warning about Bun:

The Discord plugin requires the Bun JavaScript runtime. If you have Node.js but not Bun, the plugin will install successfully but fail silently at runtime with zero error messages. This is the single most common setup failure.

Install Bun if you don't have it:

bash
# macOS / Linux
curl -fsSL https://bun.sh/install | bash

# Verify installation
bun --version

For Team/Enterprise users:

Your organization admin must explicitly enable Channels in managed settings before you can use this feature. If the plugin install command doesn't work, check with your admin first.

前置條件清單

開始之前,請確認你已經備齊所有條件。即使缺少一項,都可能導致難以除錯的靜默失敗。

需求詳細資訊檢查方式
Claude Code v2.1.80+Channels 功能需要此版本或更新版本claude --version
Bun 執行環境不是 Node.js——plugin 在 Node.js 上會靜默失敗bun --version(需要 v1.0+)
Claude.ai 訂閱Pro 或 Max 方案,並已登入 claude.ai在 claude.ai 檢查你的帳號
Discord 帳號具有建立應用程式的權限discord.com/developers
Discord 伺服器你擁有管理員或管理權限的伺服器你需要能夠新增 bot

關於 Bun 的重要警告:

Discord plugin 需要 Bun JavaScript 執行環境。如果你有 Node.js 但沒有 Bun,plugin 會成功安裝,但在執行時靜默失敗,不會顯示任何錯誤訊息。這是最常見的設定失敗原因。

如果你還沒有安裝 Bun:

bash
# macOS / Linux
curl -fsSL https://bun.sh/install | bash

# 驗證安裝
bun --version

Team / Enterprise 用戶注意:

你的組織管理員必須在受管設定中明確啟用 Channels,你才能使用此功能。如果 plugin install 指令無法運作,請先聯繫你的管理員。


Pre-flight: Test with Fakechat First

Before diving into Discord configuration, I strongly recommend testing with Fakechat — a local testing plugin that simulates the Channels experience in your browser. This lets you verify that Channels works on your system before adding Discord complexity.

Step 1: Install the Fakechat plugin

bash
/plugin install fakechat@claude-plugins-official

Step 2: Launch Claude Code with the Fakechat channel

bash
claude --channels plugin:fakechat@claude-plugins-official

Step 3: Open the test interface

Navigate to http://localhost:8787 in your browser. You should see a simple chat interface.

Step 4: Send a test message

Type something in the Fakechat interface. You should see the message appear in your Claude Code terminal, and Claude's response should appear back in the browser.

What to verify:

  • Messages flow from browser → Claude Code (push direction)
  • Responses flow from Claude Code → browser (reply direction)
  • No errors appear in the Claude Code terminal
  • The Bun runtime is working correctly

If Fakechat works, your system is properly configured for Channels and you can proceed to Discord setup with confidence. If it doesn't work, troubleshoot your Bun installation and Claude Code version before continuing.

預檢:先用 Fakechat 測試

在深入 Discord 設定之前,我強烈建議先用 Fakechat 測試——這是一個本地測試 plugin,可以在瀏覽器中模擬 Channels 體驗。這讓你能在加入 Discord 複雜性之前,先驗證 Channels 在你的系統上是否正常運作。

步驟 1:安裝 Fakechat plugin

bash
/plugin install fakechat@claude-plugins-official

步驟 2:以 Fakechat channel 啟動 Claude Code

bash
claude --channels plugin:fakechat@claude-plugins-official

步驟 3:開啟測試介面

在瀏覽器中開啟 http://localhost:8787,你應該會看到一個簡單的聊天介面。

步驟 4:發送測試訊息

在 Fakechat 介面中輸入訊息。你應該會看到訊息出現在 Claude Code 終端機中,而 Claude 的回應也會出現在瀏覽器中。

需要驗證的事項:

  • 訊息能從瀏覽器流向 Claude Code(推送方向)
  • 回應能從 Claude Code 流回瀏覽器(回覆方向)
  • Claude Code 終端機中沒有錯誤出現
  • Bun 執行環境正常運作

如果 Fakechat 正常運作,你的系統就已正確配置好 Channels,可以放心進入 Discord 設定。如果無法運作,請先排除 Bun 安裝和 Claude Code 版本的問題再繼續。


Discord Bot Creation (Steps 1–4)

Now let's create the Discord bot that will serve as your remote interface to Claude Code.

Step 1: Create a Discord Application

  1. Go to the Discord Developer Portal: https://discord.com/developers/applications
  2. Click "New Application" in the top right
  3. Give your application a name (e.g., "Claude Code Bot" or "My Claude Remote")
  4. Accept the Terms of Service
  5. Click "Create"

You'll land on the General Information page. You can optionally add a description and profile picture, but these aren't required.

Step 2: Enable Message Content Intent

This is the most critical step and the #1 cause of setup failures. Without this, your bot will connect to Discord but receive zero message content.

  1. In the left sidebar, click "Bot"
  2. Scroll down to "Privileged Gateway Intents"
  3. Find "Message Content Intent"
  4. Toggle it ON
  5. Click "Save Changes"

Why this matters: Discord requires bots to explicitly opt into reading message content as a privacy measure. Without this intent enabled, your bot receives message events but the message body is empty — and the plugin doesn't warn you about this.

Step 3: Generate and Copy the Bot Token

Still on the Bot page:

  1. Scroll up to the "Token" section
  2. Click "Reset Token" (or "Copy" if this is the first time)
  3. Copy the token immediately — it is only shown once
  4. Store it somewhere safe temporarily (you'll need it in Step 6)

Security note: This token grants full control of your bot. Never commit it to version control, share it publicly, or paste it in Discord messages.

Step 4: Configure Permissions and Add Bot to Server

  1. In the left sidebar, click "OAuth2"
  2. Click "URL Generator"
  3. Under Scopes, check bot
  4. Under Bot Permissions, check the following:
PermissionWhy It's Needed
View ChannelsBot needs to see channels it's added to
Send MessagesBot needs to send Claude's responses
Send Messages in ThreadsSupport for threaded conversations
Read Message HistoryFetching recent messages for context
Attach FilesSending code files and outputs
Add ReactionsEmoji reaction tool support
  1. Copy the Generated URL at the bottom
  2. Open the URL in your browser
  3. Select the Discord server you want to add the bot to
  4. Click "Authorize"
  5. Complete the CAPTCHA if prompted

You should see a confirmation that the bot was added. Check your Discord server — the bot should appear in the member list (offline for now).

Discord Bot 建立(步驟 1–4)

現在讓我們建立 Discord bot,它將作為你遠端操控 Claude Code 的介面。

步驟 1:建立 Discord Application

  1. 前往 Discord Developer Portalhttps://discord.com/developers/applications
  2. 點擊右上角的 「New Application」
  3. 為你的應用程式命名(例如 "Claude Code Bot" 或 "My Claude Remote")
  4. 接受服務條款
  5. 點擊 「Create」

你會進入 General Information 頁面。你可以選擇性地新增描述和頭像,但這不是必要的。

步驟 2:啟用 Message Content Intent

這是最關鍵的步驟,也是設定失敗的第一大原因。沒有啟用的話,你的 bot 會連接到 Discord,但收到的訊息內容是空的

  1. 在左側選單中,點擊 「Bot」
  2. 向下捲動到 「Privileged Gateway Intents」
  3. 找到 「Message Content Intent」
  4. 將它切換為開啟
  5. 點擊 「Save Changes」

為什麼這很重要:Discord 作為隱私措施,要求 bot 明確申請讀取訊息內容的權限。如果沒有啟用這個 intent,你的 bot 會收到訊息事件,但訊息本文是空的——而且 plugin 不會對此發出警告。

步驟 3:產生並複製 Bot Token

仍然在 Bot 頁面:

  1. 向上捲動到 「Token」 區域
  2. 點擊 「Reset Token」(如果是第一次則點擊 "Copy")
  3. 立即複製 token——它只會顯示一次
  4. 暫時將它儲存在安全的地方(你在步驟 6 會需要它)

安全提醒:這個 token 授予對你 bot 的完全控制權。絕對不要將它提交到版本控制、公開分享,或貼在 Discord 訊息中。

步驟 4:設定權限並將 Bot 加入伺服器

  1. 在左側選單中,點擊 「OAuth2」
  2. 點擊 「URL Generator」
  3. Scopes 下,勾選 bot
  4. Bot Permissions 下,勾選以下權限:
權限需要的原因
View ChannelsBot 需要看到它被加入的頻道
Send MessagesBot 需要發送 Claude 的回應
Send Messages in Threads支援討論串對話
Read Message History抓取最近的訊息以取得上下文
Attach Files發送程式碼檔案和輸出結果
Add Reactions支援表情符號回應工具
  1. 複製底部的 Generated URL
  2. 在瀏覽器中開啟該 URL
  3. 選擇你要將 bot 加入的 Discord 伺服器
  4. 點擊 「Authorize」
  5. 如果出現 CAPTCHA 驗證,完成它

你應該會看到 bot 已成功加入的確認訊息。檢查你的 Discord 伺服器——bot 應該出現在成員列表中(目前是離線狀態)。


Plugin Installation & Configuration (Steps 5–6)

With the Discord bot created, it's time to connect it to Claude Code.

Step 5: Install the Discord Plugin

In your Claude Code session, run:

bash
/plugin install discord@claude-plugins-official

This downloads and registers the official Discord Channels plugin. Behind the scenes, it pulls the plugin from the official Claude plugins registry and sets up the necessary MCP server configuration.

If the installation fails:

  • Verify Bun is installed: bun --version
  • Verify Claude Code version: claude --version (need v2.1.80+)
  • For Team/Enterprise: confirm your admin has enabled Channels

Step 6: Configure the Bot Token

Now provide the bot token you saved from Step 3:

bash
/discord:configure <YOUR_BOT_TOKEN>

Replace <YOUR_BOT_TOKEN> with the actual token you copied from the Discord Developer Portal.

This command saves the token to:

~/.claude/channels/discord/.env

You can verify the token was saved:

bash
cat ~/.claude/channels/discord/.env

You should see something like:

DISCORD_BOT_TOKEN=your_token_here

Important: This file contains a secret. Make sure your home directory permissions are properly set and this path is not synced to any cloud storage or backup service that might expose it.

Plugin 安裝與設定(步驟 5–6)

Discord bot 建立完成後,現在要將它連接到 Claude Code。

步驟 5:安裝 Discord Plugin

在你的 Claude Code session 中執行:

bash
/plugin install discord@claude-plugins-official

這會下載並註冊官方的 Discord Channels plugin。背後的機制是從官方 Claude plugins 註冊表中取得 plugin,並設定必要的 MCP server 配置。

如果安裝失敗:

  • 確認 Bun 已安裝:bun --version
  • 確認 Claude Code 版本:claude --version(需要 v2.1.80+)
  • Team / Enterprise 用戶:確認你的管理員已啟用 Channels

步驟 6:設定 Bot Token

現在提供你在步驟 3 儲存的 bot token:

bash
/discord:configure <YOUR_BOT_TOKEN>

<YOUR_BOT_TOKEN> 替換為你從 Discord Developer Portal 複製的實際 token。

這個指令會將 token 儲存到:

~/.claude/channels/discord/.env

你可以驗證 token 是否已儲存:

bash
cat ~/.claude/channels/discord/.env

你應該會看到類似這樣的內容:

DISCORD_BOT_TOKEN=your_token_here

重要:這個檔案包含密鑰。請確保你的家目錄權限設定正確,且這個路徑沒有同步到任何可能暴露它的雲端儲存或備份服務。


Launching & Pairing (Steps 7–9)

Step 7: Restart Claude Code with Channels Enabled

Close your current Claude Code session and relaunch with the Channels flag:

bash
claude --channels plugin:discord@claude-plugins-official

When Claude Code starts, you should see a log message indicating the Discord plugin is connecting. The bot's status in your Discord server should change to online (green dot).

If the bot doesn't come online:

  • Check that the token is correct in ~/.claude/channels/discord/.env
  • Make sure Bun (not Node.js) is your runtime
  • Look for any error messages in the Claude Code terminal

Step 8: Pair Your Discord Account

Now you need to link your Discord user account to the Claude Code session:

  1. Open Discord on your phone, tablet, or another device
  2. Find your bot in the server member list
  3. Send a Direct Message (DM) to the bot — any message will do
  4. The bot will reply with a pairing code (a short alphanumeric string)
  5. Back in your Claude Code terminal, enter:
bash
/discord:access pair <PAIRING_CODE>

Replace <PAIRING_CODE> with the code the bot sent you.

If successful, you'll see a confirmation message. Your Discord user ID is now registered as an authorized sender.

Step 9: Lock Down Access

By default, the plugin may accept messages from anyone who can DM the bot. Lock it down to only accept messages from paired users:

bash
/discord:access policy allowlist

This sets the access policy to allowlist mode, meaning only users who have been explicitly paired (Step 8) can send messages that reach your Claude Code session.

To add additional users later:

Have them DM the bot, get their pairing code, and run the pair command for each user.

To verify your current access configuration:

Check the access control file:

bash
cat ~/.claude/channels/discord/access.json

This shows the current policy and list of authorized user IDs.

啟動與配對(步驟 7–9)

步驟 7:以 Channels 模式重新啟動 Claude Code

關閉你目前的 Claude Code session,並使用 Channels 旗標重新啟動:

bash
claude --channels plugin:discord@claude-plugins-official

當 Claude Code 啟動時,你應該會看到 log 訊息表示 Discord plugin 正在連接。你 Discord 伺服器中 bot 的狀態應該會變為上線(綠色圓點)。

如果 bot 沒有上線:

  • 檢查 ~/.claude/channels/discord/.env 中的 token 是否正確
  • 確認 Bun(不是 Node.js)是你的執行環境
  • 查看 Claude Code 終端機中是否有錯誤訊息

步驟 8:配對你的 Discord 帳號

現在你需要將你的 Discord 使用者帳號連結到 Claude Code session:

  1. 在手機、平板或其他裝置上開啟 Discord
  2. 在伺服器成員列表中找到你的 bot
  3. 向 bot 發送私人訊息(DM)——隨便發什麼都行
  4. Bot 會回覆一個配對碼(一串簡短的英數字字串)
  5. 回到 Claude Code 終端機,輸入:
bash
/discord:access pair <PAIRING_CODE>

<PAIRING_CODE> 替換為 bot 發送給你的配對碼。

成功後,你會看到確認訊息。你的 Discord 使用者 ID 現在已被註冊為授權的發送者。

步驟 9:鎖定存取權限

預設情況下,plugin 可能會接受任何能 DM bot 的人的訊息。將它鎖定為只接受已配對使用者的訊息:

bash
/discord:access policy allowlist

這會將存取策略設為允許清單模式,表示只有被明確配對(步驟 8)的使用者才能發送訊息到你的 Claude Code session。

之後要新增其他使用者:

讓他們 DM bot,取得配對碼,然後為每個使用者執行 pair 指令。

驗證你目前的存取配置:

檢查存取控制檔案:

bash
cat ~/.claude/channels/discord/access.json

這會顯示目前的策略和授權使用者 ID 列表。


Security Configuration Deep Dive

Claude Code Channels implements a two-layer security model. Understanding it is essential, especially if your bot is in a server with other people.

Layer 1: Sender Allowlist

The allowlist controls who can send messages to your Claude Code session. Only Discord user IDs that have been paired are on this list.

bash
# View current allowlist
cat ~/.claude/channels/discord/access.json

# Set policy to allowlist-only (recommended)
/discord:access policy allowlist

# Pair a new user
/discord:access pair <CODE>

Layer 2: Session Gating

Messages are only delivered to Claude Code while a session is actively running. This means:

  • If Claude Code is not running, messages sent to the bot are lost (not queued)
  • When you close your terminal, the bot goes offline — there's no background daemon
  • Each new session starts fresh — no message carryover from previous sessions

Security Best Practices

  1. Always use allowlist mode — never leave the policy open if your bot is in a shared server
  2. Use a private server — create a dedicated Discord server for just you and the bot
  3. Protect your bot token — treat it like a password
  4. Review access.json periodically — remove user IDs you no longer want to have access
  5. Be aware of the session boundary — anyone with access can control your Claude Code while it's running, including running shell commands on your machine

Configuration File Locations

FilePathPurpose
Bot token~/.claude/channels/discord/.envDiscord bot authentication
Access control~/.claude/channels/discord/access.jsonAllowlist and policy settings
Attachments~/.claude/channels/discord/inbox/Downloaded file storage

安全配置深入解析

Claude Code Channels 實作了兩層式安全模型。理解它至關重要,特別是當你的 bot 在有其他人的伺服器中時。

第一層:發送者允許清單

允許清單控制可以向你的 Claude Code session 發送訊息。只有已配對的 Discord 使用者 ID 會在這個清單上。

bash
# 查看目前的允許清單
cat ~/.claude/channels/discord/access.json

# 設定策略為僅允許清單(建議)
/discord:access policy allowlist

# 配對新使用者
/discord:access pair <CODE>

第二層:Session 閘門

訊息只有在 session 活躍運行時才會被遞送到 Claude Code。這意味著:

  • 如果 Claude Code 沒有運行,發送給 bot 的訊息會遺失(不會排隊)
  • 當你關閉終端機時,bot 就離線了——沒有背景 daemon
  • 每個新 session 都是全新開始的——不會從前一個 session 帶過來任何訊息

安全最佳實踐

  1. 永遠使用允許清單模式——如果你的 bot 在共享伺服器中,絕對不要讓策略保持開放
  2. 使用私人伺服器——為你和 bot 建立一個專用的 Discord 伺服器
  3. 保護你的 bot token——把它當密碼一樣對待
  4. 定期檢查 access.json——移除你不再想授權的使用者 ID
  5. 注意 session 邊界——任何有存取權限的人都能在 Claude Code 運行時控制它,包括在你的機器上執行 shell 指令

配置檔案位置

檔案路徑用途
Bot token~/.claude/channels/discord/.envDiscord bot 驗證
存取控制~/.claude/channels/discord/access.json允許清單與策略設定
附件~/.claude/channels/discord/inbox/下載的檔案儲存

Available Tools Deep Dive

Once Channels is set up, Claude Code gains five Discord-specific tools. These are the building blocks for everything you can do remotely.

1. reply — Send Messages

The primary tool for sending responses back to Discord.

Capabilities:

  • Send text messages to any channel the bot has access to
  • Support for threading (reply to specific messages)
  • Attach up to 10 files per message (25MB max each)
  • Supports Discord markdown formatting

Example usage from Claude's perspective:

When you send "Fix the bug in auth.js" from Discord, Claude might:

  1. Read and analyze auth.js
  2. Make the fix
  3. Use reply to send back: "Fixed the null check in auth.js line 42. Here's what I changed: ..."
  4. Attach the diff as a file if needed

Attachment limits:

  • Maximum 10 files per message
  • Maximum 25MB per file
  • Files are sent as Discord attachments (viewable/downloadable in Discord)

2. react — Add Emoji Reactions

Add emoji reactions to messages. Useful for quick acknowledgments without sending a full reply.

Common patterns:

  • React with a checkmark when a task starts
  • React with a green circle when complete
  • React with a warning sign if something needs attention

3. edit_message — Edit Bot Messages

Edit previously sent bot messages. The bot can only edit its own messages, not messages from other users.

Use cases:

  • Update a status message as a long task progresses
  • Correct a response after additional context
  • Append results to an initial acknowledgment message

4. fetch_messages — Pull Channel History

Retrieve recent messages from a channel. Fetches up to 100 messages at a time.

Use cases:

  • Read context from earlier in the conversation
  • Check what commands or requests were sent while you were setting up
  • Review discussion history before taking action

5. download_attachment — Download Files

Download attachments from Discord messages to your local machine.

Storage location:

~/.claude/channels/discord/inbox/

Use cases:

  • Send a file from your phone to Claude Code for processing
  • Share screenshots for Claude to analyze (if using a multimodal model)
  • Upload configuration files or code snippets from another device

Workflow example:

  1. You take a screenshot of an error on your phone
  2. Send it to the bot on Discord
  3. Claude uses download_attachment to save it locally
  4. Claude analyzes the image and provides debugging guidance

可用工具深入解析

一旦 Channels 設定完成,Claude Code 就會獲得五個 Discord 專用工具。這些是你能遠端執行所有操作的基礎構件。

1. reply — 發送訊息

用於將回應傳送回 Discord 的主要工具。

功能:

  • 向 bot 有權存取的任何頻道發送文字訊息
  • 支援討論串(回覆特定訊息)
  • 每則訊息最多附加 10 個檔案(每個最大 25MB)
  • 支援 Discord markdown 格式

從 Claude 的角度來看的使用範例:

當你從 Discord 發送「修復 auth.js 中的 bug」時,Claude 可能會:

  1. 讀取並分析 auth.js
  2. 進行修復
  3. 使用 reply 回傳:「已修復 auth.js 第 42 行的 null check。以下是我修改的內容:……」
  4. 如果需要的話,將 diff 作為檔案附加

附件限制:

  • 每則訊息最多 10 個檔案
  • 每個檔案最大 25MB
  • 檔案以 Discord 附件形式發送(可在 Discord 中檢視 / 下載)

2. react — 新增表情符號回應

對訊息新增表情符號回應。適合在不需要發送完整回覆時進行快速確認。

常見模式:

  • 任務開始時加上打勾回應
  • 完成時加上綠色圓圈回應
  • 需要注意時加上警告標誌回應

3. edit_message — 編輯 Bot 訊息

編輯先前發送的 bot 訊息。Bot 只能編輯自己的訊息,不能編輯其他使用者的訊息。

使用場景:

  • 隨著長時間任務的進展更新狀態訊息
  • 在獲得額外上下文後修正回應
  • 在初始確認訊息後附加結果

4. fetch_messages — 抓取頻道歷史

從頻道擷取最近的訊息。每次最多抓取 100 則訊息。

使用場景:

  • 讀取對話中較早的上下文
  • 檢查在設定過程中發送了哪些指令或請求
  • 在採取行動前檢視討論歷史

5. download_attachment — 下載檔案

從 Discord 訊息中下載附件到你的本地機器。

儲存位置:

~/.claude/channels/discord/inbox/

使用場景:

  • 從手機發送檔案到 Claude Code 進行處理
  • 分享截圖讓 Claude 分析(如果使用多模態模型的話)
  • 從另一台裝置上傳設定檔案或程式碼片段

工作流程範例:

  1. 你在手機上截取錯誤畫面
  2. 在 Discord 上發送給 bot
  3. Claude 使用 download_attachment 將它儲存到本地
  4. Claude 分析圖片並提供除錯指導

Practical Usage Scenarios

Here are real-world scenarios where Claude Code Channels shines.

Scenario 1: Mobile Code Review

You're away from your desk but need to review a pull request.

You (Discord): Review the PR on branch feature/auth-refactor.
              Focus on security issues.

Claude: I'll review the branch now.

[Claude runs git diff, analyzes changes]

Claude: Found 3 issues in the PR:
1. SQL injection vulnerability in user_query.py line 89
2. Missing rate limiting on /api/login endpoint
3. JWT secret is hardcoded in config.py

Shall I fix these and push a commit?

Scenario 2: Running Tests from Your Phone

You (Discord): Run the test suite for the payments module

Claude: Running tests now...

[Claude executes pytest tests/payments/]

Claude: 47 tests passed, 2 failed:
- test_refund_partial: AssertionError on line 34
- test_webhook_timeout: TimeoutError after 30s

Want me to investigate the failures?

Scenario 3: Quick File Edits

You (Discord): In src/config/settings.py, change
              DEBUG = True to DEBUG = False

Claude: Done. Changed DEBUG from True to False
        in src/config/settings.py line 12.

Scenario 4: Monitoring and Status Checks

You (Discord): What's the git status of the project?
              Any uncommitted changes?

Claude: Current branch: main (up to date with origin)
3 modified files:
- src/api/routes.py (12 insertions, 3 deletions)
- tests/test_routes.py (28 insertions)
- package.json (1 insertion — new dependency)

No staged changes. Want me to review the diff?

Scenario 5: File Transfer Workflow

You (Discord): [Attaches error_screenshot.png]
              What's causing this error?

Claude: [Downloads attachment, analyzes image]

Claude: The error shows a CORS policy violation.
        Your API at localhost:8000 is rejecting
        requests from localhost:3000.

        I can fix this by adding CORS middleware.
        Should I proceed?

實際使用場景

以下是 Claude Code Channels 大放異彩的真實場景。

場景 1:行動端 Code Review

你不在辦公桌前,但需要審查一個 pull request。

你(Discord):審查 feature/auth-refactor 分支上的 PR。
              重點關注安全問題。

Claude:我現在開始審查這個分支。

[Claude 執行 git diff,分析變更]

Claude:在 PR 中發現 3 個問題:
1. user_query.py 第 89 行有 SQL injection 漏洞
2. /api/login endpoint 缺少 rate limiting
3. JWT secret 在 config.py 中是寫死的

要我修復這些並推送 commit 嗎?

場景 2:從手機跑測試

你(Discord):跑 payments 模組的測試套件

Claude:正在執行測試……

[Claude 執行 pytest tests/payments/]

Claude:47 個測試通過,2 個失敗:
- test_refund_partial:第 34 行 AssertionError
- test_webhook_timeout:30 秒後 TimeoutError

要我調查失敗原因嗎?

場景 3:快速檔案編輯

你(Discord):在 src/config/settings.py 中,把
              DEBUG = True 改成 DEBUG = False

Claude:完成。已將 src/config/settings.py 第 12 行的
        DEBUG 從 True 改為 False。

場景 4:監控與狀態檢查

你(Discord):專案的 git status 是什麼?
              有沒有未提交的變更?

Claude:目前分支:main(與 origin 同步)
3 個已修改的檔案:
- src/api/routes.py(12 行新增,3 行刪除)
- tests/test_routes.py(28 行新增)
- package.json(1 行新增——新的依賴項)

沒有已暫存的變更。要我檢視 diff 嗎?

場景 5:檔案傳輸工作流

你(Discord):[附加 error_screenshot.png]
              這個錯誤是什麼原因造成的?

Claude:[下載附件,分析圖片]

Claude:錯誤顯示 CORS 策略違規。
        你在 localhost:8000 的 API 正在拒絕
        來自 localhost:3000 的請求。

        我可以透過新增 CORS middleware 來修復。
        要我繼續嗎?

Community Alternative Solutions

The official Channels plugin isn't the only way to bridge Claude Code with Discord. The open-source community has created several alternatives, each with different design philosophies.

Comparison Table

ProjectApproachKey FeatureDockerMulti-MachinePersistent
Official Channels PluginMCP server pushOfficial, integratedNoNoNo
zebbern/claude-code-discordFull CLI bridgeChat + shell/git commandsYesNoNo
chadingTV/claudecode-discordMulti-machine hubHeadless daemon, no API keyNoYesPartial
Disclaudetmux-based sessionsEach channel = tmux sessionNoNoYes
JessyTsui/Claude-Code-RemoteMulti-platformEmail + Discord + TelegramNoNoPartial
ebibibi/claude-code-discord-bridgeCLI wrapperstream-json outputNoNoNo
timoconnellaus/claude-code-discord-botProject-specificDifferent channels = different dirsNoNoNo

Detailed Breakdown

zebbern/claude-code-discord

A full CLI bridge that lets you run chat commands, shell commands, and git operations directly from Discord. Supports Docker deployment for isolation. Good choice if you want more than just chat — you want shell-level access from Discord.

chadingTV/claudecode-discord

A multi-machine agent hub. You can control Claude Code instances across multiple machines from a single Discord server. Runs as a headless daemon without requiring an API key (uses your local Claude Code authentication). Best for developers with multiple workstations.

Disclaude

Uses tmux for session management. Each Discord channel maps to a tmux session, enabling persistent background tasks that survive terminal closures. This solves one of the biggest limitations of the official plugin — persistence. If you need Claude Code to keep working after you close your laptop, this is worth investigating.

JessyTsui/Claude-Code-Remote

Multi-platform remote control supporting email, Discord, and Telegram simultaneously. Useful if your team uses different messaging platforms and you want a unified remote control solution.

ebibibi/claude-code-discord-bridge

A lightweight CLI wrapper that pipes Claude Code's --output-format stream-json output to Discord. Minimalist approach — less features but easier to understand and modify.

timoconnellaus/claude-code-discord-bot

Project-specific bot where different Discord channels map to different working directories. Ideal for managing multiple projects from a single Discord server — switch contexts by switching channels.

Which Should You Choose?

  • Just want official and simple → Official Channels Plugin
  • Need persistence (bot stays active after terminal closes) → Disclaude
  • Multiple machines → chadingTV/claudecode-discord
  • Multiple projects from one server → timoconnellaus/claude-code-discord-bot
  • Want shell/git access from Discord → zebbern/claude-code-discord
  • Multi-platform (not just Discord) → JessyTsui/Claude-Code-Remote

社群替代方案

官方 Channels plugin 不是將 Claude Code 與 Discord 橋接的唯一方式。開源社群已經建立了多種替代方案,各自有不同的設計哲學。

比較表

專案方法核心特色Docker多機器持久性
官方 Channels PluginMCP server 推送官方、整合式
zebbern/claude-code-discord完整 CLI 橋接聊天 + shell/git 指令
chadingTV/claudecode-discord多機器 hubHeadless daemon,不需 API key部分
Disclaude基於 tmux 的 session每個頻道 = tmux session
JessyTsui/Claude-Code-Remote多平台Email + Discord + Telegram部分
ebibibi/claude-code-discord-bridgeCLI wrapperstream-json 輸出
timoconnellaus/claude-code-discord-bot專案專用不同頻道 = 不同工作目錄

詳細解析

zebbern/claude-code-discord

完整的 CLI 橋接方案,讓你可以直接從 Discord 執行聊天指令、shell 指令和 git 操作。支援 Docker 部署以實現隔離。如果你想要的不只是聊天——而是從 Discord 獲得 shell 層級的存取權——這是個好選擇。

chadingTV/claudecode-discord

多機器代理 hub。你可以從單一 Discord 伺服器控制多台機器上的 Claude Code 實例。以 headless daemon 方式運行,不需要 API key(使用你本地的 Claude Code 認證)。最適合擁有多個工作站的開發者。

Disclaude

使用 tmux 進行 session 管理。每個 Discord 頻道對應一個 tmux session,實現即使關閉終端機也能存續的持久性背景任務。這解決了官方 plugin 最大的限制之一——持久性。如果你需要在闔上筆電後 Claude Code 仍然繼續工作,這個值得研究。

JessyTsui/Claude-Code-Remote

多平台遠端控制,同時支援 email、Discord 和 Telegram。如果你的團隊使用不同的通訊平台,而你想要一個統一的遠端控制方案,這會很有用。

ebibibi/claude-code-discord-bridge

輕量級 CLI wrapper,將 Claude Code 的 --output-format stream-json 輸出導向 Discord。極簡方法——功能較少,但更容易理解和修改。

timoconnellaus/claude-code-discord-bot

專案專用 bot,不同的 Discord 頻道對應不同的工作目錄。非常適合從單一 Discord 伺服器管理多個專案——透過切換頻道來切換上下文。

你應該選哪個?

  • 只想要官方且簡單的方案 → 官方 Channels Plugin
  • 需要持久性(關閉終端機後 bot 仍然活躍) → Disclaude
  • 多台機器 → chadingTV/claudecode-discord
  • 從一個伺服器管理多個專案 → timoconnellaus/claude-code-discord-bot
  • 想從 Discord 存取 shell/git → zebbern/claude-code-discord
  • 多平台(不只是 Discord) → JessyTsui/Claude-Code-Remote

Discord MCP Servers: The Alternative Approach

Beyond Channels, there's another way to integrate Claude Code with Discord: Discord MCP servers. These work fundamentally differently from the Channels model.

Push vs. Pull

AspectChannels (Push)MCP Servers (Pull)
DirectionDiscord → Claude Code (messages pushed in)Claude Code → Discord (queries on demand)
InitiationUser sends message on DiscordClaude decides to check Discord
Real-timeYes — instant message deliveryNo — only when Claude queries
Use caseRemote control of Claude CodeOccasional Discord interactions
Session dependencyRequires active sessionWorks within any Claude session

Notable Discord MCP Servers

discordmcp

A general-purpose MCP server that gives Claude the ability to read channels, send messages, and manage Discord interactions. Claude can query Discord when it needs information from a channel.

discord-mcp

Similar functionality with a focus on channel reading and message posting. Useful when you want Claude to monitor a channel or post updates.

Composio Discord Toolkit

Part of the Composio ecosystem, providing Discord tools alongside other platform integrations. Good if you're already using Composio for other MCP integrations.

When to Use MCP Servers Instead of Channels

  • You want Claude to post updates to Discord (e.g., CI/CD notifications, deployment status)
  • You need to read Discord channels for context (e.g., checking a #bugs channel for reports)
  • You don't need real-time bidirectional communication
  • You want Discord integration without running a dedicated bot
  • You need integration within a larger MCP tool ecosystem

Can You Use Both?

Yes. You can run Channels for remote control AND have a Discord MCP server for on-demand queries. They serve different purposes and don't conflict with each other.

Discord MCP Server:另一種方法

除了 Channels 之外,還有另一種將 Claude Code 與 Discord 整合的方式:Discord MCP server。它們的運作方式與 Channels 模型有本質上的不同。

推送 vs. 拉取

面向Channels(推送)MCP Server(拉取)
方向Discord → Claude Code(訊息推送進來)Claude Code → Discord(按需查詢)
發起者使用者在 Discord 上發送訊息Claude 決定檢查 Discord
即時性是——訊息即時遞送否——只在 Claude 查詢時
使用場景遠端控制 Claude Code偶爾的 Discord 互動
Session 依賴需要活躍的 session在任何 Claude session 中都可運作

值得注意的 Discord MCP Server

discordmcp

通用型 MCP server,讓 Claude 能夠讀取頻道、發送訊息和管理 Discord 互動。Claude 可以在需要頻道資訊時查詢 Discord。

discord-mcp

類似功能,專注於頻道讀取和訊息發佈。適合你想讓 Claude 監控頻道或發佈更新的場景。

Composio Discord Toolkit

Composio 生態系統的一部分,在其他平台整合之外提供 Discord 工具。如果你已經在使用 Composio 進行其他 MCP 整合,這是個好選擇。

何時使用 MCP Server 而非 Channels

  • 你想讓 Claude 發佈更新到 Discord(例如 CI/CD 通知、部署狀態)
  • 你需要讀取 Discord 頻道以取得上下文(例如查看 #bugs 頻道的報告)
  • 你不需要即時雙向通訊
  • 你想要 Discord 整合但不想運行專用 bot
  • 你需要在更大的 MCP 工具生態系統中進行整合

可以兩者同時使用嗎?

可以。你可以同時運行 Channels 來遠端控制,並使用 Discord MCP server 進行按需查詢。它們服務於不同目的,彼此不衝突。


Important Considerations & Gotchas

Before you rely on Claude Code Channels for your daily workflow, be aware of these critical points.

1. Bun is Required — Not Node.js

This cannot be overstated. The Discord plugin is built for the Bun runtime. If you run it on Node.js:

  • The plugin installs without error
  • The plugin loads without error
  • The bot appears to start without error
  • But no messages are ever received or processed

There is zero feedback that anything is wrong. Always verify with bun --version before troubleshooting anything else.

2. Message Content Intent is Non-Negotiable

The second most common failure. If you skip enabling Message Content Intent in the Discord Developer Portal:

  • The bot connects to Discord successfully
  • The bot appears online
  • Messages are sent to the bot
  • The bot receives events but message content is empty

Go to Developer Portal → Bot → Privileged Gateway Intents → Message Content Intent → ON.

3. No Persistence Between Sessions

When you close Claude Code (or your terminal), the bot goes offline. Any messages sent while the bot is offline are permanently lost — they are not queued or buffered.

This means:

  • You cannot "leave Claude running overnight" with the official plugin
  • If your SSH connection drops, the session ends
  • There's no way to resume a previous Channels session

If persistence is critical, look into community alternatives like Disclaude (tmux-based) or chadingTV/claudecode-discord (headless daemon).

4. Research Preview Status

Claude Code Channels is currently in research preview. This means:

  • The syntax for commands may change
  • The plugin protocol may change
  • Features may be added or removed
  • There's no guarantee of backward compatibility

Plan accordingly and don't build critical production workflows that depend on exact command syntax.

5. Team/Enterprise Restrictions

For organizations using Claude Code in Team or Enterprise plans:

  • Channels must be explicitly enabled by an organization admin
  • This is done through managed settings
  • Individual users cannot enable it on their own
  • The plugin install command will fail silently if not enabled

6. Active Session = Active Bot

The bot is online if and only if Claude Code is running with the --channels flag. There is no background service, no daemon, no separate process. This is by design — it ensures that the bot only has access to your machine when you explicitly allow it.

7. File Transfer Limits

When using the attachment tools:

  • Maximum 10 files per message
  • Maximum 25MB per file
  • Downloaded files go to ~/.claude/channels/discord/inbox/
  • Monitor disk space if you're frequently downloading large files

重要注意事項與陷阱

在你將 Claude Code Channels 用於日常工作流之前,請注意這些關鍵要點。

1. 必須使用 Bun——不是 Node.js

這一點怎麼強調都不過分。Discord plugin 是為 Bun 執行環境打造的。如果你在 Node.js 上運行:

  • Plugin 安裝不會報錯
  • Plugin 載入不會報錯
  • Bot 啟動看起來也不會報錯
  • 但沒有任何訊息會被接收或處理

完全沒有任何回饋告訴你出了問題。在排除其他問題之前,永遠先用 bun --version 確認。

2. Message Content Intent 不可省略

第二常見的失敗原因。如果你跳過在 Discord Developer Portal 中啟用 Message Content Intent:

  • Bot 成功連接到 Discord
  • Bot 顯示為上線狀態
  • 訊息被發送給 bot
  • Bot 收到事件但訊息內容是空的

前往 Developer Portal → Bot → Privileged Gateway Intents → Message Content Intent → 開啟。

3. Session 之間沒有持久性

當你關閉 Claude Code(或你的終端機)時,bot 就離線了。Bot 離線時發送的任何訊息都會永久遺失——不會被排隊或緩衝。

這意味著:

  • 使用官方 plugin 你無法「讓 Claude 整夜運行」
  • 如果你的 SSH 連線中斷,session 就結束了
  • 沒有辦法恢復之前的 Channels session

如果持久性至關重要,請研究社群替代方案,如 Disclaude(基於 tmux)或 chadingTV/claudecode-discord(headless daemon)。

4. Research Preview 狀態

Claude Code Channels 目前處於 research preview 階段。這意味著:

  • 指令的語法可能會改變
  • Plugin 協議可能會改變
  • 功能可能會被新增或移除
  • 不保證向後相容

請相應規劃,不要建構依賴於精確指令語法的關鍵生產工作流。

5. Team / Enterprise 限制

對於使用 Claude Code Team 或 Enterprise 方案的組織:

  • Channels 必須由組織管理員明確啟用
  • 這是透過受管設定完成的
  • 個別使用者無法自行啟用
  • 如果未啟用,plugin install 指令會靜默失敗

6. 活躍的 Session = 活躍的 Bot

Bot 上線的充要條件是 Claude Code 正在以 --channels 旗標運行。沒有背景服務,沒有 daemon,沒有獨立的程序。這是設計使然——確保 bot 只在你明確允許時才能存取你的機器。

7. 檔案傳輸限制

使用附件工具時:

  • 每則訊息最多 10 個檔案
  • 每個檔案最大 25MB
  • 下載的檔案會存放在 ~/.claude/channels/discord/inbox/
  • 如果你經常下載大型檔案,請監控磁碟空間

Troubleshooting Guide

When things go wrong, work through these issues in order. Most problems fall into one of these categories.

Bot Doesn't Respond to Messages

Check #1: Message Content Intent

This is the most common cause. Go to Discord Developer Portal → your app → Bot → Privileged Gateway Intents → verify Message Content Intent is enabled.

Check #2: Bun runtime

bash
bun --version

If this returns "command not found" or you only have Node.js, install Bun:

bash
curl -fsSL https://bun.sh/install | bash

Check #3: Bot is online

Look at your Discord server member list. Is the bot showing as online (green dot)? If not, check that Claude Code is running with the --channels flag.

Check #4: Access policy

If you set the policy to allowlist, make sure your user ID is in the allowlist:

bash
cat ~/.claude/channels/discord/access.json

Plugin Install Fails

Check #1: Claude Code version

bash
claude --version

You need v2.1.80 or later.

Check #2: Bun availability

The plugin installer may require Bun. Make sure it's in your PATH.

Check #3: Team/Enterprise settings

If you're on a managed plan, contact your admin to enable Channels.

Pairing Code Not Received

Check #1: Bot is in the server

Make sure you completed Step 4 (adding the bot to your server via the OAuth2 URL).

Check #2: Bot permissions

The bot needs Send Messages permission in the channel or DM context.

Check #3: DM settings

Make sure your Discord privacy settings allow DMs from server members (or bots).

Messages Not Reaching Claude Code

Check #1: Allowlist

If you set the access policy to allowlist, verify your Discord user ID is included:

bash
cat ~/.claude/channels/discord/access.json

Check #2: Session is active

Messages only reach Claude Code while a session with --channels is actively running. If you closed your terminal or the session ended, restart it.

Check #3: Check the terminal

Look at the Claude Code terminal for any error messages or connection issues.

Attachments Fail

Check #1: Disk space

bash
df -h ~/.claude/channels/discord/inbox/

Make sure you have adequate free space.

Check #2: File size

Discord has a 25MB per file limit. Files larger than this will fail to upload.

Check #3: Directory exists

bash
ls -la ~/.claude/channels/discord/inbox/

If the directory doesn't exist, the plugin should create it automatically, but verify it's there.

General Debugging Steps

  1. Restart Claude Code with the channels flag — many transient issues resolve on restart
  2. Check the .env file — make sure the token is correctly saved
  3. Re-pair your account — if the pairing seems broken, DM the bot again and re-run the pair command
  4. Try Fakechat — if Fakechat works but Discord doesn't, the issue is Discord-specific (token, permissions, intents)
  5. Check Discord status — rarely, Discord itself may have service issues (check status.discord.com)

故障排除指南

出問題時,按順序檢查這些項目。大多數問題都屬於以下類別之一。

Bot 不回應訊息

檢查 #1:Message Content Intent

這是最常見的原因。前往 Discord Developer Portal → 你的應用程式 → Bot → Privileged Gateway Intents → 確認 Message Content Intent 已啟用。

檢查 #2:Bun 執行環境

bash
bun --version

如果回傳 "command not found" 或你只有 Node.js,安裝 Bun:

bash
curl -fsSL https://bun.sh/install | bash

檢查 #3:Bot 是否上線

查看你的 Discord 伺服器成員列表。Bot 是否顯示為上線(綠色圓點)?如果不是,檢查 Claude Code 是否以 --channels 旗標運行。

檢查 #4:存取策略

如果你將策略設為允許清單,確認你的使用者 ID 在允許清單中:

bash
cat ~/.claude/channels/discord/access.json

Plugin 安裝失敗

檢查 #1:Claude Code 版本

bash
claude --version

你需要 v2.1.80 或更新的版本。

檢查 #2:Bun 可用性

Plugin 安裝程式可能需要 Bun。確保它在你的 PATH 中。

檢查 #3:Team / Enterprise 設定

如果你使用的是受管方案,聯繫你的管理員以啟用 Channels。

沒有收到配對碼

檢查 #1:Bot 在伺服器中

確認你已完成步驟 4(透過 OAuth2 URL 將 bot 加入伺服器)。

檢查 #2:Bot 權限

Bot 需要在頻道或 DM 上下文中擁有 Send Messages 權限。

檢查 #3:DM 設定

確認你的 Discord 隱私設定允許來自伺服器成員(或 bot)的 DM。

訊息沒有到達 Claude Code

檢查 #1:允許清單

如果你將存取策略設為允許清單,確認你的 Discord 使用者 ID 包含在內:

bash
cat ~/.claude/channels/discord/access.json

檢查 #2:Session 處於活躍狀態

訊息只有在使用 --channels 的 session 活躍運行時才會到達 Claude Code。如果你關閉了終端機或 session 結束了,重新啟動它。

檢查 #3:檢查終端機

查看 Claude Code 終端機中是否有錯誤訊息或連接問題。

附件失敗

檢查 #1:磁碟空間

bash
df -h ~/.claude/channels/discord/inbox/

確認你有足夠的可用空間。

檢查 #2:檔案大小

Discord 有每個檔案 25MB 的限制。超過此限制的檔案將無法上傳。

檢查 #3:目錄存在

bash
ls -la ~/.claude/channels/discord/inbox/

如果目錄不存在,plugin 應該會自動建立它,但請確認它在那裡。

通用除錯步驟

  1. 以 channels 旗標重新啟動 Claude Code——許多暫時性問題在重啟後就能解決
  2. 檢查 .env 檔案——確認 token 已正確儲存
  3. 重新配對你的帳號——如果配對看起來壞了,再次 DM bot 並重新執行 pair 指令
  4. 嘗試 Fakechat——如果 Fakechat 可以運作但 Discord 不行,問題是 Discord 特定的(token、權限、intent)
  5. 檢查 Discord 狀態——少數情況下,Discord 本身可能有服務問題(查看 status.discord.com)

Quick Reference

Complete Setup Commands (Copy-Paste Ready)

bash
# 1. Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash

# 2. Verify prerequisites
bun --version          # Need v1.0+
claude --version       # Need v2.1.80+

# 3. Test with Fakechat first (optional but recommended)
/plugin install fakechat@claude-plugins-official
claude --channels plugin:fakechat@claude-plugins-official
# Visit http://localhost:8787 to test

# 4. Install Discord plugin
/plugin install discord@claude-plugins-official

# 5. Configure bot token
/discord:configure <YOUR_BOT_TOKEN>

# 6. Launch with Channels
claude --channels plugin:discord@claude-plugins-official

# 7. Pair your Discord account (after DM-ing the bot)
/discord:access pair <PAIRING_CODE>

# 8. Lock down access
/discord:access policy allowlist

Discord Developer Portal Checklist

  • [ ] Created application at discord.com/developers/applications
  • [ ] Enabled Message Content Intent (Bot → Privileged Gateway Intents)
  • [ ] Generated and copied bot token
  • [ ] Selected bot scope in OAuth2 → URL Generator
  • [ ] Checked all 6 required permissions
  • [ ] Added bot to server via generated URL

Key File Paths

~/.claude/channels/discord/.env          # Bot token
~/.claude/channels/discord/access.json   # Access control
~/.claude/channels/discord/inbox/        # Downloaded attachments

Available Tools Summary

ToolPurposeLimits
replySend messages + attachments10 files, 25MB each
reactAdd emoji reactions
edit_messageEdit bot's own messagesBot messages only
fetch_messagesPull channel historyMax 100 messages
download_attachmentDownload files to localSaved to inbox/

快速參考

完整設定指令(可直接複製貼上)

bash
# 1. 安裝 Bun(如果尚未安裝)
curl -fsSL https://bun.sh/install | bash

# 2. 驗證前置條件
bun --version          # 需要 v1.0+
claude --version       # 需要 v2.1.80+

# 3. 先用 Fakechat 測試(選擇性但建議)
/plugin install fakechat@claude-plugins-official
claude --channels plugin:fakechat@claude-plugins-official
# 開啟 http://localhost:8787 進行測試

# 4. 安裝 Discord plugin
/plugin install discord@claude-plugins-official

# 5. 設定 bot token
/discord:configure <YOUR_BOT_TOKEN>

# 6. 以 Channels 模式啟動
claude --channels plugin:discord@claude-plugins-official

# 7. 配對你的 Discord 帳號(在 DM bot 之後)
/discord:access pair <PAIRING_CODE>

# 8. 鎖定存取權限
/discord:access policy allowlist

Discord Developer Portal 檢查清單

  • [ ] 在 discord.com/developers/applications 建立了應用程式
  • [ ] 啟用了 Message Content Intent(Bot → Privileged Gateway Intents)
  • [ ] 產生並複製了 bot token
  • [ ] 在 OAuth2 → URL Generator 中選擇了 bot scope
  • [ ] 勾選了全部 6 個必要權限
  • [ ] 透過產生的 URL 將 bot 加入伺服器

重要檔案路徑

~/.claude/channels/discord/.env          # Bot token
~/.claude/channels/discord/access.json   # 存取控制
~/.claude/channels/discord/inbox/        # 下載的附件

可用工具摘要

工具用途限制
reply發送訊息 + 附件10 個檔案,每個 25MB
react新增表情符號回應
edit_message編輯 bot 自己的訊息僅限 bot 訊息
fetch_messages抓取頻道歷史最多 100 則訊息
download_attachment下載檔案到本地儲存至 inbox/