koishi-plugin-starfx-bot 0.6.0 → 0.7.0
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.d.ts +10 -0
- package/lib/index.js +19 -0
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const name = "starfx-bot";
|
|
|
3
3
|
export declare let baseDir: string;
|
|
4
4
|
export declare let assetsDir: string;
|
|
5
5
|
export declare const starfxLogger: Logger;
|
|
6
|
+
export declare const repeatContextMap: Map<string, [string, number]>;
|
|
6
7
|
export interface Config {
|
|
7
8
|
openLock: boolean;
|
|
8
9
|
openSold: boolean;
|
|
@@ -12,6 +13,9 @@ export interface Config {
|
|
|
12
13
|
atNotSayProperty: number;
|
|
13
14
|
atNotSayOtherProperty: number;
|
|
14
15
|
record: boolean;
|
|
16
|
+
openRepeat: boolean;
|
|
17
|
+
minRepeatTimes: number;
|
|
18
|
+
repeatPossibility: number;
|
|
15
19
|
replyBot: string;
|
|
16
20
|
iLoveYou: boolean;
|
|
17
21
|
}
|
|
@@ -24,6 +28,9 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
24
28
|
atNotSayProperty: Schema<number, number>;
|
|
25
29
|
atNotSayOther: Schema<boolean, boolean>;
|
|
26
30
|
atNotSayOtherProperty: Schema<number, number>;
|
|
31
|
+
openRepeat: Schema<boolean, boolean>;
|
|
32
|
+
minRepeatTimes: Schema<number, number>;
|
|
33
|
+
repeatPossibility: Schema<number, number>;
|
|
27
34
|
iLoveYou: Schema<boolean, boolean>;
|
|
28
35
|
replyBot: Schema<"关闭" | "无需at" | "必须at", "关闭" | "无需at" | "必须at">;
|
|
29
36
|
}>, {
|
|
@@ -35,6 +42,9 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
35
42
|
atNotSayProperty: number;
|
|
36
43
|
atNotSayOther: boolean;
|
|
37
44
|
atNotSayOtherProperty: number;
|
|
45
|
+
openRepeat: boolean;
|
|
46
|
+
minRepeatTimes: number;
|
|
47
|
+
repeatPossibility: number;
|
|
38
48
|
iLoveYou: boolean;
|
|
39
49
|
replyBot: "关闭" | "无需at" | "必须at";
|
|
40
50
|
} & import("cosmokit").Dict>;
|
package/lib/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(src_exports, {
|
|
|
51
51
|
getRecord: () => getRecord,
|
|
52
52
|
handleBanGDreamConfig: () => handleBanGDreamConfig,
|
|
53
53
|
name: () => name,
|
|
54
|
+
repeatContextMap: () => repeatContextMap,
|
|
54
55
|
starfxLogger: () => starfxLogger,
|
|
55
56
|
usage: () => usage
|
|
56
57
|
});
|
|
@@ -64,6 +65,7 @@ var name = "starfx-bot";
|
|
|
64
65
|
var baseDir;
|
|
65
66
|
var assetsDir;
|
|
66
67
|
var starfxLogger = new import_koishi.Logger("starfx-bot");
|
|
68
|
+
var repeatContextMap = /* @__PURE__ */ new Map();
|
|
67
69
|
var Config = import_koishi.Schema.intersect([
|
|
68
70
|
import_koishi.Schema.object({
|
|
69
71
|
openLock: import_koishi.Schema.boolean().default(true).description("开启明日方舟封印功能"),
|
|
@@ -74,6 +76,9 @@ var Config = import_koishi.Schema.intersect([
|
|
|
74
76
|
atNotSayProperty: import_koishi.Schema.number().role("slider").min(0).max(1).step(0.01).default(0.5).description("'艾特我又不说话'回复概率"),
|
|
75
77
|
atNotSayOther: import_koishi.Schema.boolean().default(true).description("开启‘艾特他又不说话’功能"),
|
|
76
78
|
atNotSayOtherProperty: import_koishi.Schema.number().role("slider").min(0).max(1).step(0.01).default(0.5).description("'艾特他又不说话'回复概率"),
|
|
79
|
+
openRepeat: import_koishi.Schema.boolean().default(true).description("开启复读功能"),
|
|
80
|
+
minRepeatTimes: import_koishi.Schema.number().default(2).description("最少重复次数"),
|
|
81
|
+
repeatPossibility: import_koishi.Schema.number().role("slider").min(0).max(1).step(0.01).default(0.3).description("复读发生概率"),
|
|
77
82
|
iLoveYou: import_koishi.Schema.boolean().default(true).description("开启‘我喜欢你’功能"),
|
|
78
83
|
replyBot: import_koishi.Schema.union(["关闭", "无需at", "必须at"]).default("无需at").description("回复‘我才不是机器人!’功能")
|
|
79
84
|
})
|
|
@@ -125,6 +130,19 @@ function apply(ctx, cfg) {
|
|
|
125
130
|
}
|
|
126
131
|
ctx.middleware(async (session, next) => {
|
|
127
132
|
const elements = session.elements;
|
|
133
|
+
if (cfg.openRepeat) {
|
|
134
|
+
const gid = session.gid;
|
|
135
|
+
const content = session.content;
|
|
136
|
+
const groupMap = repeatContextMap.get(gid);
|
|
137
|
+
if (!groupMap || groupMap[0] !== content) {
|
|
138
|
+
repeatContextMap.set(gid, [content, 1]);
|
|
139
|
+
} else {
|
|
140
|
+
if (groupMap[1] !== -1 && ++groupMap[1] >= cfg.minRepeatTimes && import_koishi.Random.bool(cfg.repeatPossibility)) {
|
|
141
|
+
groupMap[1] = -1;
|
|
142
|
+
await session.send(content);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
128
146
|
await atNotSayReply(cfg, session, elements);
|
|
129
147
|
await replyBot(cfg, session, elements);
|
|
130
148
|
await iLoveYou(cfg, session, elements);
|
|
@@ -454,6 +472,7 @@ __name(drawBanGDream, "drawBanGDream");
|
|
|
454
472
|
getRecord,
|
|
455
473
|
handleBanGDreamConfig,
|
|
456
474
|
name,
|
|
475
|
+
repeatContextMap,
|
|
457
476
|
starfxLogger,
|
|
458
477
|
usage
|
|
459
478
|
});
|
package/package.json
CHANGED
package/readme.md
CHANGED