@cxyhhhhh/openclaw-qqbot 1.6.7-alpha.1

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.
Files changed (218) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +470 -0
  3. package/README.zh.md +465 -0
  4. package/bin/qqbot-cli.js +243 -0
  5. package/dist/index.d.ts +17 -0
  6. package/dist/index.js +26 -0
  7. package/dist/src/admin-resolver.d.ts +33 -0
  8. package/dist/src/admin-resolver.js +157 -0
  9. package/dist/src/api.d.ts +264 -0
  10. package/dist/src/api.js +777 -0
  11. package/dist/src/channel.d.ts +29 -0
  12. package/dist/src/channel.js +452 -0
  13. package/dist/src/config.d.ts +56 -0
  14. package/dist/src/config.js +278 -0
  15. package/dist/src/credential-backup.d.ts +31 -0
  16. package/dist/src/credential-backup.js +66 -0
  17. package/dist/src/deliver-debounce.d.ts +74 -0
  18. package/dist/src/deliver-debounce.js +174 -0
  19. package/dist/src/gateway.d.ts +18 -0
  20. package/dist/src/gateway.js +2021 -0
  21. package/dist/src/group-history.d.ts +136 -0
  22. package/dist/src/group-history.js +226 -0
  23. package/dist/src/image-server.d.ts +87 -0
  24. package/dist/src/image-server.js +570 -0
  25. package/dist/src/inbound-attachments.d.ts +60 -0
  26. package/dist/src/inbound-attachments.js +248 -0
  27. package/dist/src/known-users.d.ts +100 -0
  28. package/dist/src/known-users.js +263 -0
  29. package/dist/src/message-gating.d.ts +53 -0
  30. package/dist/src/message-gating.js +107 -0
  31. package/dist/src/message-queue.d.ts +86 -0
  32. package/dist/src/message-queue.js +257 -0
  33. package/dist/src/onboarding.d.ts +10 -0
  34. package/dist/src/onboarding.js +203 -0
  35. package/dist/src/outbound-deliver.d.ts +48 -0
  36. package/dist/src/outbound-deliver.js +392 -0
  37. package/dist/src/outbound.d.ts +205 -0
  38. package/dist/src/outbound.js +926 -0
  39. package/dist/src/proactive.d.ts +170 -0
  40. package/dist/src/proactive.js +399 -0
  41. package/dist/src/ref-index-store.d.ts +70 -0
  42. package/dist/src/ref-index-store.js +250 -0
  43. package/dist/src/reply-dispatcher.d.ts +35 -0
  44. package/dist/src/reply-dispatcher.js +311 -0
  45. package/dist/src/request-context.d.ts +18 -0
  46. package/dist/src/request-context.js +30 -0
  47. package/dist/src/runtime.d.ts +3 -0
  48. package/dist/src/runtime.js +10 -0
  49. package/dist/src/session-store.d.ts +52 -0
  50. package/dist/src/session-store.js +254 -0
  51. package/dist/src/slash-commands.d.ts +77 -0
  52. package/dist/src/slash-commands.js +1461 -0
  53. package/dist/src/startup-greeting.d.ts +30 -0
  54. package/dist/src/startup-greeting.js +97 -0
  55. package/dist/src/streaming.d.ts +250 -0
  56. package/dist/src/streaming.js +914 -0
  57. package/dist/src/stt.d.ts +21 -0
  58. package/dist/src/stt.js +70 -0
  59. package/dist/src/tools/channel.d.ts +16 -0
  60. package/dist/src/tools/channel.js +234 -0
  61. package/dist/src/tools/remind.d.ts +2 -0
  62. package/dist/src/tools/remind.js +248 -0
  63. package/dist/src/types.d.ts +364 -0
  64. package/dist/src/types.js +17 -0
  65. package/dist/src/typing-keepalive.d.ts +27 -0
  66. package/dist/src/typing-keepalive.js +64 -0
  67. package/dist/src/update-checker.d.ts +34 -0
  68. package/dist/src/update-checker.js +160 -0
  69. package/dist/src/utils/audio-convert.d.ts +98 -0
  70. package/dist/src/utils/audio-convert.js +755 -0
  71. package/dist/src/utils/chunked-upload.d.ts +59 -0
  72. package/dist/src/utils/chunked-upload.js +289 -0
  73. package/dist/src/utils/file-utils.d.ts +61 -0
  74. package/dist/src/utils/file-utils.js +172 -0
  75. package/dist/src/utils/image-size.d.ts +51 -0
  76. package/dist/src/utils/image-size.js +234 -0
  77. package/dist/src/utils/media-send.d.ts +148 -0
  78. package/dist/src/utils/media-send.js +456 -0
  79. package/dist/src/utils/media-tags.d.ts +14 -0
  80. package/dist/src/utils/media-tags.js +164 -0
  81. package/dist/src/utils/payload.d.ts +112 -0
  82. package/dist/src/utils/payload.js +186 -0
  83. package/dist/src/utils/pkg-version.d.ts +5 -0
  84. package/dist/src/utils/pkg-version.js +51 -0
  85. package/dist/src/utils/platform.d.ts +137 -0
  86. package/dist/src/utils/platform.js +390 -0
  87. package/dist/src/utils/ssrf-guard.d.ts +25 -0
  88. package/dist/src/utils/ssrf-guard.js +91 -0
  89. package/dist/src/utils/text-parsing.d.ts +32 -0
  90. package/dist/src/utils/text-parsing.js +69 -0
  91. package/dist/src/utils/upload-cache.d.ts +34 -0
  92. package/dist/src/utils/upload-cache.js +93 -0
  93. package/index.ts +31 -0
  94. package/node_modules/@eshaz/web-worker/LICENSE +201 -0
  95. package/node_modules/@eshaz/web-worker/README.md +134 -0
  96. package/node_modules/@eshaz/web-worker/browser.js +17 -0
  97. package/node_modules/@eshaz/web-worker/cjs/browser.js +16 -0
  98. package/node_modules/@eshaz/web-worker/cjs/node.js +219 -0
  99. package/node_modules/@eshaz/web-worker/index.d.ts +4 -0
  100. package/node_modules/@eshaz/web-worker/node.js +223 -0
  101. package/node_modules/@eshaz/web-worker/package.json +54 -0
  102. package/node_modules/@wasm-audio-decoders/common/index.js +5 -0
  103. package/node_modules/@wasm-audio-decoders/common/package.json +36 -0
  104. package/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderCommon.js +231 -0
  105. package/node_modules/@wasm-audio-decoders/common/src/WASMAudioDecoderWorker.js +129 -0
  106. package/node_modules/@wasm-audio-decoders/common/src/puff/README +67 -0
  107. package/node_modules/@wasm-audio-decoders/common/src/puff/build_puff.js +31 -0
  108. package/node_modules/@wasm-audio-decoders/common/src/puff/puff.c +863 -0
  109. package/node_modules/@wasm-audio-decoders/common/src/puff/puff.h +35 -0
  110. package/node_modules/@wasm-audio-decoders/common/src/utilities.js +3 -0
  111. package/node_modules/@wasm-audio-decoders/common/types.d.ts +7 -0
  112. package/node_modules/mpg123-decoder/README.md +265 -0
  113. package/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js +185 -0
  114. package/node_modules/mpg123-decoder/dist/mpg123-decoder.min.js.map +1 -0
  115. package/node_modules/mpg123-decoder/index.js +8 -0
  116. package/node_modules/mpg123-decoder/package.json +58 -0
  117. package/node_modules/mpg123-decoder/src/EmscriptenWasm.js +464 -0
  118. package/node_modules/mpg123-decoder/src/MPEGDecoder.js +200 -0
  119. package/node_modules/mpg123-decoder/src/MPEGDecoderWebWorker.js +21 -0
  120. package/node_modules/mpg123-decoder/types.d.ts +30 -0
  121. package/node_modules/silk-wasm/LICENSE +21 -0
  122. package/node_modules/silk-wasm/README.md +85 -0
  123. package/node_modules/silk-wasm/lib/index.cjs +16 -0
  124. package/node_modules/silk-wasm/lib/index.d.ts +70 -0
  125. package/node_modules/silk-wasm/lib/index.mjs +16 -0
  126. package/node_modules/silk-wasm/lib/silk.wasm +0 -0
  127. package/node_modules/silk-wasm/lib/utils.d.ts +4 -0
  128. package/node_modules/silk-wasm/package.json +39 -0
  129. package/node_modules/simple-yenc/.github/FUNDING.yml +1 -0
  130. package/node_modules/simple-yenc/.prettierignore +1 -0
  131. package/node_modules/simple-yenc/LICENSE +7 -0
  132. package/node_modules/simple-yenc/README.md +163 -0
  133. package/node_modules/simple-yenc/dist/esm.js +1 -0
  134. package/node_modules/simple-yenc/dist/index.js +1 -0
  135. package/node_modules/simple-yenc/package.json +50 -0
  136. package/node_modules/simple-yenc/rollup.config.js +27 -0
  137. package/node_modules/simple-yenc/src/simple-yenc.js +302 -0
  138. package/node_modules/ws/LICENSE +20 -0
  139. package/node_modules/ws/README.md +548 -0
  140. package/node_modules/ws/browser.js +8 -0
  141. package/node_modules/ws/index.js +13 -0
  142. package/node_modules/ws/lib/buffer-util.js +131 -0
  143. package/node_modules/ws/lib/constants.js +19 -0
  144. package/node_modules/ws/lib/event-target.js +292 -0
  145. package/node_modules/ws/lib/extension.js +203 -0
  146. package/node_modules/ws/lib/limiter.js +55 -0
  147. package/node_modules/ws/lib/permessage-deflate.js +528 -0
  148. package/node_modules/ws/lib/receiver.js +706 -0
  149. package/node_modules/ws/lib/sender.js +602 -0
  150. package/node_modules/ws/lib/stream.js +161 -0
  151. package/node_modules/ws/lib/subprotocol.js +62 -0
  152. package/node_modules/ws/lib/validation.js +152 -0
  153. package/node_modules/ws/lib/websocket-server.js +554 -0
  154. package/node_modules/ws/lib/websocket.js +1393 -0
  155. package/node_modules/ws/package.json +69 -0
  156. package/node_modules/ws/wrapper.mjs +8 -0
  157. package/openclaw.plugin.json +17 -0
  158. package/package.json +67 -0
  159. package/preload.cjs +33 -0
  160. package/scripts/cleanup-legacy-plugins.sh +124 -0
  161. package/scripts/link-sdk-core.cjs +185 -0
  162. package/scripts/postinstall-link-sdk.js +113 -0
  163. package/scripts/proactive-api-server.ts +369 -0
  164. package/scripts/send-proactive.ts +293 -0
  165. package/scripts/set-markdown.sh +156 -0
  166. package/scripts/test-sendmedia.ts +116 -0
  167. package/scripts/upgrade-via-npm.ps1 +451 -0
  168. package/scripts/upgrade-via-npm.sh +528 -0
  169. package/scripts/upgrade-via-source.sh +916 -0
  170. package/skills/qqbot-channel/SKILL.md +263 -0
  171. package/skills/qqbot-channel/references/api_references.md +521 -0
  172. package/skills/qqbot-media/SKILL.md +60 -0
  173. package/skills/qqbot-remind/SKILL.md +149 -0
  174. package/src/admin-resolver.ts +181 -0
  175. package/src/api.ts +1138 -0
  176. package/src/channel.ts +477 -0
  177. package/src/config.ts +347 -0
  178. package/src/credential-backup.ts +72 -0
  179. package/src/deliver-debounce.ts +229 -0
  180. package/src/gateway.ts +2257 -0
  181. package/src/group-history.ts +328 -0
  182. package/src/image-server.ts +675 -0
  183. package/src/inbound-attachments.ts +321 -0
  184. package/src/known-users.ts +353 -0
  185. package/src/message-gating.ts +190 -0
  186. package/src/message-queue.ts +349 -0
  187. package/src/onboarding.ts +274 -0
  188. package/src/openclaw-plugin-sdk.d.ts +587 -0
  189. package/src/outbound-deliver.ts +473 -0
  190. package/src/outbound.ts +1119 -0
  191. package/src/proactive.ts +530 -0
  192. package/src/ref-index-store.ts +335 -0
  193. package/src/reply-dispatcher.ts +334 -0
  194. package/src/request-context.ts +39 -0
  195. package/src/runtime.ts +14 -0
  196. package/src/session-store.ts +303 -0
  197. package/src/slash-commands.ts +1615 -0
  198. package/src/startup-greeting.ts +120 -0
  199. package/src/streaming.ts +1102 -0
  200. package/src/stt.ts +86 -0
  201. package/src/tools/channel.ts +281 -0
  202. package/src/tools/remind.ts +300 -0
  203. package/src/types.ts +386 -0
  204. package/src/typing-keepalive.ts +59 -0
  205. package/src/update-checker.ts +174 -0
  206. package/src/utils/audio-convert.ts +859 -0
  207. package/src/utils/chunked-upload.ts +419 -0
  208. package/src/utils/file-utils.ts +193 -0
  209. package/src/utils/image-size.ts +266 -0
  210. package/src/utils/media-send.ts +585 -0
  211. package/src/utils/media-tags.ts +182 -0
  212. package/src/utils/payload.ts +265 -0
  213. package/src/utils/pkg-version.ts +54 -0
  214. package/src/utils/platform.ts +435 -0
  215. package/src/utils/ssrf-guard.ts +102 -0
  216. package/src/utils/text-parsing.ts +75 -0
  217. package/src/utils/upload-cache.ts +128 -0
  218. package/tsconfig.json +16 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sliverp
4
+ Copyright (c) 2026 Tencent Connect
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,470 @@
1
+ <div align="center">
2
+
3
+
4
+
5
+ <img width="120" src="https://img.shields.io/badge/🤖-QQ_Bot-blue?style=for-the-badge" alt="QQ Bot" />
6
+
7
+ # QQ Bot Channel Plugin for OpenClaw
8
+
9
+
10
+
11
+ **Connect your AI assistant to QQ — private chat, group chat, and rich media, all in one plugin.**
12
+
13
+ ### 🚀 Current Version: `v1.6.5`
14
+
15
+ [![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
16
+ [![QQ Bot](https://img.shields.io/badge/QQ_Bot-API_v2-red)](https://bot.q.qq.com/wiki/)
17
+ [![Platform](https://img.shields.io/badge/platform-OpenClaw-orange)](https://github.com/tencent-connect/openclaw-qqbot)
18
+ [![Node.js](https://img.shields.io/badge/Node.js->=18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
19
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
20
+
21
+
22
+ <br/>
23
+
24
+ **[简体中文](README.zh.md) | English**
25
+
26
+ Scan to join the QQ group chat
27
+
28
+ <img width="400" alt="QQ QR Code" src="./docs/images/developer_group.png" />
29
+
30
+
31
+ </div>
32
+
33
+ ---
34
+
35
+ ## ✨ Features
36
+
37
+ | Feature | Description |
38
+ |---------|-------------|
39
+ | 🔒 **Multi-Scene** | C2C private chat, group @messages |
40
+ | 🖼️ **Rich Media** | Send & receive images, voice, video, and files |
41
+ | 🎙️ **Voice (STT/TTS)** | Speech-to-text transcription & text-to-speech replies |
42
+ | 🔥 **One-Click Hot Upgrade** | Send `/bot-upgrade` in private chat to upgrade — no server login needed |
43
+ | ⏰ **Scheduled Push** | Proactive message delivery via scheduled tasks |
44
+ | 🔗 **URL Support** | Direct URL sending in private chat (no restrictions) |
45
+ | ⌨️ **Typing Indicator** | "Bot is typing..." status shown in real-time |
46
+ | 📝 **Markdown** | Full Markdown formatting support |
47
+ | 🛠️ **Commands** | Native OpenClaw command integration |
48
+ | 💬 **Quoted Context** | Resolve QQ `REFIDX_*` quoted messages and inject quote body into AI context |
49
+
50
+ ---
51
+
52
+ ## 📸 Feature Showcase
53
+
54
+ > **Note:** This plugin serves as a **message channel** only — it relays messages between QQ and OpenClaw. Capabilities like image understanding, voice transcription, drawing, etc. depend on the **AI model** you configure and the **skills** installed in OpenClaw, not on this plugin itself.
55
+
56
+ ### 💬 Quoted Message Context (REFIDX)
57
+
58
+ QQ quote events carry index keys (e.g. `REFIDX_xxx`) instead of full original message body. The plugin now resolves these indices from a local persistent store and injects quote context into AI input, so replies better understand “which message is being quoted”.
59
+
60
+ - Inbound and outbound messages with `ref_idx` are automatically indexed.
61
+ - Store path: `~/.openclaw/qqbot/data/ref-index.jsonl` (survives gateway restart).
62
+ - Quote body may include text + media summary (image/voice/video/file).
63
+
64
+ <img width="360" src="docs/images/ref_msg.png" alt="Quoted Message Context Demo" />
65
+
66
+ ### 🎙️ Voice Messages (STT)
67
+
68
+ With STT configured, the plugin automatically transcribes voice messages to text before passing them to AI. The whole process is transparent to the user — sending voice feels as natural as sending text.
69
+
70
+ > **You**: *(send a voice message)* "What's the weather like tomorrow in Shenzhen?"
71
+ >
72
+ > **QQBot**: Tomorrow (March 7, Saturday) Shenzhen weather forecast 🌤️ ...
73
+
74
+ <img width="360" src="docs/images/fc7b2236896cfba3a37c94be5d59ce3e_720.jpg" alt="Voice STT Demo" />
75
+
76
+ ### 📄 File Understanding
77
+
78
+ Send any file to the bot — novels, reports, spreadsheets — AI automatically recognizes the content and gives an intelligent reply.
79
+
80
+ > **You**: *(send a TXT file of "War and Peace")*
81
+ >
82
+ > **QQBot**: Got it! You uploaded the Chinese version of "War and Peace" by Leo Tolstoy. This appears to be the opening of Chapter 1...
83
+
84
+ <img width="360" src="docs/images/07bff56ab68e03173d2af586eeb3bcee_720.jpg" alt="File Understanding Demo" />
85
+
86
+ ### 🖼️ Image Understanding
87
+
88
+ If your main model supports vision (e.g. Tencent Hunyuan `hunyuan-vision`), AI can understand images too. This is a general multimodal capability, not plugin-specific.
89
+
90
+ > **You**: *(send an image)*
91
+ >
92
+ > **QQBot**: Haha, so cute! Is that a QQ penguin in a lobster costume? 🦞🐧 ...
93
+
94
+ <img width="360" src="docs/images/59d421891f813b0d3c0cbe12574b6a72_720.jpg" alt="Image Understanding Demo" />
95
+
96
+ ### 🎨 Image Sending
97
+
98
+ > **You**: Draw me a cat
99
+ >
100
+ > **QQBot**: Here you go! 🐱
101
+
102
+ AI can send images directly. Supports local paths and URLs. Formats: jpg/png/gif/webp/bmp.
103
+
104
+ <img width="360" src="docs/images/4645f2b3a20822b7f8d6664a708529eb_720.jpg" alt="Image Generation Demo" />
105
+
106
+ ### 🔊 Voice Sending
107
+
108
+ > **You**: Tell me a joke in voice
109
+ >
110
+ > **QQBot**: *(sends a voice message)*
111
+
112
+ AI can send voice messages directly. Formats: mp3/wav/silk/ogg. No ffmpeg required.
113
+
114
+ <img width="360" src="docs/images/21dce8bfc553ce23d1bd1b270e9c516c.jpg" alt="TTS Voice Demo" />
115
+
116
+ ### ⏰ Scheduled Reminder (Proactive Message)
117
+
118
+ > **You**: Remind me to eat in 5 minutes
119
+ >
120
+ > **QQBot**: confirms the reminder first, then proactively sends a voice + text reminder when time is up
121
+
122
+ This capability depends on OpenClaw cron scheduling and proactive messaging. If no reminder arrives, a common reason is QQ-side interception of bot proactive messages.
123
+
124
+ <img width="360" src="docs/images/reminder.jpg" alt="Scheduled Reminder Demo" />
125
+
126
+ ### 📎 File Sending
127
+
128
+ > **You**: Extract chapter 1 of War and Peace and send it as a file
129
+ >
130
+ > **QQBot**: *(sends a .txt file)*
131
+
132
+ AI can send files directly. Any format, up to 20MB.
133
+
134
+ <img width="360" src="docs/images/17cada70df90185d45a2d6dd36e92f2f_720.jpg" alt="File Sending Demo" />
135
+
136
+ ### 🎬 Video Sending
137
+
138
+ > **You**: Send me a demo video
139
+ >
140
+ > **QQBot**: *(sends a video)*
141
+
142
+ AI can send videos directly. Supports local files and URLs.
143
+
144
+ <img width="360" src="docs/images/85d03b8a216f267ab7b2aee248a18a41_720.jpg" alt="Video Sending Demo" />
145
+
146
+ > **Under the hood:** Upload dedup caching, ordered queue delivery, and multi-layer audio format fallback.
147
+
148
+ ### 🛠️ Slash Commands
149
+
150
+ The plugin provides built-in slash commands that are intercepted before reaching the AI queue, giving instant responses for diagnostics and management.
151
+
152
+ #### `/bot-ping` — Latency Test
153
+
154
+ > **You**: `/bot-ping`
155
+ >
156
+ > **QQBot**: ✅ pong!⏱ Latency: 602ms (network: 602ms, plugin: 0ms)
157
+
158
+ Measures end-to-end latency from QQ server push to plugin response, broken down into network transport and plugin processing time.
159
+
160
+ <img width="360" src="docs/images/slash-ping.jpg" alt="Ping Demo" />
161
+
162
+ #### `/bot-version` — Version Info
163
+
164
+ > **You**: `/bot-version`
165
+ >
166
+ > **QQBot**: 🦞 Framework: OpenClaw 2026.3.13 (61d171a) / 🤖 Plugin: v1.6.3 / 🌟 GitHub repo
167
+
168
+ Shows framework version, plugin version, and a direct link to the official repository.
169
+
170
+ <img width="360" src="docs/images/slash-version.jpg" alt="Version Demo" />
171
+
172
+ #### `/bot-help` — Command List
173
+
174
+ > **You**: `/bot-help`
175
+ >
176
+ > **QQBot**: Lists all available slash commands with clickable shortcuts.
177
+
178
+ <img width="360" src="docs/images/slash-help.jpg" alt="Help Demo" />
179
+
180
+ #### `/bot-upgrade` — One-Click Hot Upgrade
181
+
182
+ > **You**: `/bot-upgrade`
183
+ >
184
+ > **QQBot**: 📌 Current: v1.6.3 / ✅ New version v1.6.4 available / Click button below to confirm
185
+
186
+ Credentials are automatically backed up before upgrade. Version existence is verified against npm before proceeding. Auto-recovery on failure.
187
+
188
+ > ⚠️ Hot upgrade is currently not supported on Windows. Sending `/bot-upgrade` on Windows will return a manual upgrade guide instead.
189
+
190
+ <img width="360" src="docs/images/hot-update.jpg" alt="Hot Upgrade Demo" />
191
+
192
+ #### `/bot-logs` — Log Export
193
+
194
+ > **You**: `/bot-logs`
195
+ >
196
+ > **QQBot**: 📋 Logs packaged (~2000 lines), sending file... *(sends a .txt file)*
197
+
198
+ Exports the last ~2000 lines of gateway logs as a file for quick troubleshooting.
199
+
200
+ <img width="360" src="docs/images/slash-logs.jpg" alt="Logs Demo" />
201
+
202
+ #### Usage Help
203
+
204
+ All commands support a `?` suffix to show usage:
205
+
206
+ > **You**: `/bot-upgrade ?`
207
+ >
208
+ > **QQBot**: 📖 /bot-upgrade usage: …
209
+
210
+ ---
211
+
212
+ ## 🚀 Getting Started
213
+
214
+ ### Step 1 — Create a QQ Bot on the QQ Open Platform
215
+
216
+ 1. Go to the [QQ Open Platform](https://q.qq.com/) and **scan the QR code with your phone QQ** to register / log in. If you haven't registered before, scanning will automatically complete the registration and bind your QQ account.
217
+
218
+ <img width="3246" height="1886" alt="Clipboard_Screenshot_1772980354" src="https://github.com/user-attachments/assets/d8491859-57e8-47e4-9d39-b21138be54d0" />
219
+
220
+ 2. After scanning, tap **Agree** on your phone — you'll land on the bot configuration page.
221
+ 3. Click **Create Bot** to create a new QQ bot.
222
+
223
+ <img width="720" alt="Create Bot" src="docs/images/create_robot.png" />
224
+
225
+ > ⚠️ The bot will automatically appear in your QQ message list and send a first message. However, it will reply "The bot has gone to Mars" until you complete the configuration steps below.
226
+
227
+ <img width="400" alt="Bot Say Hello" src="docs/images/bot_say_hello.jpg" />
228
+
229
+ 4. Find **AppID** and **AppSecret** on the bot's page, click **Copy** for each, and save them somewhere safe (e.g., a notepad). **AppSecret is not stored in plaintext — if you leave the page without saving it, you'll have to regenerate a new one.**
230
+
231
+ <img width="720" alt="Find AppID and AppSecret" src="docs/images/find_appid_secret.png" />
232
+
233
+ > For a step-by-step walkthrough with screenshots, see the [official guide](https://cloud.tencent.com/developer/article/2626045).
234
+
235
+ ### Step 2 — Install / Upgrade the Plugin
236
+
237
+ **Option A: Remote One-Liner (Easiest, no clone required)**
238
+
239
+ ```bash
240
+ curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh \
241
+ | bash -s -- --appid YOUR_APPID --secret YOUR_SECRET
242
+ ```
243
+
244
+ One command does it all: download script → cleanup old plugins → install → configure channel → restart service. Once done, open QQ and start chatting!
245
+
246
+ > `--appid` and `--secret` are **required for first-time install**. For subsequent upgrades:
247
+ > ```bash
248
+ > curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh | bash
249
+ > ```
250
+
251
+ **Option B: Local Script (if you've cloned the repo)**
252
+
253
+ ```bash
254
+ # Via npm
255
+ bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
256
+
257
+ # Or via source
258
+ bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
259
+ ```
260
+
261
+ **Common flags:**
262
+
263
+ | Flag | Description |
264
+ |------|-------------|
265
+ | `--appid <id> --secret <secret>` | Configure channel (required for first install, or to change credentials) |
266
+ | `--version <version>` | Install a specific version (npm script only) |
267
+ | `--self-version` | Install the version from local `package.json` (npm script only) |
268
+ | `-h` / `--help` | Show full usage |
269
+
270
+ > Environment variables `QQBOT_APPID` / `QQBOT_SECRET` are also supported.
271
+
272
+ **Option C: Manual Install / Upgrade**
273
+
274
+ ```bash
275
+ # Uninstall old plugins (skip if first install)
276
+ openclaw plugins uninstall qqbot
277
+ openclaw plugins uninstall openclaw-qqbot
278
+
279
+ # Install latest
280
+ openclaw plugins install @tencent-connect/openclaw-qqbot@latest
281
+
282
+ # Configure channel (first install only)
283
+ openclaw channels add --channel qqbot --token "AppID:AppSecret"
284
+
285
+ # Start / restart
286
+ openclaw gateway restart
287
+ ```
288
+
289
+ ### Step 3 — Test
290
+
291
+ Open QQ, find your bot, and send a message!
292
+
293
+ <div align="center">
294
+ <img width="500" alt="Chat Demo" src="https://github.com/user-attachments/assets/b2776c8b-de72-4e37-b34d-e8287ce45de1" />
295
+ </div>
296
+
297
+ ---
298
+
299
+ ## ⚙️ Advanced Configuration
300
+
301
+ ### Multi-Account Setup (Multi-Bot)
302
+
303
+ Run multiple QQ bots under a single OpenClaw instance.
304
+
305
+ #### Configuration
306
+
307
+ Edit `~/.openclaw/openclaw.json` and add an `accounts` field under `channels.qqbot`:
308
+
309
+ ```json
310
+ {
311
+ "channels": {
312
+ "qqbot": {
313
+ "enabled": true,
314
+ "appId": "111111111",
315
+ "clientSecret": "secret-of-bot-1",
316
+
317
+ "accounts": {
318
+ "bot2": {
319
+ "enabled": true,
320
+ "appId": "222222222",
321
+ "clientSecret": "secret-of-bot-2"
322
+ },
323
+ "bot3": {
324
+ "enabled": true,
325
+ "appId": "333333333",
326
+ "clientSecret": "secret-of-bot-3"
327
+ }
328
+ }
329
+ }
330
+ }
331
+ }
332
+ ```
333
+
334
+ **Notes:**
335
+
336
+ - The top-level `appId` / `clientSecret` is the **default account** (accountId = `"default"`)
337
+ - Each key under `accounts` (e.g. `bot2`, `bot3`) is the `accountId` for that bot
338
+ - Each account can independently configure `enabled`, `name`, `allowFrom`, `systemPrompt`, etc.
339
+ - You may also skip the top-level default account and only configure bots inside `accounts`
340
+
341
+ Add a second bot via CLI (if the framework supports the `--account` parameter):
342
+
343
+ ```bash
344
+ openclaw channels add --channel qqbot --account bot2 --token "222222222:secret-of-bot-2"
345
+ ```
346
+
347
+ #### Sending Messages to a Specific Account's Users
348
+
349
+ When using `openclaw message send`, specify which bot to use with the `--account` parameter:
350
+
351
+ ```bash
352
+ # Send with the default bot (no --account = uses "default")
353
+ openclaw message send --channel "qqbot" \
354
+ --target "qqbot:c2c:OPENID" \
355
+ --message "hello from default bot"
356
+
357
+ # Send with bot2
358
+ openclaw message send --channel "qqbot" \
359
+ --account bot2 \
360
+ --target "qqbot:c2c:OPENID" \
361
+ --message "hello from bot2"
362
+ ```
363
+
364
+ **Target Formats:**
365
+
366
+ | Format | Description |
367
+ |--------|-------------|
368
+ | `qqbot:c2c:OPENID` | Private chat (C2C) |
369
+ | `qqbot:group:GROUP_OPENID` | Group chat |
370
+ | `qqbot:channel:CHANNEL_ID` | Guild channel |
371
+
372
+ > ⚠️ **Important**: Each bot has its own set of user OpenIDs. An OpenID received by Bot A **cannot** be used to send messages via Bot B — this will result in a 500 error. Always use the matching bot's `accountId` to send messages to its users.
373
+
374
+ #### How It Works
375
+
376
+ - When `openclaw gateway` starts, all accounts with `enabled: true` launch their own WebSocket connections
377
+ - Each account maintains an independent Token cache (isolated by `appId`), preventing cross-contamination
378
+ - Incoming message logs are prefixed with `[qqbot:accountId]` for easy debugging
379
+
380
+ ---
381
+
382
+ ### Voice Configuration (STT / TTS)
383
+
384
+ #### STT (Speech-to-Text) — Transcribe Incoming Voice Messages
385
+
386
+ STT supports two-level configuration with priority fallback:
387
+
388
+ | Priority | Config Path | Scope |
389
+ |----------|------------|-------|
390
+ | 1 (highest) | `channels.qqbot.stt` | Plugin-specific |
391
+ | 2 (fallback) | `tools.media.audio.models[0]` | Framework-level |
392
+
393
+ ```json
394
+ {
395
+ "channels": {
396
+ "qqbot": {
397
+ "stt": {
398
+ "provider": "your-provider",
399
+ "model": "your-stt-model"
400
+ }
401
+ }
402
+ }
403
+ }
404
+ ```
405
+
406
+ - `provider` — references a key in `models.providers` to inherit `baseUrl` and `apiKey`
407
+ - Set `enabled: false` to disable
408
+ - When configured, incoming voice messages are automatically converted (SILK→WAV) and transcribed
409
+
410
+ #### TTS (Text-to-Speech) — Send Voice Messages
411
+
412
+ | Priority | Config Path | Scope |
413
+ |----------|------------|-------|
414
+ | 1 (highest) | `channels.qqbot.tts` | Plugin-specific |
415
+ | 2 (fallback) | `messages.tts` | Framework-level |
416
+
417
+ ```json
418
+ {
419
+ "channels": {
420
+ "qqbot": {
421
+ "tts": {
422
+ "provider": "your-provider",
423
+ "model": "your-tts-model",
424
+ "voice": "your-voice"
425
+ }
426
+ }
427
+ }
428
+ }
429
+ ```
430
+
431
+ - `provider` — references a key in `models.providers` to inherit `baseUrl` and `apiKey`
432
+ - `voice` — voice variant
433
+ - Set `enabled: false` to disable (default: `true`)
434
+ - When configured, AI can generate and send voice messages
435
+
436
+ ---
437
+
438
+ ## 📚 Documentation & Links
439
+
440
+ - [Upgrade Guide](docs/UPGRADE_GUIDE.md) — full upgrade paths and migration notes
441
+ - [Command Reference](docs/commands.md) — OpenClaw CLI commands
442
+ - [Changelog](CHANGELOG.md) — release notes
443
+
444
+ ## 🤝 Contributors
445
+
446
+ Thanks to all the developers who have contributed to this project!
447
+
448
+ <a href="https://github.com/tencent-connect/openclaw-qqbot/graphs/contributors">
449
+ <img src="https://contrib.rocks/image?repo=tencent-connect/openclaw-qqbot" />
450
+ </a>
451
+
452
+ ## 💖 Acknowledgements
453
+
454
+ Special thanks to [@sliverp](https://github.com/sliverp) for outstanding contributions to the project!
455
+
456
+ <a href="https://github.com/sliverp"><img src="https://avatars.githubusercontent.com/u/38134380?v=4" width="48" height="48" alt="sliverp" title="sliverp"/></a>
457
+
458
+ Thanks to [Tencent Cloud Lighthouse](https://cloud.tencent.com/product/lighthouse) for the deep collaboration. For raising crawfish, choose Tencent Cloud Lighthouse!
459
+
460
+ <a href="https://cloud.tencent.com/product/lighthouse">
461
+ <img alt="Tencent Cloud Lighthouse" src="./docs/images/lighthouse_head.png" height="500" style="max-width:80%; height:auto;"/>
462
+ </a>
463
+
464
+ ## ⭐ Star History
465
+
466
+ <div align="center">
467
+
468
+ [![Star History Chart](https://api.star-history.com/svg?repos=tencent-connect/openclaw-qqbot&type=date&legend=top-left)](https://www.star-history.com/#tencent-connect/openclaw-qqbot&type=date&legend=top-left)
469
+
470
+ </div>