@azimiao/koishi-plugin-cafe-bot-exp 0.0.21 → 0.0.22
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/config.d.ts +5 -1
- package/lib/index.js +19 -3
- package/package.json +1 -1
package/lib/config.d.ts
CHANGED
|
@@ -2,5 +2,9 @@ import { Schema } from "koishi";
|
|
|
2
2
|
import { CafeBotDrawConfig } from "./draw/config";
|
|
3
3
|
import { CafeBotQuizConfig } from "./quiz/config";
|
|
4
4
|
import { CafeBotCatConfig } from "./cat/config";
|
|
5
|
-
export
|
|
5
|
+
export interface CafeBotConfig {
|
|
6
|
+
logoUrl: string;
|
|
7
|
+
refreshLogoWhenLoad: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type Config = CafeBotConfig & CafeBotDrawConfig & CafeBotQuizConfig & CafeBotCatConfig;
|
|
6
10
|
export declare const Config: Schema<Config>;
|
package/lib/index.js
CHANGED
|
@@ -37,10 +37,13 @@ __export(src_exports, {
|
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(src_exports);
|
|
39
39
|
var import_url = require("url");
|
|
40
|
-
var import_path = require("path");
|
|
41
40
|
|
|
42
41
|
// package.json
|
|
43
|
-
var version = "0.0.
|
|
42
|
+
var version = "0.0.22";
|
|
43
|
+
|
|
44
|
+
// src/index.ts
|
|
45
|
+
var fs4 = __toESM(require("fs/promises"));
|
|
46
|
+
var path3 = __toESM(require("path"));
|
|
44
47
|
|
|
45
48
|
// src/draw/index.ts
|
|
46
49
|
var draw_exports = {};
|
|
@@ -802,6 +805,10 @@ __name(apply3, "apply");
|
|
|
802
805
|
// src/config.ts
|
|
803
806
|
var import_koishi7 = require("koishi");
|
|
804
807
|
var Config4 = import_koishi7.Schema.intersect([
|
|
808
|
+
import_koishi7.Schema.object({
|
|
809
|
+
logoUrl: import_koishi7.Schema.string().description("LOGO图片").default("https://www.azimiao.com/wp-content/uploads/2025/05/cafe-wide.jpg"),
|
|
810
|
+
refreshLogoWhenLoad: import_koishi7.Schema.boolean().description("每次加载插件强制刷新logo").default(false)
|
|
811
|
+
}),
|
|
805
812
|
CafeBotDrawConfig.collapse(),
|
|
806
813
|
CafeBotQuizConfig.collapse(),
|
|
807
814
|
CafeBotCatConfig.collapse()
|
|
@@ -813,13 +820,22 @@ var inject3 = {
|
|
|
813
820
|
required: ["http", "cache", "database"],
|
|
814
821
|
optional: ["logger"]
|
|
815
822
|
};
|
|
823
|
+
var logger3 = null;
|
|
824
|
+
var logoFilePath = null;
|
|
816
825
|
async function apply4(ctx, config) {
|
|
826
|
+
logger3 = ctx.logger(name4);
|
|
817
827
|
ctx.plugin(draw_exports, config);
|
|
818
828
|
ctx.plugin(quiz_exports, config);
|
|
819
829
|
ctx.plugin(cat_exports, config);
|
|
830
|
+
const root = path3.join(ctx.baseDir, "data", `${name4}-data`);
|
|
831
|
+
await fs4.mkdir(root, { recursive: true });
|
|
832
|
+
logoFilePath = path3.join(root, "logo.jpg");
|
|
833
|
+
logger3?.info(`Try check logoFile ${logoFilePath} or download it, forceUpdate:${config.refreshLogoWhenLoad}`);
|
|
834
|
+
var result = await downloadTool_default(ctx.http, config.logoUrl, logoFilePath, config.refreshLogoWhenLoad);
|
|
835
|
+
logger3?.info(`download file ${result ? "ok" : "failed"}`);
|
|
820
836
|
ctx.command("关于", "关于本机器人的信息").action(async (argv, _) => {
|
|
821
837
|
argv.session?.send(
|
|
822
|
-
`<img src="${(0, import_url.pathToFileURL)(
|
|
838
|
+
`<img src="${(0, import_url.pathToFileURL)(logoFilePath).href}"/>
|
|
823
839
|
Hi~我是轨迹CafeBot概念版v${version}🎉~
|
|
824
840
|
我运行在🖥️超级计算机『卡佩尔』上🛜
|
|
825
841
|
🔹 我提供轨迹抽卡🎴和轨迹问答🙋功能
|