JSPM

openclawdc

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 12
    • Score
      100M100P100Q30401F
    • License MIT

    一键配置 Discord 与 OpenClaw 的连接,自动设置 Bot Token 和权限

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (openclawdc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      openclawdc

      一键配置 Discord 与 OpenClaw 的连接。

      快速开始

      npx openclawdc

      或指定 Bot Token:

      # macOS/Linux
      DISCORD_BOT_TOKEN="你的Token" npx openclawdc
      
      # Windows PowerShell
      $env:DISCORD_BOT_TOKEN="你的Token"; npx openclawdc
      
      # Windows CMD
      set DISCORD_BOT_TOKEN=你的Token && npx openclawdc

      前置条件

      1. 已安装 OpenClaw:npm install -g openclaw && openclaw onboard
      2. 已创建 Discord 应用和机器人

      Discord 开发者平台设置

      1. 创建应用

      1. 访问 Discord Developer Portal
      2. 点击 New Application
      3. 输入应用名称(如:OpenClaw Bot)

      2. 添加机器人

      1. 左侧菜单点击 Bot
      2. 点击 Add Bot
      3. 点击 Reset Token 并复制 Token

      3. 启用 Message Content Intent(必须)

      在 Bot 页面,找到 Privileged Gateway Intents

      • MESSAGE CONTENT INTENT - 必须启用

      4. 配置权限

      OAuth2 → URL Generator

      Scopes:

      • ✅ bot

      Bot Permissions:

      • ✅ Send Messages
      • ✅ Read Messages/View Channels
      • ✅ Read Message History
      • ✅ Embed Links(推荐)
      • ✅ Attach Files(推荐)

      5. 邀请机器人

      复制生成的 URL,在浏览器中打开,选择服务器并授权。

      配置项

      配置项 说明 必要性
      token Discord Bot Token 必填
      enabled 是否启用 必填
      allowlist 允许的用户 ID 列表 可选

      手动配置

      如果自动配置失败,可以手动执行:

      openclaw config set channels.discord.enabled true
      openclaw config set channels.discord.token "YOUR_BOT_TOKEN"
      openclaw config set channels.discord.allowlist '["USER_ID_1", "USER_ID_2"]'
      openclaw gateway restart

      常用命令

      # 查看状态
      openclaw channels status --deep
      
      # 查看日志
      openclaw channels logs
      
      # 重启服务
      openclaw gateway restart

      故障排除

      机器人不响应

      1. 检查 MESSAGE CONTENT INTENT 是否已启用
      2. 检查机器人是否在服务器中
      3. 检查机器人是否有读取消息的权限
      4. 查看日志:openclaw channels logs

      Token 无效

      1. 在 Discord Developer Portal 重新生成 Token
      2. 重新运行配置:npx openclawdc

      权限不足

      确保机器人有以下权限:

      • Send Messages
      • Read Messages/View Channels
      • Read Message History

      License

      MIT