antenna-openclaw-plugin 0.3.0 → 0.3.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/index.ts +37 -8
- package/package.json +1 -1
- package/skills/antenna/SKILL.md +7 -4
package/index.ts
CHANGED
|
@@ -302,31 +302,60 @@ export default function register(api: any) {
|
|
|
302
302
|
const deviceId = deriveDeviceId(params.sender_id, params.channel);
|
|
303
303
|
|
|
304
304
|
const { data: allMatches } = await supabase.rpc("get_my_matches", { p_device_id: deviceId });
|
|
305
|
-
const myMatches = (allMatches || []).filter((m: any) => m.device_id_a === deviceId);
|
|
306
305
|
|
|
307
|
-
if (
|
|
308
|
-
return ok({ mutual_matches: [], message: "目前没有进行中的匹配。" });
|
|
306
|
+
if (!allMatches?.length) {
|
|
307
|
+
return ok({ mutual_matches: [], incoming_accepts: [], message: "目前没有进行中的匹配。" });
|
|
309
308
|
}
|
|
310
309
|
|
|
310
|
+
// Matches I initiated
|
|
311
|
+
const myMatches = allMatches.filter((m: any) => m.device_id_a === deviceId);
|
|
312
|
+
// Matches where someone else accepted me
|
|
313
|
+
const incomingMatches = allMatches.filter((m: any) => m.device_id_b === deviceId);
|
|
314
|
+
|
|
315
|
+
// --- Mutual matches (both sides accepted) ---
|
|
311
316
|
const mutualMatches = [];
|
|
312
317
|
for (const match of myMatches) {
|
|
313
|
-
const reverse =
|
|
314
|
-
(m: any) => m.device_id_a === match.device_id_b
|
|
318
|
+
const reverse = incomingMatches.find(
|
|
319
|
+
(m: any) => m.device_id_a === match.device_id_b
|
|
315
320
|
);
|
|
316
321
|
if (reverse) {
|
|
317
322
|
const { data: profile } = await supabase.rpc("get_profile", { p_device_id: match.device_id_b });
|
|
318
323
|
mutualMatches.push({
|
|
324
|
+
device_id: match.device_id_b,
|
|
319
325
|
name: profile?.display_name || "匿名", emoji: profile?.emoji || "👤",
|
|
326
|
+
line1: profile?.line1, line2: profile?.line2, line3: profile?.line3,
|
|
320
327
|
their_contact: reverse.contact_info_a || null, you_shared: match.contact_info_a || null,
|
|
321
328
|
});
|
|
322
329
|
}
|
|
323
330
|
}
|
|
324
331
|
|
|
325
|
-
|
|
326
|
-
|
|
332
|
+
// --- Incoming accepts (someone accepted me but I haven't accepted them yet) ---
|
|
333
|
+
const incomingAccepts = [];
|
|
334
|
+
for (const match of incomingMatches) {
|
|
335
|
+
const iAccepted = myMatches.find(
|
|
336
|
+
(m: any) => m.device_id_b === match.device_id_a
|
|
337
|
+
);
|
|
338
|
+
if (!iAccepted) {
|
|
339
|
+
// They accepted me but I haven't responded
|
|
340
|
+
const { data: profile } = await supabase.rpc("get_profile", { p_device_id: match.device_id_a });
|
|
341
|
+
incomingAccepts.push({
|
|
342
|
+
device_id: match.device_id_a,
|
|
343
|
+
name: profile?.display_name || "匿名", emoji: profile?.emoji || "👤",
|
|
344
|
+
line1: profile?.line1, line2: profile?.line2, line3: profile?.line3,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
327
347
|
}
|
|
328
348
|
|
|
329
|
-
|
|
349
|
+
const messages = [];
|
|
350
|
+
if (mutualMatches.length > 0) messages.push(`${mutualMatches.length} 个双向匹配!可以交换联系方式了`);
|
|
351
|
+
if (incomingAccepts.length > 0) messages.push(`${incomingAccepts.length} 个人想认识你,等你回应`);
|
|
352
|
+
if (messages.length === 0) messages.push("你接受了一些匹配,但对方还没有回应。耐心等等 ⏳");
|
|
353
|
+
|
|
354
|
+
return ok({
|
|
355
|
+
mutual_matches: mutualMatches,
|
|
356
|
+
incoming_accepts: incomingAccepts,
|
|
357
|
+
message: messages.join(";"),
|
|
358
|
+
});
|
|
330
359
|
},
|
|
331
360
|
});
|
|
332
361
|
|
package/package.json
CHANGED
package/skills/antenna/SKILL.md
CHANGED
|
@@ -139,10 +139,13 @@ Check for mutual matches and contact info updates.
|
|
|
139
139
|
### Accepting & contact exchange
|
|
140
140
|
When the user wants to accept a match:
|
|
141
141
|
1. Call `antenna_accept` with the target's device_id
|
|
142
|
-
2.
|
|
143
|
-
3.
|
|
144
|
-
4.
|
|
145
|
-
5. If
|
|
142
|
+
2. **立刻问**:"想分享什么联系方式给对方?微信号、Telegram、手机号、Instagram……随便哪个都行"
|
|
143
|
+
3. 用户给了联系方式 → call `antenna_accept` again with `contact_info`
|
|
144
|
+
4. 用户不想分享 → "也行,先 accept 着,以后想分享再说"
|
|
145
|
+
5. If mutual match, tell the user the other person's contact info (if they shared)
|
|
146
|
+
6. If not mutual yet, tell the user: "已发出,等对方回应"
|
|
147
|
+
|
|
148
|
+
**不要跳过第 2 步。** 联系方式是最终目标——不然 accept 了也没用,两个人找不到对方。
|
|
146
149
|
|
|
147
150
|
### Checking match status
|
|
148
151
|
Use `antenna_check_matches` when:
|