ework-qq-bridge 0.1.0 → 0.1.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.
- package/package.json +2 -2
- package/src/router.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ework-qq-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "QQ group <-> ework issue bridge (OneBot 11 reverse WebSocket)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
"bin": {
|
|
23
23
|
"ework-qq-bridge": "./bin/ework-qq-bridge.js"
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
package/src/router.ts
CHANGED
|
@@ -28,10 +28,11 @@ interface ParsedCommand {
|
|
|
28
28
|
|
|
29
29
|
export function parseCommand(raw: string): ParsedCommand | null {
|
|
30
30
|
const text = raw.trim();
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const stripped = text.replace(/^\[CQ:at,qq=\d+\]\s*/, "").trim();
|
|
32
|
+
if (stripped === "帮助" || stripped === "help" || stripped === "查询") return { kind: "help" };
|
|
33
|
+
const create = /^(?:任务|task|新任务)\s+(.+)$/i.exec(stripped) ?? /^(?:任务|task|新任务)\s+(.+)$/i.exec(text);
|
|
33
34
|
if (create?.[1]) return { kind: "create", title: create[1].trim() };
|
|
34
|
-
const comment = /^#(\d{1,6})\s+([\s\S]+)$/.exec(text);
|
|
35
|
+
const comment = /^#(\d{1,6})\s+([\s\S]+)$/.exec(stripped) ?? /^#(\d{1,6})\s+([\s\S]+)$/.exec(text);
|
|
35
36
|
if (comment?.[1] && comment[2]) return { kind: "comment", number: Number(comment[1]), body: comment[2].trim() };
|
|
36
37
|
return null;
|
|
37
38
|
}
|