discord-context
Run node {baseDir}/scripts/discord-context-cli.js <command> ....
Commands
- Pull active threads from Discord and refresh cache for new/updated threads.
- Requires
DISCORD_TOKEN plus guild/forum IDs (flags or env vars).
- Without
threadId: list cached threads.
- With
threadId: print cached context and metadata for one thread.
- Link a thread to
memory/<qmdName>.md and refresh cached context text.
Environment
- -
DISCORD_TOKEN (required for poll) - INLINECODE10 (default guild id for
poll) - INLINECODE12 (default forum id for
poll) - INLINECODE14 (defaults to
~/.openclaw/workspace)
Security Rules
- - Never hardcode Discord tokens.
- Accept only numeric thread/guild/forum IDs.
- Accept only
[a-zA-Z0-9_-]+ for qmdName. - Keep all reads/writes inside the workspace
memory/ tree.
Paths
- - Cache metadata: INLINECODE19
- Cache text: INLINECODE20
- Source context files: INLINECODE21
discord-context
运行 node {baseDir}/scripts/discord-context-cli.js ...。
命令
- - poll [--guild ] [--forum ] [--workspace ]
- 从 Discord 拉取活跃线程,并刷新新增/更新线程的缓存。
- 需要 DISCORD_TOKEN 以及服务器/论坛 ID(可通过标志或环境变量提供)。
- - context [threadId] [--workspace ] [--json]
- 不带 threadId:列出缓存的线程。
- 带 threadId:打印单个线程的缓存上下文和元数据。
- 将线程链接到 memory/
.md,并刷新缓存的上下文文本。
环境变量
- - DISCORDTOKEN(poll 命令必需)
- DISCORDGUILDID(poll 命令的默认服务器 ID)
- DISCORDFORUMCHANNELID(poll 命令的默认论坛频道 ID)
- OPENCLAW_WORKSPACE(默认为 ~/.openclaw/workspace)
安全规则
- - 切勿硬编码 Discord 令牌。
- 仅接受数字格式的线程/服务器/论坛 ID。
- qmdName 仅接受 [a-zA-Z0-9_-]+ 格式。
- 所有读写操作必须限制在工作区 memory/ 目录树内。
路径
- - 缓存元数据:memory/discord-cache/thread-.json
- 缓存文本:memory/discord-cache/thread--context.txt
- 源上下文文件:memory/*.md