@tencent-connect/openclaw-qqbot 1.6.4-alpha.7 → 1.6.4-alpha.8

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.
@@ -65,6 +65,12 @@ function registerCommand(cmd) {
65
65
  registerCommand({
66
66
  name: "bot-ping",
67
67
  description: "测试当前 openclaw 与 QQ 连接的网络延迟",
68
+ usage: [
69
+ `/bot-ping`,
70
+ ``,
71
+ `测试 OpenClaw 主机与 QQ 服务器之间的网络延迟。`,
72
+ `返回网络传输耗时和插件处理耗时。`,
73
+ ].join("\n"),
68
74
  handler: (ctx) => {
69
75
  const now = Date.now();
70
76
  const eventTime = new Date(ctx.eventTimestamp).getTime();
@@ -90,6 +96,12 @@ registerCommand({
90
96
  registerCommand({
91
97
  name: "bot-version",
92
98
  description: "查看插件版本号",
99
+ usage: [
100
+ `/bot-version`,
101
+ ``,
102
+ `查看当前 QQBot 插件版本和 OpenClaw 框架版本。`,
103
+ `同时检查是否有新版本可用。`,
104
+ ].join("\n"),
93
105
  handler: () => {
94
106
  const frameworkVersion = getFrameworkVersion();
95
107
  const lines = [
@@ -116,6 +128,12 @@ registerCommand({
116
128
  registerCommand({
117
129
  name: "bot-help",
118
130
  description: "查看所有指令以及用途",
131
+ usage: [
132
+ `/bot-help`,
133
+ ``,
134
+ `列出所有可用的 QQBot 插件内置指令及其简要说明。`,
135
+ `使用 /指令名 ? 可查看某条指令的详细用法。`,
136
+ ].join("\n"),
119
137
  handler: () => {
120
138
  const lines = [`### QQBot插件内置调试指令`, ``];
121
139
  for (const [name, cmd] of commands) {
@@ -270,6 +288,14 @@ let _upgrading = false; // 升级锁
270
288
  registerCommand({
271
289
  name: "bot-upgrade",
272
290
  description: "检查更新并自动热更(失败则返回升级指引)",
291
+ usage: [
292
+ `/bot-upgrade 检查是否有新版本(展示信息+确认按钮)`,
293
+ `/bot-upgrade --latest 确认升级到最新版本`,
294
+ `/bot-upgrade --version X 升级到指定版本(如 1.6.4-alpha.7)`,
295
+ `/bot-upgrade --force 强制重新安装当前版本`,
296
+ ``,
297
+ `⚠️ 仅在私聊中可用。升级过程约 30~60 秒,期间服务短暂不可用。`,
298
+ ].join("\n"),
273
299
  handler: async (ctx) => {
274
300
  // 升级相关指令仅在私聊中可用
275
301
  if (ctx.type !== "c2c") {
@@ -507,6 +533,12 @@ function collectRecentLogFiles(logDirs) {
507
533
  registerCommand({
508
534
  name: "bot-logs",
509
535
  description: "导出本地日志文件",
536
+ usage: [
537
+ `/bot-logs`,
538
+ ``,
539
+ `导出最近的 OpenClaw 日志文件(最多 4 个)。`,
540
+ `每个文件最多保留最后 1000 行,以文件形式返回。`,
541
+ ].join("\n"),
510
542
  handler: () => {
511
543
  const logDirs = collectCandidateLogDirs();
512
544
  const recentFiles = collectRecentLogFiles(logDirs).slice(0, 4);
@@ -577,6 +609,13 @@ export async function matchSlashCommand(ctx) {
577
609
  const cmd = commands.get(cmdName);
578
610
  if (!cmd)
579
611
  return null; // 不是插件级指令,交给框架
612
+ // /指令 ? — 返回用法说明
613
+ if (args === "?") {
614
+ if (cmd.usage) {
615
+ return `📖 /${cmd.name} 用法:\n\n${cmd.usage}`;
616
+ }
617
+ return `/${cmd.name} — ${cmd.description}`;
618
+ }
580
619
  ctx.args = args;
581
620
  const result = await cmd.handler(ctx);
582
621
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-connect/openclaw-qqbot",
3
- "version": "1.6.4-alpha.7",
3
+ "version": "1.6.4-alpha.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -116,6 +116,8 @@ interface SlashCommand {
116
116
  name: string;
117
117
  /** 简要描述 */
118
118
  description: string;
119
+ /** 详细用法说明(支持多行),用于 /指令 ? 查询 */
120
+ usage?: string;
119
121
  /** 处理函数 */
120
122
  handler: (ctx: SlashCommandContext) => SlashCommandResult | Promise<SlashCommandResult>;
121
123
  }
@@ -136,6 +138,12 @@ function registerCommand(cmd: SlashCommand): void {
136
138
  registerCommand({
137
139
  name: "bot-ping",
138
140
  description: "测试当前 openclaw 与 QQ 连接的网络延迟",
141
+ usage: [
142
+ `/bot-ping`,
143
+ ``,
144
+ `测试 OpenClaw 主机与 QQ 服务器之间的网络延迟。`,
145
+ `返回网络传输耗时和插件处理耗时。`,
146
+ ].join("\n"),
139
147
  handler: (ctx) => {
140
148
  const now = Date.now();
141
149
  const eventTime = new Date(ctx.eventTimestamp).getTime();
@@ -162,6 +170,12 @@ registerCommand({
162
170
  registerCommand({
163
171
  name: "bot-version",
164
172
  description: "查看插件版本号",
173
+ usage: [
174
+ `/bot-version`,
175
+ ``,
176
+ `查看当前 QQBot 插件版本和 OpenClaw 框架版本。`,
177
+ `同时检查是否有新版本可用。`,
178
+ ].join("\n"),
165
179
  handler: () => {
166
180
  const frameworkVersion = getFrameworkVersion();
167
181
  const lines = [
@@ -187,6 +201,12 @@ registerCommand({
187
201
  registerCommand({
188
202
  name: "bot-help",
189
203
  description: "查看所有指令以及用途",
204
+ usage: [
205
+ `/bot-help`,
206
+ ``,
207
+ `列出所有可用的 QQBot 插件内置指令及其简要说明。`,
208
+ `使用 /指令名 ? 可查看某条指令的详细用法。`,
209
+ ].join("\n"),
190
210
  handler: () => {
191
211
  const lines = [`### QQBot插件内置调试指令`, ``];
192
212
  for (const [name, cmd] of commands) {
@@ -359,6 +379,14 @@ let _upgrading = false; // 升级锁
359
379
  registerCommand({
360
380
  name: "bot-upgrade",
361
381
  description: "检查更新并自动热更(失败则返回升级指引)",
382
+ usage: [
383
+ `/bot-upgrade 检查是否有新版本(展示信息+确认按钮)`,
384
+ `/bot-upgrade --latest 确认升级到最新版本`,
385
+ `/bot-upgrade --version X 升级到指定版本(如 1.6.4-alpha.7)`,
386
+ `/bot-upgrade --force 强制重新安装当前版本`,
387
+ ``,
388
+ `⚠️ 仅在私聊中可用。升级过程约 30~60 秒,期间服务短暂不可用。`,
389
+ ].join("\n"),
362
390
  handler: async (ctx) => {
363
391
  // 升级相关指令仅在私聊中可用
364
392
  if (ctx.type !== "c2c") {
@@ -615,6 +643,12 @@ function collectRecentLogFiles(logDirs: string[]): LogCandidate[] {
615
643
  registerCommand({
616
644
  name: "bot-logs",
617
645
  description: "导出本地日志文件",
646
+ usage: [
647
+ `/bot-logs`,
648
+ ``,
649
+ `导出最近的 OpenClaw 日志文件(最多 4 个)。`,
650
+ `每个文件最多保留最后 1000 行,以文件形式返回。`,
651
+ ].join("\n"),
618
652
  handler: () => {
619
653
  const logDirs = collectCandidateLogDirs();
620
654
  const recentFiles = collectRecentLogFiles(logDirs).slice(0, 4);
@@ -691,6 +725,14 @@ export async function matchSlashCommand(ctx: SlashCommandContext): Promise<Slash
691
725
  const cmd = commands.get(cmdName);
692
726
  if (!cmd) return null; // 不是插件级指令,交给框架
693
727
 
728
+ // /指令 ? — 返回用法说明
729
+ if (args === "?") {
730
+ if (cmd.usage) {
731
+ return `📖 /${cmd.name} 用法:\n\n${cmd.usage}`;
732
+ }
733
+ return `/${cmd.name} — ${cmd.description}`;
734
+ }
735
+
694
736
  ctx.args = args;
695
737
  const result = await cmd.handler(ctx);
696
738
  return result;