koishi-plugin-echo-cave 1.19.3 → 1.20.0
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/config/config.d.ts +1 -0
- package/lib/index.cjs +22 -4
- package/package.json +1 -1
package/lib/config/config.d.ts
CHANGED
package/lib/index.cjs
CHANGED
|
@@ -42,7 +42,8 @@ var require_zh_CN = __commonJS({
|
|
|
42
42
|
maxVideoSize: "\u6700\u5927\u89C6\u9891\u5927\u5C0F (MB)",
|
|
43
43
|
maxFileSize: "\u6700\u5927\u6587\u4EF6\u5927\u5C0F (MB)",
|
|
44
44
|
maxRecordSize: "\u6700\u5927\u5F55\u97F3\u5927\u5C0F (MB)",
|
|
45
|
-
useBase64ForMedia: "\u662F\u5426\u4F7F\u7528 Base64 \u7F16\u7801\u53D1\u9001\u5A92\u4F53\u6587\u4EF6\uFF0C\u5F00\u542F\u540E\u5C06\u8BFB\u53D6 base64 \u7F16\u7801\u53D1\u9001\u800C\u4E0D\u662F\u4F7F\u7528 file uri"
|
|
45
|
+
useBase64ForMedia: "\u662F\u5426\u4F7F\u7528 Base64 \u7F16\u7801\u53D1\u9001\u5A92\u4F53\u6587\u4EF6\uFF0C\u5F00\u542F\u540E\u5C06\u8BFB\u53D6 base64 \u7F16\u7801\u53D1\u9001\u800C\u4E0D\u662F\u4F7F\u7528 file uri",
|
|
46
|
+
sendAllAsForwardMsg: "\u662F\u5426\u5C06\u6240\u6709\u6D88\u606F\u4EE5\u8F6C\u53D1\u6D88\u606F\u5F62\u5F0F\u53D1\u9001\uFF0C\u5F00\u542F\u540E\u666E\u901A\u6D88\u606F\u4E5F\u4F1A\u8F6C\u6362\u4E3A\u8F6C\u53D1\u6D88\u606F\u683C\u5F0F"
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
});
|
|
@@ -708,7 +709,9 @@ async function sendCaveMsg(ctx, session, caveMsg, cfg) {
|
|
|
708
709
|
nl: "\n"
|
|
709
710
|
};
|
|
710
711
|
const TEMPLATE_COUNT = 5;
|
|
711
|
-
|
|
712
|
+
const isActualForward = content.some((item) => item.type === "node");
|
|
713
|
+
const shouldSendAsForward = cfg.sendAllAsForwardMsg || caveMsg.type === "forward" && isActualForward;
|
|
714
|
+
if (shouldSendAsForward) {
|
|
712
715
|
const availableTemplates2 = [];
|
|
713
716
|
for (let i = 0; i < TEMPLATE_COUNT; i++) {
|
|
714
717
|
const template = session.text(`echo-cave.templates.forward.${i}`, templateData);
|
|
@@ -722,7 +725,21 @@ async function sendCaveMsg(ctx, session, caveMsg, cfg) {
|
|
|
722
725
|
}
|
|
723
726
|
const chosenTemplate2 = availableTemplates2[Math.floor(Math.random() * availableTemplates2.length)];
|
|
724
727
|
await session.onebot.sendGroupMsg(channelId, [createTextMsg(chosenTemplate2)]);
|
|
725
|
-
|
|
728
|
+
if (!isActualForward) {
|
|
729
|
+
const forwardContent = [
|
|
730
|
+
{
|
|
731
|
+
type: "node",
|
|
732
|
+
data: {
|
|
733
|
+
user_id: caveMsg.originUserId,
|
|
734
|
+
nickname: originName,
|
|
735
|
+
content
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
];
|
|
739
|
+
await session.onebot.sendGroupForwardMsg(channelId, forwardContent);
|
|
740
|
+
} else {
|
|
741
|
+
await session.onebot.sendGroupForwardMsg(channelId, content);
|
|
742
|
+
}
|
|
726
743
|
return;
|
|
727
744
|
}
|
|
728
745
|
const availableTemplates = [];
|
|
@@ -899,7 +916,8 @@ var Config = import_koishi2.Schema.object({
|
|
|
899
916
|
maxVideoSize: import_koishi2.Schema.number().default(512),
|
|
900
917
|
maxFileSize: import_koishi2.Schema.number().default(512),
|
|
901
918
|
maxRecordSize: import_koishi2.Schema.number().default(512),
|
|
902
|
-
useBase64ForMedia: import_koishi2.Schema.boolean().default(false)
|
|
919
|
+
useBase64ForMedia: import_koishi2.Schema.boolean().default(false),
|
|
920
|
+
sendAllAsForwardMsg: import_koishi2.Schema.boolean().default(false)
|
|
903
921
|
}).i18n({
|
|
904
922
|
"zh-CN": require_zh_CN()
|
|
905
923
|
});
|