koishi-plugin-echo-cave 1.24.11 → 1.24.12
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.cjs +4 -10
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -347,14 +347,7 @@ async function processForwardMessageContent(ctx, session, msg, cfg) {
|
|
|
347
347
|
|
|
348
348
|
// src/core/parser/msg-parser.ts
|
|
349
349
|
async function processMessageContent(ctx, msg, cfg) {
|
|
350
|
-
return Promise.all(
|
|
351
|
-
msg.map(async (element) => {
|
|
352
|
-
if (element.type === "reply") {
|
|
353
|
-
return element;
|
|
354
|
-
}
|
|
355
|
-
return processMediaElement(ctx, element, cfg);
|
|
356
|
-
})
|
|
357
|
-
);
|
|
350
|
+
return Promise.all(msg.map(async (element) => processMediaElement(ctx, element, cfg)));
|
|
358
351
|
}
|
|
359
352
|
|
|
360
353
|
// src/core/command/add-cave.ts
|
|
@@ -400,7 +393,8 @@ async function addCave(ctx, session, cfg, userIds) {
|
|
|
400
393
|
if (typeof message === "string") {
|
|
401
394
|
msgJson = import_koishi_plugin_adapter_onebot.CQCode.parse(message);
|
|
402
395
|
} else {
|
|
403
|
-
|
|
396
|
+
const firstMsgType = message[0].type;
|
|
397
|
+
if (firstMsgType === "video" || firstMsgType === "file" || firstMsgType === "record" || message.some((m) => m.type === "reply")) {
|
|
404
398
|
type = "forward";
|
|
405
399
|
}
|
|
406
400
|
msgJson = message;
|
|
@@ -567,7 +561,7 @@ async function sendCaveMsg(ctx, session, caveMsg, cfg) {
|
|
|
567
561
|
};
|
|
568
562
|
const TEMPLATE_COUNT = 5;
|
|
569
563
|
const isActualForward = content.some((item) => item.type === "node");
|
|
570
|
-
const shouldSendAsForward = cfg.sendAllAsForwardMsg || caveMsg.type === "forward"
|
|
564
|
+
const shouldSendAsForward = cfg.sendAllAsForwardMsg || caveMsg.type === "forward";
|
|
571
565
|
if (shouldSendAsForward) {
|
|
572
566
|
const availableTemplates2 = [];
|
|
573
567
|
for (let i = 0; i < TEMPLATE_COUNT; i++) {
|