koishi-plugin-cocoyyy-console 1.2.0 → 1.2.1-alpha.1
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 -11
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -3653,7 +3653,6 @@ __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");
|
|
3658
3657
|
var guildActiveTasks = /* @__PURE__ */ new Map();
|
|
3659
3658
|
function normalizeBaseUrl(apiUrl) {
|
|
@@ -3755,10 +3754,6 @@ async function deleteAlbum(albumId, config) {
|
|
|
3755
3754
|
}
|
|
3756
3755
|
}
|
|
3757
3756
|
__name(deleteAlbum, "deleteAlbum");
|
|
3758
|
-
async function readLocalPdf(pdfPath) {
|
|
3759
|
-
return import_fs4.promises.readFile(pdfPath);
|
|
3760
|
-
}
|
|
3761
|
-
__name(readLocalPdf, "readLocalPdf");
|
|
3762
3757
|
async function notifyUser(bot, record, message) {
|
|
3763
3758
|
await bot.sendMessage(record.channelId, message);
|
|
3764
3759
|
}
|
|
@@ -3800,17 +3795,20 @@ async function pollAndDeliver(bot, record, config) {
|
|
|
3800
3795
|
const pdfPath = task.pdf_path;
|
|
3801
3796
|
if (!pdfPath)
|
|
3802
3797
|
throw new Error("任务成功但未返回文件路径");
|
|
3803
|
-
const
|
|
3804
|
-
|
|
3798
|
+
const filename = `${record.albumId}.pdf`;
|
|
3799
|
+
await bot.internal.upload_group_file({
|
|
3800
|
+
group_id: Number(record.guildId),
|
|
3801
|
+
file: pdfPath,
|
|
3802
|
+
name: filename
|
|
3803
|
+
});
|
|
3805
3804
|
message = [
|
|
3806
3805
|
(0, import_koishi17.h)("at", { id: record.userId }),
|
|
3807
|
-
` 本子[${record.albumId}]
|
|
3808
|
-
import_koishi17.h.file(pdfBuffer, "application/pdf", { name: filename })
|
|
3806
|
+
` 本子[${record.albumId}]下载完成,文件已上传至群文件。`
|
|
3809
3807
|
];
|
|
3810
3808
|
} catch (error) {
|
|
3811
3809
|
const errorMsg = error?.message || String(error);
|
|
3812
|
-
logger.error("[jm
|
|
3813
|
-
message = `${(0, import_koishi17.h)("at", { id: record.userId })}
|
|
3810
|
+
logger.error("[jm upload_group_file Error]: " + errorMsg);
|
|
3811
|
+
message = `${(0, import_koishi17.h)("at", { id: record.userId })} 文件上传失败:${errorMsg}`;
|
|
3814
3812
|
}
|
|
3815
3813
|
await deliver(message);
|
|
3816
3814
|
return;
|