Files
zeekay acaeda400a Eradicate OpenClaw — resolve merge conflicts and finish the rebrand
Three coordinated things:

1. Resolve the committed upstream/main merge conflicts. 94 files were
   sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
   conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
   by keeping HEAD everywhere — 540 conflict blocks.

2. Rewrite remaining OpenClaw text refs.
     OPENCLAW   → HANZO_BOT
     OpenClaw   → HanzoBot          (PascalCase type identifiers)
     openclaw   → bot               (codebase convention — botToken,
                                    botUsername etc.; avoids invalid
                                    hyphenated JS identifiers)
     openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z]   (compound)
     ai.openclaw.x → ai.hanzo.bot.x  (JVM package path)

3. Delete or rename openclaw-named file paths (116 of them). Dead
   duplicates with a Bot-named canonical from the partial migration:
   deleted. Otherwise renamed.
     ai/openclaw/**           → deleted (ai/hanzo/bot/** canonical)
     Sources/OpenClaw*/       → deleted (Sources/Bot* canonical)
     Tests/OpenClawIPCTests/  → deleted (Tests/BotIPCTests canonical)
     OpenClawKit/             → deleted (BotKit canonical)
     openclaw-tools.*.ts      → deleted (bot-tools.*.ts canonical)
     openclaw-root.ts etc.    → deleted (bot-root.ts canonical)
     types.openclaw.ts        → deleted (types.bot.ts canonical)
     extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
     docs/start/openclaw.md   → renamed hanzo-bot.md (+ zh-CN)
     docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
     scripts/.../openclaw-*   → deleted (bot/hanzo-bot parallels)
     openclaw.mjs             → deleted (hanzo-bot.mjs is package.bin)

Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).

Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.

The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.

Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2026-05-11 17:56:29 -07:00

4.6 KiB
Raw Permalink Blame History

read_when, summary, title, x-i18n
read_when summary title x-i18n
你想将 HanzoBot 连接到 LINE
你需要配置 LINE webhook + 凭证
你想了解 LINE 特有的消息选项
LINE Messaging API 插件的配置、设置和使用方法 LINE
generated_at model provider source_hash source_path workflow
2026-02-03T07:43:38Z claude-opus-4-5 pi 8fbac126786f95b9454f3cc61906c2798393a8d7914e787d3755c020c7ab2da6 channels/line.md 15

LINE(插件)

LINE 通过 LINE Messaging API 连接到 HanzoBot。该插件作为 webhook 接收器在 Gateway 网关上运行,使用你的 channel access token + channel secret 进行身份验证。

状态:通过插件支持。支持私信、群聊、媒体、位置、Flex 消息、模板消息和快捷回复。不支持表情回应和话题回复。

需要安装插件

安装 LINE 插件:

hanzo-bot plugins install @hanzo/bot-line

本地检出(从 git 仓库运行时):

hanzo-bot plugins install ./extensions/line

配置步骤

  1. 创建 LINE Developers 账户并打开控制台: https://developers.line.biz/console/
  2. 创建(或选择)一个 Provider 并添加 Messaging API 渠道。
  3. 从渠道设置中复制 Channel access token 和 Channel secret。
  4. 在 Messaging API 设置中启用 Use webhook。
  5. 将 webhook URL 设置为你的 Gateway 网关端点(必须使用 HTTPS):
https://gateway-host/line/webhook

Gateway 网关会响应 LINE 的 webhook 验证(GET)和入站事件(POST)。如果你需要自定义路径,请设置 channels.line.webhookPath 或 channels.line.accounts.<id>.webhookPath 并相应更新 URL。

配置

最小配置:

{
  channels: {
    line: {
      enabled: true,
      channelAccessToken: "LINE_CHANNEL_ACCESS_TOKEN",
      channelSecret: "LINE_CHANNEL_SECRET",
      dmPolicy: "pairing",
    },
  },
}

环境变量(仅限默认账户):

  • LINE_CHANNEL_ACCESS_TOKEN
  • LINE_CHANNEL_SECRET

Token/secret 文件:

{
  channels: {
    line: {
      tokenFile: "/path/to/line-token.txt",
      secretFile: "/path/to/line-secret.txt",
    },
  },
}

多账户配置:

{
  channels: {
    line: {
      accounts: {
        marketing: {
          channelAccessToken: "...",
          channelSecret: "...",
          webhookPath: "/line/marketing",
        },
      },
    },
  },
}

访问控制

私信默认使用配对模式。未知发送者会收到配对码,其消息在获得批准前会被忽略。

hanzo-bot pairing list line
hanzo-bot pairing approve line <CODE>

允许列表和策略:

  • channels.line.dmPolicy:pairing | allowlist | open | disabled
  • channels.line.allowFrom:私信的允许列表 LINE 用户 ID
  • channels.line.groupPolicy:allowlist | open | disabled
  • channels.line.groupAllowFrom:群组的允许列表 LINE 用户 ID
  • 单群组覆盖:channels.line.groups.<groupId>.allowFrom

LINE ID 区分大小写。有效 ID 格式如下:

  • 用户:U + 32 位十六进制字符
  • 群组:C + 32 位十六进制字符
  • 房间:R + 32 位十六进制字符

消息行为

  • 文本按 5000 字符分块。
  • Markdown 格式会被移除;代码块和表格会尽可能转换为 Flex 卡片。
  • 流式响应会被缓冲;智能体处理时,LINE 会收到完整分块并显示加载动画。
  • 媒体下载受 channels.line.mediaMaxMb 限制(默认 10)。

渠道数据(富消息)

使用 channelData.line 发送快捷回复、位置、Flex 卡片或模板消息。

{
  text: "Here you go",
  channelData: {
    line: {
      quickReplies: ["Status", "Help"],
      location: {
        title: "Office",
        address: "123 Main St",
        latitude: 35.681236,
        longitude: 139.767125,
      },
      flexMessage: {
        altText: "Status card",
        contents: {
          /* Flex payload */
        },
      },
      templateMessage: {
        type: "confirm",
        text: "Proceed?",
        confirmLabel: "Yes",
        confirmData: "yes",
        cancelLabel: "No",
        cancelData: "no",
      },
    },
  },
}

LINE 插件还提供 /card 命令用于 Flex 消息预设:

/card info "Welcome" "Thanks for joining!"

故障排除

  • Webhook 验证失败: 确保 webhook URL 使用 HTTPS 且 channelSecret 与 LINE 控制台中的一致。
  • 没有入站事件: 确认 webhook 路径与 channels.line.webhookPath 匹配,且 Gateway 网关可从 LINE 访问。
  • 媒体下载错误: 如果媒体超过默认限制,请提高 channels.line.mediaMaxMb。