Discord Context
/install discord-thread-reader
Discord Context
Problem
OpenClaw is session-based: agents only see messages from conversations where they have an active session. Discord threads that the agent wasn't mentioned in or hasn't interacted with are invisible — there's no built-in tool to read arbitrary channel/thread history.
Additionally, OpenClaw redacts the Discord bot token from openclaw config get and environment variables (by design), so agents cannot make direct Discord API calls using the configured token.
Solution
Store the Discord bot token in a separate file accessible to the agent, then use curl to call the Discord API directly.
Setup (one-time, run as the user)
# Store your bot token in a file outside the workspace (won't be git-committed)
echo 'YOUR_DISCORD_BOT_TOKEN' > ~/.openclaw/.discord-bot-token
chmod 600 ~/.openclaw/.discord-bot-token
Record the path in TOOLS.md so the agent knows where to find it across sessions.
Reading Messages
# Load token
DISCORD_TOKEN=$(cat ~/.openclaw/.discord-bot-token)
# Read recent messages from a channel or thread (threads are channels in Discord)
curl -s -H "Authorization: Bot $DISCORD_TOKEN" \
"https://discord.com/api/v10/channels/{channel_or_thread_id}/messages?limit=50" \
| python3 -m json.tool
# Read messages before a specific message ID (pagination)
curl -s -H "Authorization: Bot $DISCORD_TOKEN" \
"https://discord.com/api/v10/channels/{channel_id}/messages?limit=50&before={message_id}" \
| python3 -m json.tool
# List active threads in a guild channel
curl -s -H "Authorization: Bot $DISCORD_TOKEN" \
"https://discord.com/api/v10/channels/{parent_channel_id}/threads/active" \
| python3 -m json.tool
Finding Thread/Channel IDs
- Enable Developer Mode in Discord: User Settings → Advanced → Developer Mode
- Right-click any channel or thread → Copy Channel ID
- Thread IDs and channel IDs work the same way in the API
Key Notes
- Discord returns messages newest-first by default
- Max
limitis 100 per request; usebefore/afterparams to paginate - The bot must be a member of the guild and have View Channel + Read Message History permissions
- Rate limits apply: 50 requests/second per route (respect
429responses andRetry-Afterheaders)
Response Fields
Each message object contains:
content— message textauthor.username/author.global_name— who sent ittimestamp— whenid— message ID (for pagination or reply references)referenced_message— the message being replied to (if a reply)
Security Considerations
- The token file is
chmod 600and outside the git-tracked workspace - The bot token grants read/write access to all channels the bot is in — treat it like a password
- Prefer read-only API calls; do not use this for sending messages (use OpenClaw's native routing instead)
- If the token is rotated in Discord Developer Portal, update both
openclaw configand the token file
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install discord-thread-reader - 安装完成后,直接呼叫该 Skill 的名称或使用
/discord-thread-reader触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Discord Context 是什么?
Read Discord channel and thread message history directly via the Discord Bot API, bypassing OpenClaw's session-based message visibility. Use when you need to... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 429 次。
如何安装 Discord Context?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install discord-thread-reader」即可一键安装,无需额外配置。
Discord Context 是免费的吗?
是的,Discord Context 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Discord Context 支持哪些平台?
Discord Context 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Discord Context?
由 EasonC13-agent(@easonc13-agent)开发并维护,当前版本 v1.0.0。