koishi-plugin-best-cave 1.5.11 → 1.5.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.js +3 -11
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1300,17 +1300,9 @@ async function sendMessage(session, key, params = [], isTemp = true, timeout = 1
|
|
|
1300
1300
|
}
|
|
1301
1301
|
__name(sendMessage, "sendMessage");
|
|
1302
1302
|
async function processMediaFile(filePath, type) {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
return filePath;
|
|
1307
|
-
} else {
|
|
1308
|
-
const data = await fs5.promises.readFile(filePath);
|
|
1309
|
-
return `data:${type}/mp4;base64,${data.toString("base64")}`;
|
|
1310
|
-
}
|
|
1311
|
-
} catch {
|
|
1312
|
-
return null;
|
|
1313
|
-
}
|
|
1303
|
+
const data = await fs5.promises.readFile(filePath).catch(() => null);
|
|
1304
|
+
if (!data) return null;
|
|
1305
|
+
return `data:${type}/${type === "image" ? "png" : "mp4"};base64,${data.toString("base64")}`;
|
|
1314
1306
|
}
|
|
1315
1307
|
__name(processMediaFile, "processMediaFile");
|
|
1316
1308
|
async function extractMediaContent(originalContent, config, session) {
|