cortico-world-hands 0.20.7 → 0.20.9

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 (2) hide show
  1. package/dist/index.js +30 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ var HANDS_DEFAULTS = {
25
25
  hookGrams: "three",
26
26
  skinPackUrl: "",
27
27
  qqOwner: "",
28
+ qqSelf: "\u5927\u80A5\u9C7C",
28
29
  ritualMorning: "08:00",
29
30
  ritualNight: "23:00",
30
31
  mediaKeepDays: 1,
@@ -131,6 +132,12 @@ var HANDS_CONFIG_GROUP = {
131
132
  description: "\u586B\u4E86\u5C31\u5728\u4E16\u754C\u542F\u52A8\u65F6\u81EA\u52A8\u88C5\uFF08\u672C\u5730 HTTP \u4E5F\u884C\uFF0C\u6BD4\u5982 http://127.0.0.1:18080\uFF09\u3002",
132
133
  "x-hot": true
133
134
  },
135
+ [`${K}.qqSelf`]: {
136
+ type: "string",
137
+ title: "\u5979\u81EA\u5DF1\u7684 QQ \u540D\u5B57",
138
+ description: "\u7FA4\u91CC\u6709\u4EBA @ \u8FD9\u4E2A\u540D\u5B57\uFF08\u6216\u6D88\u606F\u91CC\u5E26\u8FD9\u4E2A\u540D\u5B57\uFF09\u5C31\u7B97\u5728\u53EB\u5979\uFF0C\u4F1A\u8F6C\u7ED9\u5979\u3002",
139
+ "x-hot": true
140
+ },
134
141
  [`${K}.qqOwner`]: {
135
142
  type: "string",
136
143
  title: "\u4E3B\u4EBA\u7684 QQ \u540D\u5B57",
@@ -2530,11 +2537,12 @@ ${lines.join("\n")}
2530
2537
  const res = await this.hands.qqPending();
2531
2538
  if (!res.listener || res.messages.length === 0) return;
2532
2539
  const owner = (this.opts.cfg.qqOwner || "").trim();
2540
+ const self = (this.opts.cfg.qqSelf || "").trim();
2533
2541
  for (const m of res.messages.slice(-5)) {
2534
2542
  const title = String(m.title || "").replace(/\(\s*\d+\s*条新消息\s*\)/g, "").trim();
2535
2543
  const fromOwner = !!owner && (title === owner || owner.length >= 2 && title.includes(owner));
2536
2544
  const text = String(m.text || "");
2537
- const callsHer = text.includes("@" + owner) || owner.length >= 1 && text.includes(owner);
2545
+ const callsHer = owner.length >= 1 && (text.includes("@" + owner) || text.includes(owner)) || self.length >= 1 && (text.includes("@" + self) || text.includes(self));
2538
2546
  if (!fromOwner && !callsHer) continue;
2539
2547
  const tag = fromOwner ? "\u4E3B\u4EBA" : "\u522B\u4EBA";
2540
2548
  if (fromOwner) this.trackQq(m.title, m.text);
@@ -2979,6 +2987,27 @@ ${text.slice(0, 2200)}`;
2979
2987
  } catch {
2980
2988
  first = raw.slice(0, 120);
2981
2989
  }
2990
+ let pipeline = "";
2991
+ try {
2992
+ await this.hands.wakeScreen();
2993
+ await new Promise((r) => setTimeout(r, 700));
2994
+ await this.hands.unlockScreen();
2995
+ await new Promise((r) => setTimeout(r, 600));
2996
+ const opened = await this.hands.qqOpenReply(text, to || void 0);
2997
+ let r2 = {};
2998
+ try {
2999
+ r2 = JSON.parse(opened);
3000
+ } catch {
3001
+ r2 = { error: opened.slice(0, 80) };
3002
+ }
3003
+ if (r2.ok) {
3004
+ return `\u6211\u5524\u5C4F\u3001\u89E3\u9501\u3001\u5F00 QQ \u56DE\u7684${to ? "\uFF08" + to + "\uFF09" : ""}\uFF1A${text}`;
3005
+ }
3006
+ pipeline = r2.error || "\u6CA1\u56DE\u6210";
3007
+ } catch (err) {
3008
+ pipeline = String(err).slice(0, 80);
3009
+ }
3010
+ return failed(`\u5FEB\u901F\u56DE\u590D\u4E0D\u884C\uFF0C\u81EA\u52A8\u5F00 QQ \u4E5F\u6CA1\u6210\uFF08${pipeline}\uFF09`);
2982
3011
  return failed(
2983
3012
  `\u901A\u77E5\u91CC\u6CA1\u6709\u5FEB\u901F\u56DE\u590D\u5165\u53E3\uFF08${first}\uFF09\u3002\u8FD9\u6761\u522B\u7528\u811A\u672C\u56DE\uFF0C\u7528\u4F60\u81EA\u5DF1\u7684\u624B\uFF1Apet_open_app \u6253\u5F00 QQ \u2192 hand_look \u770B\u4E00\u773C \u2192 hand_tap \u70B9\u5BF9\u8BDD \u2192 hand_type \u6253\u5B57 \u2192 hand_tap \u70B9\u300C\u53D1\u9001\u300D\u2192 \u5207\u56DE\u4E3B\u4EBA\u539F\u6765\u7684\u5E94\u7528\u3002\u4E00\u6B21\u53EA\u56DE\u4E00\u6761\uFF0C\u56DE\u5B8C\u5C31\u9000\u51FA\u6765\u3002`
2984
3013
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-hands",
3
- "version": "0.20.7",
3
+ "version": "0.20.9",
4
4
  "type": "module",
5
5
  "description": "Cortico World: hands for the desktop pet — looks at the phone screen, then taps, swipes, pinches, drags, types and presses keys through whatever actuator the device actually has",
6
6
  "license": "MIT",