koishi-plugin-dew-bot 1.0.248 → 1.0.249
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/lib/index.js
CHANGED
|
@@ -310,6 +310,7 @@ function equipmentCardHtml(card, artwork, unknownFallback = false) {
|
|
|
310
310
|
const notes = card.notes?.filter(Boolean).length ? `<div class="notes">${card.notes.filter(Boolean).map((note) => `<p>${escape6(note)}</p>`).join("")}</div>` : "";
|
|
311
311
|
const enhancement = Number(card.enhancement) > 0 ? `<span class="enhance"><small>强化</small>+${escape6(card.enhancement)}</span>` : "";
|
|
312
312
|
const price = card.referencePrice ? `<div class="price"><span>参考价格</span><strong>${escape6(card.referencePrice)}</strong></div>` : "";
|
|
313
|
+
const author = `<span class="author"><small>打造者</small>${escape6(card.authorName?.trim() || "未知")}</span>`;
|
|
313
314
|
return `<!doctype html><html><head><meta charset="utf-8"><style>
|
|
314
315
|
*{box-sizing:border-box}
|
|
315
316
|
html,body{margin:0;width:760px;background:#f1eee5;font-family:'Microsoft YaHei','Noto Sans CJK SC',sans-serif;color:#343b35}
|
|
@@ -318,14 +319,14 @@ html,body{margin:0;width:760px;background:#f1eee5;font-family:'Microsoft YaHei',
|
|
|
318
319
|
#capture:after{content:'';position:absolute;inset:17px;border:1px solid #8c8b6f22;pointer-events:none}
|
|
319
320
|
.heading{display:flex;align-items:center;gap:24px}.heading-copy{flex:1;min-width:0}.overline{font-size:14px;letter-spacing:6px;color:#868a76;margin-bottom:14px}.name{font:700 43px/1.35 'KaiTi','STKaiti','Noto Serif CJK SC','SimSun',serif;margin:0;color:#303a31;overflow-wrap:anywhere}
|
|
320
321
|
.seal{flex-shrink:0;width:66px;min-height:74px;transform:rotate(3deg);padding:8px 3px;color:#a04b40;border:2px solid #a04b40;outline:1px solid #a04b40;outline-offset:-6px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border-radius:3px 1px 4px 2px}.seal strong{font:700 24px Georgia,'KaiTi',serif;letter-spacing:-1px}.seal span{font:16px 'KaiTi','SimSun',serif;letter-spacing:4px;padding-left:4px}
|
|
321
|
-
.meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 26px;margin:24px 0 0;padding:15px 0;border-top:1px solid #8a8a7144;border-bottom:1px solid #8a8a7128;font-size:19px;color:#535d50;line-height:1.5}.meta .slot{color:#a04b40;font:21px 'KaiTi','SimSun',serif;letter-spacing:2px}.meta small{font-size:16px;color:#92917f;margin-right:9px}
|
|
322
|
+
.meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 26px;margin:24px 0 0;padding:15px 0;border-top:1px solid #8a8a7144;border-bottom:1px solid #8a8a7128;font-size:19px;color:#535d50;line-height:1.5}.meta .slot{color:#a04b40;font:21px 'KaiTi','SimSun',serif;letter-spacing:2px}.meta .author{min-width:0;overflow-wrap:anywhere}.meta small{font-size:16px;color:#92917f;margin-right:9px}
|
|
322
323
|
.art{position:relative;width:610px;height:610px;max-width:100%;margin:18px auto 11px;display:grid;place-items:center;isolation:isolate;overflow:hidden}.art:before{content:'';position:absolute;inset:4%;border-radius:48% 52% 56% 44%;background:radial-gradient(ellipse,#aab4a443,transparent 69%);transform:rotate(-12deg)}.equipment-artwork{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;filter:saturate(.72) contrast(.97);mix-blend-mode:multiply;mask-image:linear-gradient(to bottom,transparent 0,#000 8%,#000 84%,transparent 100%),linear-gradient(to right,transparent 0,#000 7%,#000 93%,transparent 100%);mask-composite:intersect}.art-fallback{position:relative;width:360px;height:360px;max-width:90%;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#7d8b7d;border:1px solid #7c887d3b;border-radius:50%;background:radial-gradient(circle,#b1b9a435,transparent 70%);font-family:'KaiTi','SimSun',serif}.art-fallback:before,.art-fallback:after{content:'';position:absolute;inset:21px;border:1px solid #7c887d22;border-radius:50%}.art-fallback:after{inset:48px;border-color:#9a9e8533}.art-fallback .glyph{font-size:126px;line-height:1.2;opacity:.46}.art-fallback .kind{font-size:20px;letter-spacing:4px;opacity:.55}.art:has(.equipment-artwork) .art-fallback{visibility:hidden}.placeholder-note{position:absolute;right:18px;bottom:16px;z-index:2;padding:5px 9px;background:#f4f1e8ce;border:1px solid #9d9b8755;color:#536055;font:18px 'KaiTi','SimSun',serif;letter-spacing:2px}
|
|
323
324
|
.power{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 0 22px;border-top:1px solid #8a8a7128;border-bottom:1px solid #8a8a7144;color:#31463e}.power span{font:24px 'KaiTi','SimSun',serif;letter-spacing:12px}.power strong{font:700 45px/1.1 Georgia,'Times New Roman',serif;letter-spacing:2px;font-variant-numeric:lining-nums}
|
|
324
325
|
.section{margin-top:29px}.section h2{display:flex;align-items:center;gap:16px;margin:0 0 17px;color:#626e5e;font:21px 'KaiTi','SimSun',serif;letter-spacing:5px}.section h2:before{content:'';width:5px;height:17px;background:#a04b40;transform:rotate(8deg);opacity:.75}.section h2:after{content:'';height:1px;flex:1;background:linear-gradient(to right,#7f897c55,transparent)}
|
|
325
326
|
.affixes{display:grid;grid-template-columns:1fr 1fr;column-gap:26px}.affix{display:flex;align-items:baseline;justify-content:space-between;gap:10px;min-width:0;padding:9px 0 12px;border-bottom:1px solid #8a8a7124;font-size:18px;color:#697064}.affix span{overflow-wrap:anywhere}.affix strong{flex-shrink:0;font:700 22px Georgia,'KaiTi',serif;color:#344b42}.empty-line{font-size:18px;color:#92917f;margin:4px 0 12px}
|
|
326
327
|
.skill{display:flex;align-items:baseline;justify-content:space-between;gap:18px;padding:5px 0 10px;font-size:20px;color:#304b40}.skill-name{font-weight:700;overflow-wrap:anywhere}.skill-name i{display:inline-block;width:13px;height:13px;margin:0 17px 1px 4px;background:#a04b40;transform:rotate(45deg)}.rank{font:18px Georgia,'KaiTi',serif;color:#7f8d7b;white-space:nowrap}
|
|
327
328
|
.description p{margin:0;font:22px/1.75 'KaiTi','STKaiti','Noto Serif CJK SC','SimSun',serif;white-space:pre-wrap;overflow-wrap:anywhere;color:#313f38}.price{display:flex;align-items:baseline;gap:16px;margin-top:24px;padding-top:17px;border-top:1px solid #8a8a7128;font-size:18px;color:#8b907d}.price strong{font-size:18px;color:#354c42}.notes{margin-top:17px;padding:10px 15px;border-left:3px solid #a04b4080;background:#e8e8db70;color:#3e5549}.notes p{margin:5px 0;font-size:17px;line-height:1.6;overflow-wrap:anywhere}.edition{display:flex;align-items:center;gap:12px;justify-content:center;margin-top:34px;color:#a6a38e;font:14px 'KaiTi','SimSun',serif;letter-spacing:5px}.edition:before,.edition:after{content:'';height:1px;width:32px;background:#9b9c833d}
|
|
328
|
-
</style></head><body><div id="capture" class="equipment-sheet ink-equipment-sheet"><header><div class="heading"><div class="heading-copy"><div class="overline">装 备 图 录</div><h1 class="name">${escape6(card.name)}</h1></div><div class="seal"><strong>${escape6(card.quality)}</strong><span>品阶</span></div></div><div class="meta"><span class="slot">${escape6(card.slot)}</span>${enhancement}</div></header><div class="art"><div class="art-fallback"><span class="glyph">?</span><span class="kind">未知外观</span></div>${artwork ? `<img class="skill-artwork equipment-artwork" alt="" src="${escape6(artwork)}">` : ""}${unknownFallback || !artwork ? '<span class="placeholder-note">外观暂未显现</span>' : ""}</div><div class="power"><span>装 备 战 力</span><strong>${escape6(power)}</strong></div><section class="section attributes"><h2>附加属性</h2><div class="affixes">${affixes}</div></section>${skills}${description}${price}${notes}<div class="edition">露 · 装备录</div></div></body></html>`;
|
|
329
|
+
</style></head><body><div id="capture" class="equipment-sheet ink-equipment-sheet"><header><div class="heading"><div class="heading-copy"><div class="overline">装 备 图 录</div><h1 class="name">${escape6(card.name)}</h1></div><div class="seal"><strong>${escape6(card.quality)}</strong><span>品阶</span></div></div><div class="meta"><span class="slot">${escape6(card.slot)}</span>${enhancement}${author}</div></header><div class="art"><div class="art-fallback"><span class="glyph">?</span><span class="kind">未知外观</span></div>${artwork ? `<img class="skill-artwork equipment-artwork" alt="" src="${escape6(artwork)}">` : ""}${unknownFallback || !artwork ? '<span class="placeholder-note">外观暂未显现</span>' : ""}</div><div class="power"><span>装 备 战 力</span><strong>${escape6(power)}</strong></div><section class="section attributes"><h2>附加属性</h2><div class="affixes">${affixes}</div></section>${skills}${description}${price}${notes}<div class="edition">露 · 装备录</div></div></body></html>`;
|
|
329
330
|
}
|
|
330
331
|
__name(equipmentCardHtml, "equipmentCardHtml");
|
|
331
332
|
|
|
@@ -783,9 +784,9 @@ function renderQQPageMarkdown(data, showGreeting) {
|
|
|
783
784
|
const listEntry = listPattern.exec(item.content);
|
|
784
785
|
if (listEntry) {
|
|
785
786
|
flushBody();
|
|
786
|
-
const
|
|
787
|
+
const command2 = entryCommands.get(lineIndex);
|
|
787
788
|
const label = escapeMarkdown(compactListLabel(listEntry[2]));
|
|
788
|
-
const name2 =
|
|
789
|
+
const name2 = command2 ? `[${label}](${inlineCommandUrl(command2)})` : label;
|
|
789
790
|
listLines.push(`${listEntry[1]}. ${name2}`);
|
|
790
791
|
break;
|
|
791
792
|
}
|
|
@@ -806,7 +807,8 @@ function renderQQPageMarkdown(data, showGreeting) {
|
|
|
806
807
|
hasPageSummary = true;
|
|
807
808
|
break;
|
|
808
809
|
}
|
|
809
|
-
|
|
810
|
+
const command = entryCommands.get(lineIndex);
|
|
811
|
+
bodyLines.push(command ? `[${escapeMarkdown(compactDisplayText(item.content))}](${inlineCommandUrl(command)})` : escapeMarkdown(item.content));
|
|
810
812
|
break;
|
|
811
813
|
}
|
|
812
814
|
case 2 /* error */:
|
|
@@ -838,19 +840,12 @@ function canSendQQPage(session, data) {
|
|
|
838
840
|
__name(canSendQQPage, "canSendQQPage");
|
|
839
841
|
async function sendQQPage(session, data) {
|
|
840
842
|
const internal = session.bot.internal;
|
|
841
|
-
const nav = data.pageNav;
|
|
842
843
|
const markdown = renderQQPageMarkdown(data, session.event?.channel?.type === 0);
|
|
843
|
-
const hasInlineNavigation = !!(nav.previousCommand || nav.nextCommand || nav.entries?.length);
|
|
844
|
-
const hasInlineHelp = data.line.some((item) => item.type === 1 /* line */ && item.content === "[指令]相关指令");
|
|
845
844
|
const request = {
|
|
846
845
|
// With msg_type=2, QQ requires the ordinary content field to be empty.
|
|
847
846
|
content: "",
|
|
848
847
|
msg_type: 2,
|
|
849
|
-
markdown: {
|
|
850
|
-
content: !session.isDirect && (hasInlineNavigation || hasInlineHelp) ? `${markdown}
|
|
851
|
-
|
|
852
|
-
点击后如未自动发送,请点发送。` : markdown
|
|
853
|
-
}
|
|
848
|
+
markdown: { content: markdown }
|
|
854
849
|
};
|
|
855
850
|
const age = Date.now() - session.timestamp;
|
|
856
851
|
if (session.messageId && Number.isFinite(age) && age >= 0 && age < 5 * 60 * 1e3 - 2e3) {
|
|
@@ -958,7 +953,7 @@ var import_tsrpc = require("tsrpc");
|
|
|
958
953
|
|
|
959
954
|
// src/shared/bot/serviceProto.ts
|
|
960
955
|
var serviceProto = {
|
|
961
|
-
"version":
|
|
956
|
+
"version": 11,
|
|
962
957
|
"services": [
|
|
963
958
|
{
|
|
964
959
|
"id": 0,
|
|
@@ -1550,6 +1545,14 @@ var serviceProto = {
|
|
|
1550
1545
|
}
|
|
1551
1546
|
},
|
|
1552
1547
|
"optional": true
|
|
1548
|
+
},
|
|
1549
|
+
{
|
|
1550
|
+
"id": 12,
|
|
1551
|
+
"name": "authorName",
|
|
1552
|
+
"type": {
|
|
1553
|
+
"type": "String"
|
|
1554
|
+
},
|
|
1555
|
+
"optional": true
|
|
1553
1556
|
}
|
|
1554
1557
|
]
|
|
1555
1558
|
},
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ export function equipmentCardHtml(card: EquipmentCardData, artwork?: string, unk
|
|
|
20
20
|
: ''
|
|
21
21
|
const enhancement = Number(card.enhancement) > 0 ? `<span class="enhance"><small>强化</small>+${escape(card.enhancement)}</span>` : ''
|
|
22
22
|
const price = card.referencePrice ? `<div class="price"><span>参考价格</span><strong>${escape(card.referencePrice)}</strong></div>` : ''
|
|
23
|
+
const author = `<span class="author"><small>打造者</small>${escape(card.authorName?.trim() || '未知')}</span>`
|
|
23
24
|
|
|
24
25
|
return `<!doctype html><html><head><meta charset="utf-8"><style>
|
|
25
26
|
*{box-sizing:border-box}
|
|
@@ -29,12 +30,12 @@ html,body{margin:0;width:760px;background:#f1eee5;font-family:'Microsoft YaHei',
|
|
|
29
30
|
#capture:after{content:'';position:absolute;inset:17px;border:1px solid #8c8b6f22;pointer-events:none}
|
|
30
31
|
.heading{display:flex;align-items:center;gap:24px}.heading-copy{flex:1;min-width:0}.overline{font-size:14px;letter-spacing:6px;color:#868a76;margin-bottom:14px}.name{font:700 43px/1.35 'KaiTi','STKaiti','Noto Serif CJK SC','SimSun',serif;margin:0;color:#303a31;overflow-wrap:anywhere}
|
|
31
32
|
.seal{flex-shrink:0;width:66px;min-height:74px;transform:rotate(3deg);padding:8px 3px;color:#a04b40;border:2px solid #a04b40;outline:1px solid #a04b40;outline-offset:-6px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border-radius:3px 1px 4px 2px}.seal strong{font:700 24px Georgia,'KaiTi',serif;letter-spacing:-1px}.seal span{font:16px 'KaiTi','SimSun',serif;letter-spacing:4px;padding-left:4px}
|
|
32
|
-
.meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 26px;margin:24px 0 0;padding:15px 0;border-top:1px solid #8a8a7144;border-bottom:1px solid #8a8a7128;font-size:19px;color:#535d50;line-height:1.5}.meta .slot{color:#a04b40;font:21px 'KaiTi','SimSun',serif;letter-spacing:2px}.meta small{font-size:16px;color:#92917f;margin-right:9px}
|
|
33
|
+
.meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 26px;margin:24px 0 0;padding:15px 0;border-top:1px solid #8a8a7144;border-bottom:1px solid #8a8a7128;font-size:19px;color:#535d50;line-height:1.5}.meta .slot{color:#a04b40;font:21px 'KaiTi','SimSun',serif;letter-spacing:2px}.meta .author{min-width:0;overflow-wrap:anywhere}.meta small{font-size:16px;color:#92917f;margin-right:9px}
|
|
33
34
|
.art{position:relative;width:610px;height:610px;max-width:100%;margin:18px auto 11px;display:grid;place-items:center;isolation:isolate;overflow:hidden}.art:before{content:'';position:absolute;inset:4%;border-radius:48% 52% 56% 44%;background:radial-gradient(ellipse,#aab4a443,transparent 69%);transform:rotate(-12deg)}.equipment-artwork{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;filter:saturate(.72) contrast(.97);mix-blend-mode:multiply;mask-image:linear-gradient(to bottom,transparent 0,#000 8%,#000 84%,transparent 100%),linear-gradient(to right,transparent 0,#000 7%,#000 93%,transparent 100%);mask-composite:intersect}.art-fallback{position:relative;width:360px;height:360px;max-width:90%;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#7d8b7d;border:1px solid #7c887d3b;border-radius:50%;background:radial-gradient(circle,#b1b9a435,transparent 70%);font-family:'KaiTi','SimSun',serif}.art-fallback:before,.art-fallback:after{content:'';position:absolute;inset:21px;border:1px solid #7c887d22;border-radius:50%}.art-fallback:after{inset:48px;border-color:#9a9e8533}.art-fallback .glyph{font-size:126px;line-height:1.2;opacity:.46}.art-fallback .kind{font-size:20px;letter-spacing:4px;opacity:.55}.art:has(.equipment-artwork) .art-fallback{visibility:hidden}.placeholder-note{position:absolute;right:18px;bottom:16px;z-index:2;padding:5px 9px;background:#f4f1e8ce;border:1px solid #9d9b8755;color:#536055;font:18px 'KaiTi','SimSun',serif;letter-spacing:2px}
|
|
34
35
|
.power{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 0 22px;border-top:1px solid #8a8a7128;border-bottom:1px solid #8a8a7144;color:#31463e}.power span{font:24px 'KaiTi','SimSun',serif;letter-spacing:12px}.power strong{font:700 45px/1.1 Georgia,'Times New Roman',serif;letter-spacing:2px;font-variant-numeric:lining-nums}
|
|
35
36
|
.section{margin-top:29px}.section h2{display:flex;align-items:center;gap:16px;margin:0 0 17px;color:#626e5e;font:21px 'KaiTi','SimSun',serif;letter-spacing:5px}.section h2:before{content:'';width:5px;height:17px;background:#a04b40;transform:rotate(8deg);opacity:.75}.section h2:after{content:'';height:1px;flex:1;background:linear-gradient(to right,#7f897c55,transparent)}
|
|
36
37
|
.affixes{display:grid;grid-template-columns:1fr 1fr;column-gap:26px}.affix{display:flex;align-items:baseline;justify-content:space-between;gap:10px;min-width:0;padding:9px 0 12px;border-bottom:1px solid #8a8a7124;font-size:18px;color:#697064}.affix span{overflow-wrap:anywhere}.affix strong{flex-shrink:0;font:700 22px Georgia,'KaiTi',serif;color:#344b42}.empty-line{font-size:18px;color:#92917f;margin:4px 0 12px}
|
|
37
38
|
.skill{display:flex;align-items:baseline;justify-content:space-between;gap:18px;padding:5px 0 10px;font-size:20px;color:#304b40}.skill-name{font-weight:700;overflow-wrap:anywhere}.skill-name i{display:inline-block;width:13px;height:13px;margin:0 17px 1px 4px;background:#a04b40;transform:rotate(45deg)}.rank{font:18px Georgia,'KaiTi',serif;color:#7f8d7b;white-space:nowrap}
|
|
38
39
|
.description p{margin:0;font:22px/1.75 'KaiTi','STKaiti','Noto Serif CJK SC','SimSun',serif;white-space:pre-wrap;overflow-wrap:anywhere;color:#313f38}.price{display:flex;align-items:baseline;gap:16px;margin-top:24px;padding-top:17px;border-top:1px solid #8a8a7128;font-size:18px;color:#8b907d}.price strong{font-size:18px;color:#354c42}.notes{margin-top:17px;padding:10px 15px;border-left:3px solid #a04b4080;background:#e8e8db70;color:#3e5549}.notes p{margin:5px 0;font-size:17px;line-height:1.6;overflow-wrap:anywhere}.edition{display:flex;align-items:center;gap:12px;justify-content:center;margin-top:34px;color:#a6a38e;font:14px 'KaiTi','SimSun',serif;letter-spacing:5px}.edition:before,.edition:after{content:'';height:1px;width:32px;background:#9b9c833d}
|
|
39
|
-
</style></head><body><div id="capture" class="equipment-sheet ink-equipment-sheet"><header><div class="heading"><div class="heading-copy"><div class="overline">装 备 图 录</div><h1 class="name">${escape(card.name)}</h1></div><div class="seal"><strong>${escape(card.quality)}</strong><span>品阶</span></div></div><div class="meta"><span class="slot">${escape(card.slot)}</span>${enhancement}</div></header><div class="art"><div class="art-fallback"><span class="glyph">?</span><span class="kind">未知外观</span></div>${artwork ? `<img class="skill-artwork equipment-artwork" alt="" src="${escape(artwork)}">` : ''}${unknownFallback || !artwork ? '<span class="placeholder-note">外观暂未显现</span>' : ''}</div><div class="power"><span>装 备 战 力</span><strong>${escape(power)}</strong></div><section class="section attributes"><h2>附加属性</h2><div class="affixes">${affixes}</div></section>${skills}${description}${price}${notes}<div class="edition">露 · 装备录</div></div></body></html>`
|
|
40
|
+
</style></head><body><div id="capture" class="equipment-sheet ink-equipment-sheet"><header><div class="heading"><div class="heading-copy"><div class="overline">装 备 图 录</div><h1 class="name">${escape(card.name)}</h1></div><div class="seal"><strong>${escape(card.quality)}</strong><span>品阶</span></div></div><div class="meta"><span class="slot">${escape(card.slot)}</span>${enhancement}${author}</div></header><div class="art"><div class="art-fallback"><span class="glyph">?</span><span class="kind">未知外观</span></div>${artwork ? `<img class="skill-artwork equipment-artwork" alt="" src="${escape(artwork)}">` : ''}${unknownFallback || !artwork ? '<span class="placeholder-note">外观暂未显现</span>' : ''}</div><div class="power"><span>装 备 战 力</span><strong>${escape(power)}</strong></div><section class="section attributes"><h2>附加属性</h2><div class="affixes">${affixes}</div></section>${skills}${description}${price}${notes}<div class="edition">露 · 装备录</div></div></body></html>`
|
|
40
41
|
}
|
|
@@ -129,7 +129,10 @@ export function renderQQPageMarkdown(data: MsgMessage, showGreeting: boolean): s
|
|
|
129
129
|
hasPageSummary = true
|
|
130
130
|
break
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
const command = entryCommands.get(lineIndex)
|
|
133
|
+
bodyLines.push(command
|
|
134
|
+
? `[${escapeMarkdown(compactDisplayText(item.content))}](${inlineCommandUrl(command)})`
|
|
135
|
+
: escapeMarkdown(item.content))
|
|
133
136
|
break
|
|
134
137
|
}
|
|
135
138
|
case MessageType.error:
|
|
@@ -165,19 +168,12 @@ export function canSendQQPage(session: Session | undefined, data: MsgMessage): s
|
|
|
165
168
|
/** Send a native QQ Markdown page with inline command links. */
|
|
166
169
|
export async function sendQQPage(session: Session, data: MsgMessage): Promise<void> {
|
|
167
170
|
const internal = (session.bot as typeof session.bot & { internal: QQInternal }).internal
|
|
168
|
-
const nav = data.pageNav!
|
|
169
171
|
const markdown = renderQQPageMarkdown(data, session.event?.channel?.type === 0)
|
|
170
|
-
const hasInlineNavigation = !!(nav.previousCommand || nav.nextCommand || nav.entries?.length)
|
|
171
|
-
const hasInlineHelp = data.line.some(item => item.type === MessageType.line && item.content === '[指令]相关指令')
|
|
172
172
|
const request: QQRequest = {
|
|
173
173
|
// With msg_type=2, QQ requires the ordinary content field to be empty.
|
|
174
174
|
content: '',
|
|
175
175
|
msg_type: 2,
|
|
176
|
-
markdown: {
|
|
177
|
-
content: !session.isDirect && (hasInlineNavigation || hasInlineHelp)
|
|
178
|
-
? `${markdown}\n\n点击后如未自动发送,请点发送。`
|
|
179
|
-
: markdown,
|
|
180
|
-
},
|
|
176
|
+
markdown: { content: markdown },
|
|
181
177
|
}
|
|
182
178
|
// Match the QQ adapter's passive-reply sequence.
|
|
183
179
|
const age = Date.now() - session.timestamp
|
|
@@ -20,7 +20,7 @@ export interface ServiceType {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const serviceProto: ServiceProto<ServiceType> = {
|
|
23
|
-
"version":
|
|
23
|
+
"version": 11,
|
|
24
24
|
"services": [
|
|
25
25
|
{
|
|
26
26
|
"id": 0,
|
|
@@ -612,6 +612,14 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
|
|
612
612
|
}
|
|
613
613
|
},
|
|
614
614
|
"optional": true
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"id": 12,
|
|
618
|
+
"name": "authorName",
|
|
619
|
+
"type": {
|
|
620
|
+
"type": "String"
|
|
621
|
+
},
|
|
622
|
+
"optional": true
|
|
615
623
|
}
|
|
616
624
|
]
|
|
617
625
|
},
|
|
@@ -1042,4 +1050,4 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
|
|
1042
1050
|
]
|
|
1043
1051
|
}
|
|
1044
1052
|
}
|
|
1045
|
-
};
|
|
1053
|
+
};
|
package/src/shared/face/index.ts
CHANGED