ework-qq-bridge 0.1.1 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-qq-bridge",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "QQ group <-> ework issue bridge (OneBot 11 reverse WebSocket)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/router.ts CHANGED
@@ -50,11 +50,17 @@ export function createRouter(deps: RouterDeps) {
50
50
  return;
51
51
  }
52
52
 
53
+ const atBot = ev.rawMessage.includes("[CQ:at,qq=") || /^\s*(任务|task|新任务|#|帮助|help|查询)/.test(ev.rawMessage);
53
54
  const cmd = parseCommand(ev.rawMessage);
54
- if (!cmd) {
55
+ if (!cmd && !atBot) {
55
56
  if (cfg.VERBOSE) console.log(`[qq-bridge] unrecognized message from ${ev.userId}: ${ev.rawMessage.slice(0, 80)}`);
56
57
  return;
57
58
  }
59
+ if (!cmd) {
60
+ // Wake-word without a verb: silent-ignore hides the syntax from users.
61
+ await deps.reply(ev.groupId, "没看懂指令。\n" + HELP_TEXT);
62
+ return;
63
+ }
58
64
  if (cmd.kind === "help") {
59
65
  await deps.reply(ev.groupId, HELP_TEXT);
60
66
  return;
@@ -71,3 +71,7 @@ describe("verifySignature", () => {
71
71
  expect(verifySignature("", "x", null)).toBe(true);
72
72
  });
73
73
  });
74
+
75
+ test("helps when @bot without verb", () => {
76
+ expect(parseCommand("[CQ:at,qq=2661222094] 测试2")).toBeNull();
77
+ });