@azimiao/koishi-plugin-cafe-bot-exp 0.0.20 → 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 +22 -4
- package/package.json +1 -1
- package/readme.md +2 -0
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
|
@@ -36,9 +36,14 @@ __export(src_exports, {
|
|
|
36
36
|
name: () => name4
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(src_exports);
|
|
39
|
+
var import_url = require("url");
|
|
39
40
|
|
|
40
41
|
// package.json
|
|
41
|
-
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"));
|
|
42
47
|
|
|
43
48
|
// src/draw/index.ts
|
|
44
49
|
var draw_exports = {};
|
|
@@ -800,6 +805,10 @@ __name(apply3, "apply");
|
|
|
800
805
|
// src/config.ts
|
|
801
806
|
var import_koishi7 = require("koishi");
|
|
802
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
|
+
}),
|
|
803
812
|
CafeBotDrawConfig.collapse(),
|
|
804
813
|
CafeBotQuizConfig.collapse(),
|
|
805
814
|
CafeBotCatConfig.collapse()
|
|
@@ -811,14 +820,23 @@ var inject3 = {
|
|
|
811
820
|
required: ["http", "cache", "database"],
|
|
812
821
|
optional: ["logger"]
|
|
813
822
|
};
|
|
823
|
+
var logger3 = null;
|
|
824
|
+
var logoFilePath = null;
|
|
814
825
|
async function apply4(ctx, config) {
|
|
826
|
+
logger3 = ctx.logger(name4);
|
|
815
827
|
ctx.plugin(draw_exports, config);
|
|
816
828
|
ctx.plugin(quiz_exports, config);
|
|
817
829
|
ctx.plugin(cat_exports, config);
|
|
818
|
-
ctx.
|
|
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"}`);
|
|
836
|
+
ctx.command("关于", "关于本机器人的信息").action(async (argv, _) => {
|
|
819
837
|
argv.session?.send(
|
|
820
|
-
`<img src="
|
|
821
|
-
|
|
838
|
+
`<img src="${(0, import_url.pathToFileURL)(logoFilePath).href}"/>
|
|
839
|
+
Hi~我是轨迹CafeBot概念版v${version}🎉~
|
|
822
840
|
我运行在🖥️超级计算机『卡佩尔』上🛜
|
|
823
841
|
🔹 我提供轨迹抽卡🎴和轨迹问答🙋功能
|
|
824
842
|
🔹 另外我还有一些隐藏功能待你探索哦🎁
|
package/package.json
CHANGED