@kookapp/clawdbot-plugin 1.0.0
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/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/index.js +4428 -0
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.js +15 -0
- package/index.js.map +1 -0
- package/package.json +47 -0
- package/src/channel.ts +746 -0
- package/src/clawdbot.plugin.json +11 -0
- package/src/index.ts +18 -0
- package/src/plugin-sdk.d.ts +78 -0
- package/src/runtime.ts +14 -0
- package/tsconfig.json +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Xiaolong Dong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# clawdbot-kook
|
|
2
|
+
|
|
3
|
+
Kook 聊天平台的 Clawdbot 通道插件。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
### 方式一:从 npm 安装(推荐)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install clawdbot-kook
|
|
11
|
+
# 或
|
|
12
|
+
yarn add clawdbot-kook
|
|
13
|
+
# 或
|
|
14
|
+
pnpm add clawdbot-kook
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
然后复制到 Clawdbot 扩展目录:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 全局安装
|
|
21
|
+
mkdir -p ~/.clawdbot/extensions/kook
|
|
22
|
+
cp -r node_modules/clawdbot-kook/* ~/.clawdbot/extensions/kook/
|
|
23
|
+
|
|
24
|
+
# 或在工作区安装
|
|
25
|
+
mkdir -p /path/to/your/workspace/.clawdbot/extensions/kook
|
|
26
|
+
cp -r node_modules/clawdbot-kook/* /path/to/your/workspace/.clawdbot/extensions/kook/
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 方式二:克隆并链接(开发模式)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 克隆仓库
|
|
33
|
+
git clone https://github.com/clawdbot/kook.git
|
|
34
|
+
cd kook
|
|
35
|
+
|
|
36
|
+
# 安装依赖
|
|
37
|
+
npm install
|
|
38
|
+
|
|
39
|
+
# 构建
|
|
40
|
+
npm run build
|
|
41
|
+
|
|
42
|
+
# 链接到 Clawdbot
|
|
43
|
+
mkdir -p ~/.clawdbot/extensions/kook
|
|
44
|
+
cp -r dist/* ~/.clawdbot/extensions/kook/
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 配置
|
|
48
|
+
|
|
49
|
+
在 Clawdbot 配置文件 (`~/.clawdbot/clawdbot.json`) 中添加:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"channels": {
|
|
54
|
+
"kook": {
|
|
55
|
+
"enabled": true,
|
|
56
|
+
"token": "你的机器人Token"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
机器人 Token 获取:https://developer.kookapp.cn/bot/
|
|
63
|
+
|
|
64
|
+
## 重启 Clawdbot
|
|
65
|
+
|
|
66
|
+
安装和配置完成后:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
clawdbot gateway restart
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 使用
|
|
73
|
+
|
|
74
|
+
配置完成后,Clawdbot 将自动:
|
|
75
|
+
- 通过 WebSocket 连接到 Kook
|
|
76
|
+
- 监听频道和私聊消息
|
|
77
|
+
- 将回复发送回 Kook
|
|
78
|
+
|
|
79
|
+
## 开发
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# 安装依赖
|
|
83
|
+
npm install
|
|
84
|
+
|
|
85
|
+
# 构建
|
|
86
|
+
npm run build
|
|
87
|
+
|
|
88
|
+
# 监听模式
|
|
89
|
+
npm run dev
|
|
90
|
+
|
|
91
|
+
# 构建后复制到 Clawdbot 测试
|
|
92
|
+
cp -r dist/* ~/.clawdbot/extensions/kook/
|
|
93
|
+
clawdbot gateway restart
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 发布到 npm
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 更新 package.json 中的版本号
|
|
100
|
+
# 登录 npm
|
|
101
|
+
npm login
|
|
102
|
+
|
|
103
|
+
# 发布
|
|
104
|
+
npm publish
|
|
105
|
+
|
|
106
|
+
# 或发布测试版本
|
|
107
|
+
npm publish --tag beta
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 目录结构
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
clawdbot-kook/
|
|
114
|
+
├── src/
|
|
115
|
+
│ ├── index.ts # 插件入口
|
|
116
|
+
│ ├── channel.ts # 核心通道实现
|
|
117
|
+
│ ├── runtime.ts # 运行时工具
|
|
118
|
+
│ └── plugin-sdk.d.ts # 类型声明
|
|
119
|
+
├── dist/ # 构建输出
|
|
120
|
+
├── package.json
|
|
121
|
+
├── tsconfig.json
|
|
122
|
+
├── README.md
|
|
123
|
+
└── LICENSE
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|