koishi-plugin-best-cave 1.5.6 → 1.5.7
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 +6 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -99,7 +99,7 @@ var FileHandler = class {
|
|
|
99
99
|
return await operation();
|
|
100
100
|
} catch (error) {
|
|
101
101
|
if (i === this.RETRY_COUNT - 1) throw error;
|
|
102
|
-
await new Promise((
|
|
102
|
+
await new Promise((resolve2) => setTimeout(resolve2, this.RETRY_DELAY));
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
throw new Error("Operation failed after retries");
|
|
@@ -1182,6 +1182,8 @@ ${session.text("commands.cave.audit.from")}${cave.contributor_number}`;
|
|
|
1182
1182
|
var import_koishi5 = require("koishi");
|
|
1183
1183
|
var fs5 = __toESM(require("fs"));
|
|
1184
1184
|
var path5 = __toESM(require("path"));
|
|
1185
|
+
var import_url = require("url");
|
|
1186
|
+
var import_path = require("path");
|
|
1185
1187
|
var logger4 = new import_koishi5.Logger("MediaHandle");
|
|
1186
1188
|
async function buildMessage(cave, resourceDir, session) {
|
|
1187
1189
|
if (!cave?.elements?.length) {
|
|
@@ -1207,11 +1209,9 @@ async function buildMessage(cave, resourceDir, session) {
|
|
|
1207
1209
|
if (element.type === "text") {
|
|
1208
1210
|
lines.push(element.content);
|
|
1209
1211
|
} else if (element.type === "img" && element.file) {
|
|
1210
|
-
const filePath =
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
lines.push((0, import_koishi5.h)("image", { src: base64Data }));
|
|
1214
|
-
}
|
|
1212
|
+
const filePath = (0, import_path.resolve)(resourceDir, element.file);
|
|
1213
|
+
const fileUrl = (0, import_url.pathToFileURL)(filePath);
|
|
1214
|
+
lines.push((0, import_koishi5.h)("image", { src: fileUrl.toString() }));
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
1217
|
lines.push(session.text("commands.cave.message.contributorSuffix", [cave.contributor_name]));
|