@azimiao/koishi-plugin-cafe-bot-exp 0.0.26 → 0.0.27
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/DailySeededName.d.ts +1 -0
- package/lib/DailySeededRandom.d.ts +2 -0
- package/lib/PseudoRandom.d.ts +11 -0
- package/lib/cat/index.d.ts +5 -0
- package/lib/draw/index.d.ts +4 -0
- package/lib/index.d.ts +6 -1
- package/lib/index.js +130 -113
- package/lib/quiz/index.d.ts +4 -0
- package/lib/templete/html.d.ts +2 -0
- package/package.json +7 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DailySeededName(uid: any): string;
|
package/lib/cat/index.d.ts
CHANGED
|
@@ -7,4 +7,9 @@ export declare const name = "cafe-bot-exp.cat";
|
|
|
7
7
|
export interface Config extends CafeBotCatConfig {
|
|
8
8
|
}
|
|
9
9
|
export declare const Config: Schema<Config>;
|
|
10
|
+
export declare const injectDepend: {
|
|
11
|
+
required: any[];
|
|
12
|
+
optional: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare const inject: any[];
|
|
10
15
|
export declare function apply(ctx: Context): Promise<void>;
|
package/lib/draw/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
import { Context, Schema } from 'koishi';
|
|
5
5
|
import { CafeBotDrawConfig } from './config';
|
|
6
6
|
export declare const name = "cafe-bot-exp.draw";
|
|
7
|
+
export declare const injectDepend: {
|
|
8
|
+
required: string[];
|
|
9
|
+
optional: string[];
|
|
10
|
+
};
|
|
7
11
|
export declare const inject: string[];
|
|
8
12
|
export interface Config extends CafeBotDrawConfig {
|
|
9
13
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Context } from 'koishi';
|
|
5
5
|
import { Config } from './config';
|
|
6
|
+
import '@koishijs/censor';
|
|
7
|
+
import * as draw from "./draw/index";
|
|
8
|
+
import * as quiz from "./quiz/index";
|
|
9
|
+
import * as cat from "./cat/index";
|
|
6
10
|
export declare const name = "cafe-bot-exp";
|
|
7
11
|
export * from "./config";
|
|
12
|
+
export declare const plugins: (typeof draw | typeof quiz | typeof cat)[];
|
|
8
13
|
export declare const inject: {
|
|
9
|
-
required:
|
|
14
|
+
required: any[];
|
|
10
15
|
optional: string[];
|
|
11
16
|
};
|
|
12
17
|
export declare function apply(ctx: Context, config: Config): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -32,16 +32,18 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Config: () => Config4,
|
|
34
34
|
apply: () => apply4,
|
|
35
|
-
inject: () =>
|
|
36
|
-
name: () => name4
|
|
35
|
+
inject: () => inject4,
|
|
36
|
+
name: () => name4,
|
|
37
|
+
plugins: () => plugins
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(src_exports);
|
|
39
40
|
var import_url = require("url");
|
|
40
41
|
|
|
41
42
|
// package.json
|
|
42
|
-
var version = "0.0.
|
|
43
|
+
var version = "0.0.27";
|
|
43
44
|
|
|
44
45
|
// src/index.ts
|
|
46
|
+
var import_censor = require("@koishijs/censor");
|
|
45
47
|
var fs4 = __toESM(require("fs/promises"));
|
|
46
48
|
var path3 = __toESM(require("path"));
|
|
47
49
|
|
|
@@ -51,6 +53,7 @@ __export(draw_exports, {
|
|
|
51
53
|
Config: () => Config,
|
|
52
54
|
apply: () => apply,
|
|
53
55
|
inject: () => inject,
|
|
56
|
+
injectDepend: () => injectDepend,
|
|
54
57
|
name: () => name
|
|
55
58
|
});
|
|
56
59
|
var fs2 = __toESM(require("fs/promises"));
|
|
@@ -97,12 +100,12 @@ var PseudoRandom = class {
|
|
|
97
100
|
"seed": this.seed
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
|
-
next = () => {
|
|
103
|
+
next = /* @__PURE__ */ __name(() => {
|
|
101
104
|
return this.randFunc();
|
|
102
|
-
};
|
|
103
|
-
nextInt = (min, max) => {
|
|
105
|
+
}, "next");
|
|
106
|
+
nextInt = /* @__PURE__ */ __name((min, max) => {
|
|
104
107
|
return Math.floor(this.next() * (max - min + 1)) + min;
|
|
105
|
-
};
|
|
108
|
+
}, "nextInt");
|
|
106
109
|
};
|
|
107
110
|
var PseudoRandom_default = PseudoRandom;
|
|
108
111
|
|
|
@@ -316,7 +319,11 @@ var downloadTool_default = downloadFileIfNotExist;
|
|
|
316
319
|
|
|
317
320
|
// src/draw/index.ts
|
|
318
321
|
var name = "cafe-bot-exp.draw";
|
|
319
|
-
var
|
|
322
|
+
var injectDepend = {
|
|
323
|
+
required: ["http"],
|
|
324
|
+
optional: ["logger"]
|
|
325
|
+
};
|
|
326
|
+
var inject = ["http"];
|
|
320
327
|
var Config = CafeBotDrawConfig;
|
|
321
328
|
var animals = ["瑟蕾奴", "可鲁贝洛斯", "捷欧", "基库", "蔡特", "柯贝", "古利亚诺斯", "小星", "影良", "fio", "xeros"];
|
|
322
329
|
var starEnum = [5, 4, 3, 2, 1];
|
|
@@ -491,103 +498,34 @@ async function apply(ctx, config) {
|
|
|
491
498
|
}
|
|
492
499
|
__name(apply, "apply");
|
|
493
500
|
|
|
494
|
-
// src/cat/index.ts
|
|
495
|
-
var cat_exports = {};
|
|
496
|
-
__export(cat_exports, {
|
|
497
|
-
Config: () => Config2,
|
|
498
|
-
apply: () => apply2,
|
|
499
|
-
name: () => name2
|
|
500
|
-
});
|
|
501
|
-
var import_koishi4 = require("koishi");
|
|
502
|
-
|
|
503
|
-
// src/cat/config.ts
|
|
504
|
-
var import_koishi3 = require("koishi");
|
|
505
|
-
var CafeBotCatConfig = import_koishi3.Schema.object({
|
|
506
|
-
catName: import_koishi3.Schema.string().description("名称/占位").default("柯贝")
|
|
507
|
-
}).description("猫猫配置");
|
|
508
|
-
|
|
509
|
-
// src/cat/index.ts
|
|
510
|
-
var name2 = "cafe-bot-exp.cat";
|
|
511
|
-
var Config2 = CafeBotCatConfig;
|
|
512
|
-
var catWords = [
|
|
513
|
-
"喵呀呜~ ",
|
|
514
|
-
"喵呀~呵",
|
|
515
|
-
// 走这边。(带路时)
|
|
516
|
-
"喵呀~~噢",
|
|
517
|
-
// 说得没错。就是这样。
|
|
518
|
-
"喵呀~嘎~",
|
|
519
|
-
// 高兴的表现。
|
|
520
|
-
"喵呀~~呵",
|
|
521
|
-
// 稍等一下。(引起注意)
|
|
522
|
-
"喵嘎",
|
|
523
|
-
// 爪子痒痒了。(焦躁不安)
|
|
524
|
-
"喵嘎~~ ",
|
|
525
|
-
// 肚子饿了。
|
|
526
|
-
"喵嘎呜~~",
|
|
527
|
-
// 警戒的表现。
|
|
528
|
-
"喵呜",
|
|
529
|
-
// 困了。乏了。累了。
|
|
530
|
-
"喵呜?",
|
|
531
|
-
// 您是哪位?
|
|
532
|
-
"喵呜—",
|
|
533
|
-
// 是的。
|
|
534
|
-
"喵噢?",
|
|
535
|
-
// 怎么了?
|
|
536
|
-
"喵—噢",
|
|
537
|
-
// 呦,又见面了。 (短期内再会时的招呼)
|
|
538
|
-
"喵—呵",
|
|
539
|
-
// 好久不见了。还好吗?
|
|
540
|
-
"喵~呜",
|
|
541
|
-
// 再见
|
|
542
|
-
"喵~噢",
|
|
543
|
-
// 是,就是这样。(强烈肯定)
|
|
544
|
-
"喵~~呵",
|
|
545
|
-
// 你好。
|
|
546
|
-
"呜咪嘎~ ",
|
|
547
|
-
// 打哈欠。
|
|
548
|
-
"咪呜?",
|
|
549
|
-
// 你说什么?(听到坏话反问的语气)
|
|
550
|
-
"咪~呜 ",
|
|
551
|
-
// 肚子饿了。(幼猫语)
|
|
552
|
-
"咪~~呵"
|
|
553
|
-
// 对不起
|
|
554
|
-
];
|
|
555
|
-
async function apply2(ctx) {
|
|
556
|
-
ctx.command("黑猫柯贝/摸猫", "摸摸柯贝").action(async (argv, _) => {
|
|
557
|
-
const random = new import_koishi4.Random(() => Math.random());
|
|
558
|
-
let catWord = random.pick(catWords);
|
|
559
|
-
argv.session?.send(`${At(argv)}🐱:${catWord}`);
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
__name(apply2, "apply");
|
|
563
|
-
|
|
564
501
|
// src/quiz/index.ts
|
|
565
502
|
var quiz_exports = {};
|
|
566
503
|
__export(quiz_exports, {
|
|
567
|
-
Config: () =>
|
|
568
|
-
apply: () =>
|
|
504
|
+
Config: () => Config2,
|
|
505
|
+
apply: () => apply2,
|
|
569
506
|
inject: () => inject2,
|
|
570
|
-
|
|
507
|
+
injectDepend: () => injectDepend2,
|
|
508
|
+
name: () => name2
|
|
571
509
|
});
|
|
572
|
-
var
|
|
510
|
+
var import_koishi4 = require("koishi");
|
|
573
511
|
var fs3 = __toESM(require("fs/promises"));
|
|
574
512
|
var path2 = __toESM(require("path"));
|
|
575
513
|
|
|
576
514
|
// src/quiz/config.ts
|
|
577
|
-
var
|
|
578
|
-
var CafeBotQuizConfig =
|
|
579
|
-
baseQuizUrl:
|
|
580
|
-
forceUpdateWhenLoad:
|
|
581
|
-
answerTimeout:
|
|
582
|
-
maxQuizPerDay:
|
|
583
|
-
redisServer:
|
|
515
|
+
var import_koishi3 = require("koishi");
|
|
516
|
+
var CafeBotQuizConfig = import_koishi3.Schema.object({
|
|
517
|
+
baseQuizUrl: import_koishi3.Schema.string().description("答题列表 Url").default("https://www.azimiao.com/quiz.json"),
|
|
518
|
+
forceUpdateWhenLoad: import_koishi3.Schema.boolean().description("插件加载时强制更新题目列表").default(false),
|
|
519
|
+
answerTimeout: import_koishi3.Schema.number().description("回答超时时间(秒)").default(300),
|
|
520
|
+
maxQuizPerDay: import_koishi3.Schema.number().description("每日单人最大答题数").default(5),
|
|
521
|
+
redisServer: import_koishi3.Schema.string().description("redis服务器地址"),
|
|
584
522
|
// TODO: 计划: 分数存储使用 sqlite, 临时数据(如当前题目)用内存就行了?
|
|
585
|
-
redisAuth:
|
|
523
|
+
redisAuth: import_koishi3.Schema.string().description("redis服务器密码")
|
|
586
524
|
}).description("答题配置");
|
|
587
525
|
|
|
588
526
|
// src/common/CafeTimeTools.ts
|
|
589
527
|
var CafeTimeTools = {
|
|
590
|
-
getRemainingSecondsToBeijingMidnight: function() {
|
|
528
|
+
getRemainingSecondsToBeijingMidnight: /* @__PURE__ */ __name(function() {
|
|
591
529
|
const now = /* @__PURE__ */ new Date();
|
|
592
530
|
const utcNow = now.getTime();
|
|
593
531
|
const target = new Date(now);
|
|
@@ -598,14 +536,18 @@ var CafeTimeTools = {
|
|
|
598
536
|
const diff = target.getTime() - utcNow;
|
|
599
537
|
const seconds = Math.ceil(diff / 1e3);
|
|
600
538
|
return seconds;
|
|
601
|
-
}
|
|
539
|
+
}, "getRemainingSecondsToBeijingMidnight")
|
|
602
540
|
};
|
|
603
541
|
var CafeTimeTools_default = CafeTimeTools;
|
|
604
542
|
|
|
605
543
|
// src/quiz/index.ts
|
|
606
|
-
var
|
|
607
|
-
var
|
|
608
|
-
|
|
544
|
+
var name2 = "cafe-bot-exp.quiz";
|
|
545
|
+
var injectDepend2 = {
|
|
546
|
+
required: ["http", "cache", "database"],
|
|
547
|
+
optional: ["censor", "logger"]
|
|
548
|
+
};
|
|
549
|
+
var inject2 = ["http", "cache", "database"];
|
|
550
|
+
var Config2 = CafeBotQuizConfig;
|
|
609
551
|
var validOptions = {
|
|
610
552
|
"A": 0,
|
|
611
553
|
"B": 1,
|
|
@@ -627,7 +569,7 @@ async function downloadQuitDataIfNotExist(ctx, config, forceUpdate) {
|
|
|
627
569
|
if (!forceUpdate && quizDataIds != null && quizDataIds.length > 0) {
|
|
628
570
|
return;
|
|
629
571
|
}
|
|
630
|
-
const root = path2.join(ctx.baseDir, "data", `${
|
|
572
|
+
const root = path2.join(ctx.baseDir, "data", `${name2}-data`);
|
|
631
573
|
await fs3.mkdir(root, { recursive: true });
|
|
632
574
|
const quizFilePath = path2.join(root, "quiz.json");
|
|
633
575
|
await downloadTool_default(ctx.http, config.baseQuizUrl, quizFilePath, forceUpdate);
|
|
@@ -680,13 +622,13 @@ async function answerHandler(ctx, config, argv, answer) {
|
|
|
680
622
|
var qItem = quizDataSet[lastQuestion.question];
|
|
681
623
|
logger2?.info(`${argv.session.userId} try answer quiz(id:${lastQuestion.question}): right answer:${lastQuestion.answer}, input answer:${selectNumber}`);
|
|
682
624
|
if (qItem && lastQuestion.answer == selectNumber) {
|
|
683
|
-
await argv.session?.send(`${At(argv)}回答正确😊${qItem.explain.length > 0 ? "
|
|
625
|
+
await argv.session?.send(`${At(argv)}回答正确😊${qItem.explain.length > 0 ? `,${ctx.censor ? "<censor>" : ""}` + qItem.explain + `${ctx.censor ? "</censor>" : ""}` : ""}`);
|
|
684
626
|
await ctx.database.set("cafeQuiz", userQuizA.id, {
|
|
685
627
|
right: userQuizA.right + 1
|
|
686
628
|
});
|
|
687
629
|
return;
|
|
688
630
|
} else {
|
|
689
|
-
await argv.session?.send(`${At(argv)}回答错误😟${qItem.explain2.length > 0 ? "
|
|
631
|
+
await argv.session?.send(`${At(argv)}回答错误😟${qItem.explain2.length > 0 ? `,${ctx.censor ? "<censor>" : ""}` + qItem.explain2 + `${ctx.censor ? "</censor>" : ""}` : ""}`);
|
|
690
632
|
await ctx.database.set("cafeQuiz", userQuizA.id, {
|
|
691
633
|
wrong: userQuizA.wrong + 1
|
|
692
634
|
});
|
|
@@ -694,8 +636,8 @@ async function answerHandler(ctx, config, argv, answer) {
|
|
|
694
636
|
}
|
|
695
637
|
}
|
|
696
638
|
__name(answerHandler, "answerHandler");
|
|
697
|
-
async function
|
|
698
|
-
logger2 = ctx.logger(
|
|
639
|
+
async function apply2(ctx, config) {
|
|
640
|
+
logger2 = ctx.logger(name2);
|
|
699
641
|
ctx.model.extend("cafeQuiz", {
|
|
700
642
|
id: "unsigned",
|
|
701
643
|
userId: "string",
|
|
@@ -729,9 +671,9 @@ async function apply3(ctx, config) {
|
|
|
729
671
|
var cacheTimeoutTime = CafeTimeTools_default.getRemainingSecondsToBeijingMidnight();
|
|
730
672
|
logger2?.debug(`try set cache ${dailyNameKey}, ${todayCount}`);
|
|
731
673
|
await ctx.cache.set("todayCache", dailyNameKey, todayCount, cacheTimeoutTime * 1e3);
|
|
732
|
-
var randomId =
|
|
674
|
+
var randomId = import_koishi4.Random.pick(quizDataIds);
|
|
733
675
|
var qItem = quizDataSet[randomId];
|
|
734
|
-
var qOptions =
|
|
676
|
+
var qOptions = import_koishi4.Random.shuffle(qItem.options);
|
|
735
677
|
var answerIndex = -1;
|
|
736
678
|
logger2?.info(`${argv.session.userId} get a new quiz(id:${randomId})`);
|
|
737
679
|
for (var i = 0; i < qOptions.length; i++) {
|
|
@@ -741,11 +683,11 @@ async function apply3(ctx, config) {
|
|
|
741
683
|
}
|
|
742
684
|
}
|
|
743
685
|
await ctx.cache.set("question", argv.session.userId, { question: randomId, answer: answerIndex }, config.answerTimeout * 1e3);
|
|
744
|
-
var messageQuestion = `${qItem.question.img.length > 0 ? `<img src="${qItem.question.img}"/>` : ``}${At(argv)}${qItem.question.s}
|
|
686
|
+
var messageQuestion = `${qItem.question.img.length > 0 ? `<img src="${qItem.question.img}"/>` : ``}${At(argv)}${ctx.censor ? "<censor>" : ""}${qItem.question.s}
|
|
745
687
|
A. ${qOptions[0].s}
|
|
746
|
-
B. ${qOptions[1].s}
|
|
688
|
+
B. ${qOptions[1].s}
|
|
747
689
|
C. ${qOptions[2].s}
|
|
748
|
-
D. ${qOptions[3].s}`;
|
|
690
|
+
D. ${qOptions[3].s}${ctx.censor ? "</censor>" : ""}`;
|
|
749
691
|
await argv.session?.send(messageQuestion);
|
|
750
692
|
return;
|
|
751
693
|
});
|
|
@@ -800,6 +742,83 @@ ${comment}`);
|
|
|
800
742
|
}
|
|
801
743
|
});
|
|
802
744
|
}
|
|
745
|
+
__name(apply2, "apply");
|
|
746
|
+
|
|
747
|
+
// src/cat/index.ts
|
|
748
|
+
var cat_exports = {};
|
|
749
|
+
__export(cat_exports, {
|
|
750
|
+
Config: () => Config3,
|
|
751
|
+
apply: () => apply3,
|
|
752
|
+
inject: () => inject3,
|
|
753
|
+
injectDepend: () => injectDepend3,
|
|
754
|
+
name: () => name3
|
|
755
|
+
});
|
|
756
|
+
var import_koishi6 = require("koishi");
|
|
757
|
+
|
|
758
|
+
// src/cat/config.ts
|
|
759
|
+
var import_koishi5 = require("koishi");
|
|
760
|
+
var CafeBotCatConfig = import_koishi5.Schema.object({
|
|
761
|
+
catName: import_koishi5.Schema.string().description("名称/占位").default("柯贝")
|
|
762
|
+
}).description("猫猫配置");
|
|
763
|
+
|
|
764
|
+
// src/cat/index.ts
|
|
765
|
+
var name3 = "cafe-bot-exp.cat";
|
|
766
|
+
var Config3 = CafeBotCatConfig;
|
|
767
|
+
var injectDepend3 = {
|
|
768
|
+
required: [],
|
|
769
|
+
optional: ["logger"]
|
|
770
|
+
};
|
|
771
|
+
var inject3 = [];
|
|
772
|
+
var catWords = [
|
|
773
|
+
"喵呀呜~ ",
|
|
774
|
+
"喵呀~呵",
|
|
775
|
+
// 走这边。(带路时)
|
|
776
|
+
"喵呀~~噢",
|
|
777
|
+
// 说得没错。就是这样。
|
|
778
|
+
"喵呀~嘎~",
|
|
779
|
+
// 高兴的表现。
|
|
780
|
+
"喵呀~~呵",
|
|
781
|
+
// 稍等一下。(引起注意)
|
|
782
|
+
"喵嘎",
|
|
783
|
+
// 爪子痒痒了。(焦躁不安)
|
|
784
|
+
"喵嘎~~ ",
|
|
785
|
+
// 肚子饿了。
|
|
786
|
+
"喵嘎呜~~",
|
|
787
|
+
// 警戒的表现。
|
|
788
|
+
"喵呜",
|
|
789
|
+
// 困了。乏了。累了。
|
|
790
|
+
"喵呜?",
|
|
791
|
+
// 您是哪位?
|
|
792
|
+
"喵呜—",
|
|
793
|
+
// 是的。
|
|
794
|
+
"喵噢?",
|
|
795
|
+
// 怎么了?
|
|
796
|
+
"喵—噢",
|
|
797
|
+
// 呦,又见面了。 (短期内再会时的招呼)
|
|
798
|
+
"喵—呵",
|
|
799
|
+
// 好久不见了。还好吗?
|
|
800
|
+
"喵~呜",
|
|
801
|
+
// 再见
|
|
802
|
+
"喵~噢",
|
|
803
|
+
// 是,就是这样。(强烈肯定)
|
|
804
|
+
"喵~~呵",
|
|
805
|
+
// 你好。
|
|
806
|
+
"呜咪嘎~ ",
|
|
807
|
+
// 打哈欠。
|
|
808
|
+
"咪呜?",
|
|
809
|
+
// 你说什么?(听到坏话反问的语气)
|
|
810
|
+
"咪~呜 ",
|
|
811
|
+
// 肚子饿了。(幼猫语)
|
|
812
|
+
"咪~~呵"
|
|
813
|
+
// 对不起
|
|
814
|
+
];
|
|
815
|
+
async function apply3(ctx) {
|
|
816
|
+
ctx.command("黑猫柯贝/摸猫", "摸摸柯贝").action(async (argv, _) => {
|
|
817
|
+
const random = new import_koishi6.Random(() => Math.random());
|
|
818
|
+
let catWord = random.pick(catWords);
|
|
819
|
+
argv.session?.send(`${At(argv)}🐱:${catWord}`);
|
|
820
|
+
});
|
|
821
|
+
}
|
|
803
822
|
__name(apply3, "apply");
|
|
804
823
|
|
|
805
824
|
// src/config.ts
|
|
@@ -817,9 +836,10 @@ var Config4 = import_koishi7.Schema.intersect([
|
|
|
817
836
|
|
|
818
837
|
// src/index.ts
|
|
819
838
|
var name4 = "cafe-bot-exp";
|
|
820
|
-
var
|
|
821
|
-
|
|
822
|
-
|
|
839
|
+
var plugins = [draw_exports, quiz_exports, cat_exports];
|
|
840
|
+
var inject4 = {
|
|
841
|
+
required: Array.from(/* @__PURE__ */ new Set([...injectDepend.required, ...injectDepend2.required, ...injectDepend3.required])),
|
|
842
|
+
optional: Array.from(/* @__PURE__ */ new Set([...injectDepend.optional, ...injectDepend2.optional, ...injectDepend3.optional]))
|
|
823
843
|
};
|
|
824
844
|
var logger3 = null;
|
|
825
845
|
var logoFilePath = null;
|
|
@@ -833,10 +853,6 @@ async function apply4(ctx, config) {
|
|
|
833
853
|
logoFilePath = path3.join(root, "logo.jpg");
|
|
834
854
|
logger3?.info(`Try check logoFile ${logoFilePath} or download it, forceUpdate:${config.refreshLogoWhenLoad}`);
|
|
835
855
|
var result = await downloadTool_default(ctx.http, config.logoUrl, logoFilePath, config.refreshLogoWhenLoad);
|
|
836
|
-
var a = "/koishi/data/cafe-bot-exp-data/logo.jpg";
|
|
837
|
-
var b = (0, import_url.pathToFileURL)(a);
|
|
838
|
-
console.log(b.href);
|
|
839
|
-
console.log(await ctx.http.isLocal(b.href));
|
|
840
856
|
logger3?.info(`download file ${result ? "ok" : "failed"}`);
|
|
841
857
|
ctx.command("关于", "关于本机器人的信息").action(async (argv, _) => {
|
|
842
858
|
argv.session?.send(
|
|
@@ -855,5 +871,6 @@ __name(apply4, "apply");
|
|
|
855
871
|
Config,
|
|
856
872
|
apply,
|
|
857
873
|
inject,
|
|
858
|
-
name
|
|
874
|
+
name,
|
|
875
|
+
plugins
|
|
859
876
|
});
|
package/lib/quiz/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
import { Context, Schema } from 'koishi';
|
|
5
5
|
import { CafeBotQuizConfig } from './config';
|
|
6
6
|
export declare const name = "cafe-bot-exp.quiz";
|
|
7
|
+
export declare const injectDepend: {
|
|
8
|
+
required: string[];
|
|
9
|
+
optional: string[];
|
|
10
|
+
};
|
|
7
11
|
export declare const inject: string[];
|
|
8
12
|
export interface Config extends CafeBotQuizConfig {
|
|
9
13
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azimiao/koishi-plugin-cafe-bot-exp",
|
|
3
3
|
"description": "cafe bot experiment",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.27",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"repository": {
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"http",
|
|
36
36
|
"cache",
|
|
37
37
|
"database"
|
|
38
|
+
],
|
|
39
|
+
"optional": [
|
|
40
|
+
"logger",
|
|
41
|
+
"censor"
|
|
38
42
|
]
|
|
39
43
|
},
|
|
40
44
|
"locales": [
|
|
@@ -43,7 +47,8 @@
|
|
|
43
47
|
"preview": true
|
|
44
48
|
},
|
|
45
49
|
"dependencies": {
|
|
50
|
+
"@koishijs/censor": "^1.1.0",
|
|
46
51
|
"@stdlib/random-base-uniform": "^0.2.1",
|
|
47
52
|
"fs.promises.exists": "^1.1.4"
|
|
48
53
|
}
|
|
49
|
-
}
|
|
54
|
+
}
|