@tencent-connect/openclaw-qqbot 1.6.4-alpha.1 → 1.6.4-alpha.3

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.
@@ -240,8 +240,37 @@ registerCommand({
240
240
  const url = ctx.accountConfig?.upgradeUrl || DEFAULT_UPGRADE_URL;
241
241
  const args = ctx.args.trim();
242
242
  const info = getUpdateInfo();
243
- const isForce = args.includes("--force");
244
- const versionArg = args.replace("--force", "").trim() || undefined;
243
+ let isForce = false;
244
+ let versionArg;
245
+ const tokens = args ? args.split(/\s+/).filter(Boolean) : [];
246
+ for (let i = 0; i < tokens.length; i += 1) {
247
+ const t = tokens[i];
248
+ if (t === "--force") {
249
+ isForce = true;
250
+ continue;
251
+ }
252
+ if (t === "--version") {
253
+ const next = tokens[i + 1];
254
+ if (!next || next.startsWith("--")) {
255
+ return `❌ 参数错误:--version 需要版本号\n\n示例:/bot-upgrade --version 1.6.4-alpha.1`;
256
+ }
257
+ versionArg = next;
258
+ i += 1;
259
+ continue;
260
+ }
261
+ if (t.startsWith("--version=")) {
262
+ const v = t.slice("--version=".length).trim();
263
+ if (!v) {
264
+ return `❌ 参数错误:--version 需要版本号\n\n示例:/bot-upgrade --version 1.6.4-alpha.1`;
265
+ }
266
+ versionArg = v;
267
+ continue;
268
+ }
269
+ if (!t.startsWith("--") && !versionArg) {
270
+ versionArg = t;
271
+ continue;
272
+ }
273
+ }
245
274
  if (!versionArg && !isForce) {
246
275
  if (info.checkedAt === 0) {
247
276
  return `⏳ 版本检查中,请稍后再试`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-connect/openclaw-qqbot",
3
- "version": "1.6.4-alpha.1",
3
+ "version": "1.6.4-alpha.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -327,8 +327,37 @@ registerCommand({
327
327
  const args = ctx.args.trim();
328
328
  const info = getUpdateInfo();
329
329
 
330
- const isForce = args.includes("--force");
331
- const versionArg = args.replace("--force", "").trim() || undefined;
330
+ let isForce = false;
331
+ let versionArg: string | undefined;
332
+ const tokens = args ? args.split(/\s+/).filter(Boolean) : [];
333
+ for (let i = 0; i < tokens.length; i += 1) {
334
+ const t = tokens[i]!;
335
+ if (t === "--force") {
336
+ isForce = true;
337
+ continue;
338
+ }
339
+ if (t === "--version") {
340
+ const next = tokens[i + 1];
341
+ if (!next || next.startsWith("--")) {
342
+ return `❌ 参数错误:--version 需要版本号\n\n示例:/bot-upgrade --version 1.6.4-alpha.1`;
343
+ }
344
+ versionArg = next;
345
+ i += 1;
346
+ continue;
347
+ }
348
+ if (t.startsWith("--version=")) {
349
+ const v = t.slice("--version=".length).trim();
350
+ if (!v) {
351
+ return `❌ 参数错误:--version 需要版本号\n\n示例:/bot-upgrade --version 1.6.4-alpha.1`;
352
+ }
353
+ versionArg = v;
354
+ continue;
355
+ }
356
+ if (!t.startsWith("--") && !versionArg) {
357
+ versionArg = t;
358
+ continue;
359
+ }
360
+ }
332
361
 
333
362
  if (!versionArg && !isForce) {
334
363
  if (info.checkedAt === 0) {