koishi-plugin-cocoyyy-console 1.2.0 → 1.2.1-alpha.2
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 +9 -13
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1048,8 +1048,8 @@ ${exec2.result?.map((item) => import_koishi11.h.image((0, import_url.pathToFileU
|
|
|
1048
1048
|
let exec = await randomImgByTag(tag, session.guildId);
|
|
1049
1049
|
if (!exec)
|
|
1050
1050
|
return `获取图片失败`;
|
|
1051
|
-
let
|
|
1052
|
-
return import_koishi11.h.image(
|
|
1051
|
+
let path3 = (0, import_url.pathToFileURL)(exec).href;
|
|
1052
|
+
return import_koishi11.h.image(path3);
|
|
1053
1053
|
});
|
|
1054
1054
|
ctx.command("bind <参数>", "标签绑定别名").action(async ({ session }, ...args) => {
|
|
1055
1055
|
if (!dev_mode) {
|
|
@@ -3653,8 +3653,9 @@ __name(registerSumCommands, "registerSumCommands");
|
|
|
3653
3653
|
|
|
3654
3654
|
// src/services/jm_func/jm_service.ts
|
|
3655
3655
|
var import_axios4 = __toESM(require("axios"));
|
|
3656
|
-
var import_fs4 = require("fs");
|
|
3657
3656
|
var import_koishi17 = require("koishi");
|
|
3657
|
+
var import_path4 = __toESM(require("path"));
|
|
3658
|
+
var import_url2 = require("url");
|
|
3658
3659
|
var guildActiveTasks = /* @__PURE__ */ new Map();
|
|
3659
3660
|
function normalizeBaseUrl(apiUrl) {
|
|
3660
3661
|
return apiUrl.replace(/\/+$/, "");
|
|
@@ -3755,10 +3756,6 @@ async function deleteAlbum(albumId, config) {
|
|
|
3755
3756
|
}
|
|
3756
3757
|
}
|
|
3757
3758
|
__name(deleteAlbum, "deleteAlbum");
|
|
3758
|
-
async function readLocalPdf(pdfPath) {
|
|
3759
|
-
return import_fs4.promises.readFile(pdfPath);
|
|
3760
|
-
}
|
|
3761
|
-
__name(readLocalPdf, "readLocalPdf");
|
|
3762
3759
|
async function notifyUser(bot, record, message) {
|
|
3763
3760
|
await bot.sendMessage(record.channelId, message);
|
|
3764
3761
|
}
|
|
@@ -3800,17 +3797,16 @@ async function pollAndDeliver(bot, record, config) {
|
|
|
3800
3797
|
const pdfPath = task.pdf_path;
|
|
3801
3798
|
if (!pdfPath)
|
|
3802
3799
|
throw new Error("任务成功但未返回文件路径");
|
|
3803
|
-
const
|
|
3804
|
-
const filename = `${record.albumId}.pdf` || task.pdf_filename;
|
|
3800
|
+
const filepath = import_path4.default.resolve(pdfPath);
|
|
3805
3801
|
message = [
|
|
3806
3802
|
(0, import_koishi17.h)("at", { id: record.userId }),
|
|
3807
|
-
` 本子[${record.albumId}]
|
|
3808
|
-
import_koishi17.h.file(
|
|
3803
|
+
` 本子[${record.albumId}]下载完成,文件已上传。`,
|
|
3804
|
+
import_koishi17.h.file((0, import_url2.pathToFileURL)(filepath).href)
|
|
3809
3805
|
];
|
|
3810
3806
|
} catch (error) {
|
|
3811
3807
|
const errorMsg = error?.message || String(error);
|
|
3812
|
-
logger.error("[jm
|
|
3813
|
-
message = `${(0, import_koishi17.h)("at", { id: record.userId })}
|
|
3808
|
+
logger.error("[jm upload_group_file Error]: " + errorMsg);
|
|
3809
|
+
message = `${(0, import_koishi17.h)("at", { id: record.userId })} 文件上传失败:${errorMsg}`;
|
|
3814
3810
|
}
|
|
3815
3811
|
await deliver(message);
|
|
3816
3812
|
return;
|