@kirigaya/openclaw-onebot 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,63 +18,14 @@
18
18
  ## 安装
19
19
 
20
20
  ```bash
21
- openclaw plugins install openclaw-onebot
22
- ```
23
-
24
- 或从 GitHub 安装:
25
-
26
- ```bash
27
- openclaw plugins install https://github.com/LSTM-Kirigaya/openclaw-onebot.git
28
- ```
29
-
30
- ## 配置
31
-
32
- ### 方式一:TUI 向导(推荐)
33
-
34
- ```bash
21
+ openclaw plugins install @kirigaya/openclaw-onebot
35
22
  openclaw onebot setup
36
23
  ```
37
24
 
38
- 交互式输入:连接类型、主机、端口、Access Token。
39
-
40
- ### 方式二:手动编辑 `~/.openclaw/openclaw.json`
41
-
42
- ```json
43
- {
44
- "channels": {
45
- "onebot": {
46
- "type": "forward-websocket",
47
- "host": "127.0.0.1",
48
- "port": 3001,
49
- "accessToken": "可选",
50
- "enabled": true,
51
- "requireMention": true,
52
- "groupIncrease": {
53
- "enabled": true,
54
- "message": "欢迎 {userId} 加入群聊!"
55
- },
56
- "cronJobs": [
57
- {
58
- "name": "每日科技新闻",
59
- "cron": "0 8 * * *",
60
- "timezone": "Asia/Shanghai",
61
- "script": "./Tiphareth/src/openclaw/cron/daily-news.ts",
62
- "groupIds": [782833642]
63
- },
64
- {
65
- "name": "每日GitHub热榜",
66
- "cron": "0 9 * * *",
67
- "timezone": "Asia/Shanghai",
68
- "script": "./Tiphareth/src/openclaw/cron/github-trending.ts",
69
- "groupIds": [782833642]
70
- }
71
- ]
72
- }
73
- }
74
- }
75
- ```
25
+ ## 安装 onebot 服务端
26
+
27
+ 你需要安装 onebot 服务端,QQ 目前比较常用的是 onebot 服务端是 NapCat,可以查看 [官网](https://napneko.github.io/) 了解安装方法
76
28
 
77
- **说明**:`cronJobs` 为内置定时任务,在指定时间**直接执行脚本**并推送到群聊,不经过 Agent,无 token 消耗。脚本路径相对 `process.cwd()`(通常为启动 OpenClaw 时的目录),请确保从项目根目录启动。
78
29
 
79
30
  ### 连接类型
80
31
 
@@ -89,10 +40,10 @@ openclaw onebot setup
89
40
 
90
41
  | 变量 | 说明 |
91
42
  |------|------|
92
- | `LAGRANGE_WS_TYPE` | forward-websocket / backward-websocket |
93
- | `LAGRANGE_WS_HOST` | 主机地址 |
94
- | `LAGRANGE_WS_PORT` | 端口 |
95
- | `LAGRANGE_WS_ACCESS_TOKEN` | 访问令牌 |
43
+ | `ONEBOT_WS_TYPE` | forward-websocket / backward-websocket |
44
+ | `ONEBOT_WS_HOST` | 主机地址 |
45
+ | `ONEBOT_WS_PORT` | 端口 |
46
+ | `ONEBOT_WS_ACCESS_TOKEN` | 访问令牌 |
96
47
 
97
48
  ## 使用
98
49
 
@@ -123,11 +74,12 @@ cd openclaw-onebot
123
74
  npm run test:connect
124
75
  ```
125
76
 
126
- ## 协议参考
77
+ ## 参考
127
78
 
128
79
  - [OneBot 11](https://github.com/botuniverse/onebot-11)
129
80
  - [go-cqhttp](https://docs.go-cqhttp.org/)
130
81
  - [Lagrange.Core](https://github.com/LSTM-Kirigaya/Lagrange.Core)
82
+ - [NapCat](https://github.com/NapNeko/NapCatQQ)
131
83
 
132
84
  ## License
133
85
 
package/dist/config.js CHANGED
@@ -30,11 +30,11 @@ export function getOneBotConfig(api, accountId) {
30
30
  path: channel.path ?? "/onebot/v11/ws",
31
31
  };
32
32
  }
33
- const type = process.env.LAGRANGE_WS_TYPE;
34
- const host = process.env.LAGRANGE_WS_HOST;
35
- const portStr = process.env.LAGRANGE_WS_PORT;
36
- const accessToken = process.env.LAGRANGE_WS_ACCESS_TOKEN;
37
- const path = process.env.LAGRANGE_WS_PATH ?? "/onebot/v11/ws";
33
+ const type = process.env.ONEBOT_WS_TYPE;
34
+ const host = process.env.ONEBOT_WS_HOST;
35
+ const portStr = process.env.ONEBOT_WS_PORT;
36
+ const accessToken = process.env.ONEBOT_WS_ACCESS_TOKEN;
37
+ const path = process.env.ONEBOT_WS_PATH ?? "/onebot/v11/ws";
38
38
  if (host && portStr) {
39
39
  const port = parseInt(portStr, 10);
40
40
  if (Number.isFinite(port)) {
package/dist/setup.js CHANGED
@@ -22,19 +22,19 @@ export async function runOneBotSetup() {
22
22
  { value: "forward-websocket", label: "forward-websocket(正向,主动连接 OneBot)" },
23
23
  { value: "backward-websocket", label: "backward-websocket(反向,OneBot 连接本机)" },
24
24
  ],
25
- initialValue: process.env.LAGRANGE_WS_TYPE === "backward-websocket" ? "backward-websocket" : "forward-websocket",
25
+ initialValue: process.env.ONEBOT_WS_TYPE === "backward-websocket" ? "backward-websocket" : "forward-websocket",
26
26
  }));
27
27
  const host = guardCancel(await clackText({
28
28
  message: "主机地址",
29
- initialValue: process.env.LAGRANGE_WS_HOST || "127.0.0.1",
29
+ initialValue: process.env.ONEBOT_WS_HOST || "127.0.0.1",
30
30
  }));
31
31
  const portStr = guardCancel(await clackText({
32
32
  message: "端口",
33
- initialValue: process.env.LAGRANGE_WS_PORT || "3001",
33
+ initialValue: process.env.ONEBOT_WS_PORT || "3001",
34
34
  }));
35
35
  const accessToken = guardCancel(await clackText({
36
36
  message: "Access Token(可选,留空回车跳过)",
37
- initialValue: process.env.LAGRANGE_WS_ACCESS_TOKEN || "",
37
+ initialValue: process.env.ONEBOT_WS_ACCESS_TOKEN || "",
38
38
  }));
39
39
  const port = parseInt(String(portStr).trim(), 10);
40
40
  if (!Number.isFinite(port)) {
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "@kirigaya/openclaw-onebot",
2
+ "id": "openclaw-onebot",
3
3
  "name": "OneBot Channel",
4
4
  "version": "1.0.0",
5
5
  "description": "OneBot v11 protocol channel (QQ/Lagrange.Core via WebSocket)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirigaya/openclaw-onebot",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "OneBot v11 protocol channel plugin for OpenClaw (QQ/Lagrange.Core/go-cqhttp)",
5
5
  "license": "MIT",
6
6
  "publishConfig": { "access": "public" },
@@ -32,7 +32,7 @@ openclaw plugins install ./openclaw-onebot
32
32
 
33
33
  - Gateway 已启动:`openclaw gateway`
34
34
  - OneBot 实现(Lagrange.Core / go-cqhttp)已运行并暴露 WebSocket
35
- - 在 `openclaw.json` 中配置 `channels.onebot` 或通过 `LAGRANGE_WS_*` 环境变量
35
+ - 在 `openclaw.json` 中配置 `channels.onebot` 或通过 `ONEBOT_WS_*` 环境变量
36
36
 
37
37
  ## OneBot 协议能力
38
38
 
@@ -18,17 +18,17 @@
18
18
 
19
19
  运行 `openclaw onebot setup` 进行交互式配置。
20
20
 
21
- 配置写入 `openclaw.json` 的 `channels.onebot` 或通过 `LAGRANGE_WS_*` 环境变量提供。
21
+ 配置写入 `openclaw.json` 的 `channels.onebot` 或通过 `ONEBOT_WS_*` 环境变量提供。
22
22
 
23
23
  ## 环境变量
24
24
 
25
25
  | 变量 | 说明 |
26
26
  |------|------|
27
- | LAGRANGE_WS_TYPE | forward-websocket / backward-websocket |
28
- | LAGRANGE_WS_HOST | 主机地址 |
29
- | LAGRANGE_WS_PORT | 端口 |
30
- | LAGRANGE_WS_ACCESS_TOKEN | 访问令牌 |
31
- | LAGRANGE_WS_PATH | 反向 WS 路径 |
27
+ | ONEBOT_WS_TYPE | forward-websocket / backward-websocket |
28
+ | ONEBOT_WS_HOST | 主机地址 |
29
+ | ONEBOT_WS_PORT | 端口 |
30
+ | ONEBOT_WS_ACCESS_TOKEN | 访问令牌 |
31
+ | ONEBOT_WS_PATH | 反向 WS 路径 |
32
32
 
33
33
  ## cronJobs 配置
34
34