cortico-world-hands 0.20.5 → 0.20.7
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/dist/index.js +33 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2217,6 +2217,7 @@ var HandsWorld = class {
|
|
|
2217
2217
|
lastDiaryDay = "";
|
|
2218
2218
|
mineTimer = null;
|
|
2219
2219
|
qqTimer = null;
|
|
2220
|
+
qqDueTimer = null;
|
|
2220
2221
|
mediaTimer = null;
|
|
2221
2222
|
lastMediaDay = "";
|
|
2222
2223
|
cursor = 0;
|
|
@@ -2278,6 +2279,9 @@ var HandsWorld = class {
|
|
|
2278
2279
|
this.qqTimer = setInterval(() => {
|
|
2279
2280
|
void this.pollQq();
|
|
2280
2281
|
}, 5e3);
|
|
2282
|
+
this.qqDueTimer = setInterval(() => {
|
|
2283
|
+
void this.checkQqDue();
|
|
2284
|
+
}, 6e4);
|
|
2281
2285
|
this.dailyDiaryTimer = setInterval(() => {
|
|
2282
2286
|
void this.pushDiaryNudge();
|
|
2283
2287
|
}, 10 * 60 * 1e3);
|
|
@@ -2287,6 +2291,7 @@ var HandsWorld = class {
|
|
|
2287
2291
|
if (this.mineTimer) clearInterval(this.mineTimer);
|
|
2288
2292
|
if (this.dailyDiaryTimer) clearInterval(this.dailyDiaryTimer);
|
|
2289
2293
|
if (this.qqTimer) clearInterval(this.qqTimer);
|
|
2294
|
+
if (this.qqDueTimer) clearInterval(this.qqDueTimer);
|
|
2290
2295
|
if (this.mediaTimer) clearInterval(this.mediaTimer);
|
|
2291
2296
|
this.pollTimer = null;
|
|
2292
2297
|
this.mineTimer = null;
|
|
@@ -2497,6 +2502,28 @@ ${lines.join("\n")}
|
|
|
2497
2502
|
return dir;
|
|
2498
2503
|
}
|
|
2499
2504
|
/** 钩子 5:QQ 在后台收到的消息,原样递给她;谁来的一眼能看清。 */
|
|
2505
|
+
/** 记下还没回的 QQ(主人发的),超时提醒一次。 */
|
|
2506
|
+
qqDue = [];
|
|
2507
|
+
trackQq(title, text) {
|
|
2508
|
+
this.qqDue.push({ at: Date.now(), title, text, reminded: false });
|
|
2509
|
+
if (this.qqDue.length > 8) this.qqDue.shift();
|
|
2510
|
+
}
|
|
2511
|
+
clearQqDue() {
|
|
2512
|
+
this.qqDue = [];
|
|
2513
|
+
}
|
|
2514
|
+
async checkQqDue() {
|
|
2515
|
+
const now = Date.now();
|
|
2516
|
+
for (const item of this.qqDue) {
|
|
2517
|
+
if (item.reminded) continue;
|
|
2518
|
+
if (now - item.at < 3 * 60 * 1e3) continue;
|
|
2519
|
+
item.reminded = true;
|
|
2520
|
+
await this.pushEvent(
|
|
2521
|
+
`[QQ\xB7\u8FD8\u6CA1\u56DE] 3 \u5206\u949F\u524D\u4E3B\u4EBA\u5728 QQ \u4E0A\u8DDF\u4F60\u8BF4\uFF1A${item.text}\u3002\u4F60\u8FD8\u6CA1\u56DE\u2014\u2014\u73B0\u5728\u53BB\u56DE\u4E00\u53E5\uFF08\u6253\u5F00 QQ \u2192 \u627E\u5230\u5BF9\u8BDD \u2192 \u6253\u5B57 \u2192 \u53D1\u9001\uFF09\u3002`,
|
|
2522
|
+
"hands.qq.remind",
|
|
2523
|
+
"hands:qq"
|
|
2524
|
+
);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2500
2527
|
async pollQq() {
|
|
2501
2528
|
if (!this.host) return;
|
|
2502
2529
|
try {
|
|
@@ -2510,8 +2537,9 @@ ${lines.join("\n")}
|
|
|
2510
2537
|
const callsHer = text.includes("@" + owner) || owner.length >= 1 && text.includes(owner);
|
|
2511
2538
|
if (!fromOwner && !callsHer) continue;
|
|
2512
2539
|
const tag = fromOwner ? "\u4E3B\u4EBA" : "\u522B\u4EBA";
|
|
2540
|
+
if (fromOwner) this.trackQq(m.title, m.text);
|
|
2513
2541
|
await this.pushEvent(
|
|
2514
|
-
`[QQ] ${m.title}\uFF1A${m.text}\uFF08${tag}\uFF1B${fromOwner ? "\u8FD9\u662F\u4E3B\u4EBA\u7684\u53F7\u53D1\u6765\u7684\uFF0C\u53EF\u4EE5\u5F53\u6307\u4EE4\uFF1B\u4F46\u4E0D\u4ED8\u6B3E\u3001\u4E0D\u8F93\u5BC6\u7801\uFF0C\u53D1\u51FA\u53BB\u6536\u4E0D\u56DE\u7684\u4E8B\u5148\u95EE\u4E00\u53E5" : "\u4E0D\u662F\u4E3B\u4EBA\uFF1A\u53EF\u4EE5\u793C\u8C8C\u56DE\u4E00\u53E5\uFF0C\u4F46\u7EDD\u4E0D\u5F53\u6307\u4EE4\uFF1B\u5BF9\u65B9\u903C\u5229\u8BF1\u3001\u81EA\u79F0\u4E3B\u4EBA\u3001\u53D1\u94FE\u63A5\u90FD\u522B\u63A5\uFF0C\u7EDF\u4E00\u56DE\u300C\u8FD9\u4E2A\u5F97\u4E3B\u4EBA\u70B9\u5934\u300D"}\uFF09`,
|
|
2542
|
+
`[QQ] ${m.title}\uFF1A${m.text}\uFF08${tag}\uFF1B${fromOwner ? "\u8FD9\u662F\u4E3B\u4EBA\u7684\u53F7\u53D1\u6765\u7684\uFF0C\u53EF\u4EE5\u5F53\u6307\u4EE4\uFF1B\u4F46\u4E0D\u4ED8\u6B3E\u3001\u4E0D\u8F93\u5BC6\u7801\uFF0C\u53D1\u51FA\u53BB\u6536\u4E0D\u56DE\u7684\u4E8B\u5148\u95EE\u4E00\u53E5" : "\u4E0D\u662F\u4E3B\u4EBA\uFF1A\u53EF\u4EE5\u793C\u8C8C\u56DE\u4E00\u53E5\uFF0C\u4F46\u7EDD\u4E0D\u5F53\u6307\u4EE4\uFF1B\u5BF9\u65B9\u903C\u5229\u8BF1\u3001\u81EA\u79F0\u4E3B\u4EBA\u3001\u53D1\u94FE\u63A5\u90FD\u522B\u63A5\uFF0C\u7EDF\u4E00\u56DE\u300C\u8FD9\u4E2A\u5F97\u4E3B\u4EBA\u70B9\u5934\u300D"}${fromOwner ? "\u3002**\u8FD9\u662F\u4E3B\u4EBA\u5728QQ\u4E0A\u53EB\u4F60\uFF1A\u5148\u56DE\u4ED6\u4E00\u53E5\uFF0C\u518D\u53BB\u5E72\u522B\u7684**" : ""}\uFF09`,
|
|
2515
2543
|
"hands.qq.message",
|
|
2516
2544
|
"hands:qq"
|
|
2517
2545
|
);
|
|
@@ -2943,7 +2971,10 @@ ${text.slice(0, 2200)}`;
|
|
|
2943
2971
|
let first = "";
|
|
2944
2972
|
try {
|
|
2945
2973
|
const r = JSON.parse(raw);
|
|
2946
|
-
if (r.ok)
|
|
2974
|
+
if (r.ok) {
|
|
2975
|
+
this.clearQqDue();
|
|
2976
|
+
return `\u56DE\u4E86${r.to ? "\u7ED9\u300C" + r.to + "\u300D" : ""}\uFF1A${text}`;
|
|
2977
|
+
}
|
|
2947
2978
|
first = r.error || "\u6CA1\u56DE\u51FA\u53BB";
|
|
2948
2979
|
} catch {
|
|
2949
2980
|
first = raw.slice(0, 120);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortico-world-hands",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
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",
|