@zaofan/dsh-qqbot 1.13.15 → 1.13.17
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/features/botplay.d.ts +31 -0
- package/dist/features/botplay.d.ts.map +1 -1
- package/dist/features/botplay.js +24 -7
- package/dist/features/botplay.js.map +1 -1
- package/dist/transport/inbound.d.ts.map +1 -1
- package/dist/transport/inbound.js +54 -4
- package/dist/transport/inbound.js.map +1 -1
- package/docs/USER-GUIDE.md +2 -1
- package/examples/ext-tools/lib/session_watch_lib.mjs +1319 -1315
- package/package.json +1 -1
- package/settings-host.js +34 -1
package/package.json
CHANGED
package/settings-host.js
CHANGED
|
@@ -4588,6 +4588,38 @@ export function apply(ctx) {
|
|
|
4588
4588
|
if (s.includes(':') || s.includes(':')) return null;
|
|
4589
4589
|
return { name: s, nick: '' };
|
|
4590
4590
|
}
|
|
4591
|
+
|
|
4592
|
+
/**
|
|
4593
|
+
* 剥掉消息正文外层的「冒号 + 双引号」(2026-11-17 主人换消息格式的配套)。
|
|
4594
|
+
*
|
|
4595
|
+
* 新格式:`[发送者 #短号]: "正文"`
|
|
4596
|
+
* 标签剥完剩 `:"正文"` —— 冒号和双引号是**程序加的定界符**,不该显示给用户。
|
|
4597
|
+
*
|
|
4598
|
+
* ⚠️ 跨行消息的结尾引号在**最后一行**,所以必须在整段拼完之后剥,不能逐行处理。
|
|
4599
|
+
*/
|
|
4600
|
+
function chatStripBodyWrap(raw) {
|
|
4601
|
+
const x = String(raw == null ? '' : raw);
|
|
4602
|
+
// ★ 2026-11-17 CodeRabbit(第二轮):**按「前缀 / 正文 / 尾巴」三段切**,不要整串当正文。
|
|
4603
|
+
//
|
|
4604
|
+
// 为什么不能只判开头:一条消息剥掉标签之后,正文前后都可能挂着别的东西 ——
|
|
4605
|
+
// · 前面:引用块占位符(\u0000Q<n>\u0000)、附件媒体元数据行(`- Image: …`)
|
|
4606
|
+
// · 后面:历史分段路径的 pendingMeta(媒体元数据排在正文之后)
|
|
4607
|
+
// 只匹配「整串以 `: "` 开头」会全部漏掉;只剥开头引号又会把闭引号留在中间。
|
|
4608
|
+
//
|
|
4609
|
+
// 现在:第一个 `: "` 定位正文起点,**最后一个** `"` 定位终点,中间才是正文,
|
|
4610
|
+
// 前后两段原样保留。
|
|
4611
|
+
//
|
|
4612
|
+
// ⚠️ 找不到定界符就原样返回 —— 旧记录 `[Alice] "你好"` / `[Alice] :D`
|
|
4613
|
+
// 一个字符都不动(它们本来就没有外壳)。
|
|
4614
|
+
const i = x.indexOf(': "');
|
|
4615
|
+
if (i < 0) return x.trim();
|
|
4616
|
+
const j = x.lastIndexOf('"');
|
|
4617
|
+
if (j <= i + 2) return x.trim(); // 只有开引号没闭合(被截断)→ 不动
|
|
4618
|
+
const head = x.slice(0, i); // 引用占位符 / 附件元数据
|
|
4619
|
+
const body = x.slice(i + 3, j); // ← 真正的正文
|
|
4620
|
+
const tail = x.slice(j + 1); // pendingMeta 等尾巴
|
|
4621
|
+
return (head + body + tail).trim();
|
|
4622
|
+
}
|
|
4591
4623
|
/** 气泡上显示的名字:有群名片且与账号名不同才追加 */
|
|
4592
4624
|
function chatSenderLabel(info) {
|
|
4593
4625
|
if (!info) return '';
|
|
@@ -4606,7 +4638,7 @@ export function apply(ctx) {
|
|
|
4606
4638
|
let pendingMeta = [];
|
|
4607
4639
|
const flush = () => {
|
|
4608
4640
|
if (cur) {
|
|
4609
|
-
const t = cur.lines.join('\n').trim();
|
|
4641
|
+
const t = chatStripBodyWrap(cur.lines.join('\n').trim()); // ★ 2026-11-17 剥掉 `: "正文"` 的外层
|
|
4610
4642
|
out.push({ sender: cur.sender, text: t });
|
|
4611
4643
|
}
|
|
4612
4644
|
cur = null;
|
|
@@ -4683,6 +4715,7 @@ export function apply(ctx) {
|
|
|
4683
4715
|
if (RE_MARKER_WORD.test(info.name)) continue;
|
|
4684
4716
|
sender = chatSenderLabel(info);
|
|
4685
4717
|
b = b.replace(tmm[0], '');
|
|
4718
|
+
b = chatStripBodyWrap(b); // ★ 2026-11-17 剥掉 `: "正文"` 的外层
|
|
4686
4719
|
break;
|
|
4687
4720
|
}
|
|
4688
4721
|
if (quotes.length) b = b.replace(/\u0000Q(\d+)\u0000/g, (_all, i) => quotes[Number(i)] || '');
|