koishi-plugin-starfx-bot 0.10.0 → 0.10.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.d.ts +3 -0
- package/lib/index.js +8 -3
- package/lib/utils.d.ts +1 -0
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface Config {
|
|
|
19
19
|
openRepeat: boolean;
|
|
20
20
|
minRepeatTimes: number;
|
|
21
21
|
repeatPossibility: number;
|
|
22
|
+
saveArchive: boolean;
|
|
22
23
|
featureControl: string;
|
|
23
24
|
}
|
|
24
25
|
export declare const Config: Schema<Schemastery.ObjectS<{
|
|
@@ -27,6 +28,7 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
27
28
|
bangdreamBorder: Schema<boolean, boolean>;
|
|
28
29
|
}> | Schemastery.ObjectS<{
|
|
29
30
|
record: Schema<boolean, boolean>;
|
|
31
|
+
saveArchive: Schema<boolean, boolean>;
|
|
30
32
|
}> | Schemastery.ObjectS<{
|
|
31
33
|
roll: Schema<boolean, boolean>;
|
|
32
34
|
}> | Schemastery.ObjectS<{
|
|
@@ -48,6 +50,7 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
48
50
|
bangdreamBorder: boolean;
|
|
49
51
|
} & import("cosmokit").Dict & {
|
|
50
52
|
record: boolean;
|
|
53
|
+
saveArchive: boolean;
|
|
51
54
|
} & {
|
|
52
55
|
roll: boolean;
|
|
53
56
|
} & {
|
package/lib/index.js
CHANGED
|
@@ -411,7 +411,7 @@ function handleRoll(session) {
|
|
|
411
411
|
}
|
|
412
412
|
__name(handleRoll, "handleRoll");
|
|
413
413
|
function getPoints(session, num, noodles) {
|
|
414
|
-
if (
|
|
414
|
+
if (!Number.isInteger(num) || !Number.isInteger(noodles) || num < 0 || noodles > 0) return session.text(".invalid");
|
|
415
415
|
if (num > 20 || noodles > 1e8) return session.text(".too-many");
|
|
416
416
|
const points = Array(num).fill(0).map(() => Math.floor(Math.random() * noodles + 1));
|
|
417
417
|
return session.text(".noodles", {
|
|
@@ -435,8 +435,8 @@ var Config2 = import_koishi2.Schema.intersect([
|
|
|
435
435
|
bangdreamBorder: import_koishi2.Schema.boolean().default(true).description("开启BanG Dream!边框功能")
|
|
436
436
|
}).description("绘图功能"),
|
|
437
437
|
import_koishi2.Schema.object({
|
|
438
|
-
record: import_koishi2.Schema.boolean().default(true).description("开启群语录功能")
|
|
439
|
-
|
|
438
|
+
record: import_koishi2.Schema.boolean().default(true).description("开启群语录功能"),
|
|
439
|
+
saveArchive: import_koishi2.Schema.boolean().default(false).description("开启入典功能").hidden()
|
|
440
440
|
}).description("语录记录功能"),
|
|
441
441
|
import_koishi2.Schema.object({
|
|
442
442
|
roll: import_koishi2.Schema.boolean().default(true).description("开启roll随机数功能")
|
|
@@ -527,6 +527,11 @@ function apply(ctx, cfg) {
|
|
|
527
527
|
}
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
|
+
if (cfg.saveArchive) {
|
|
531
|
+
ctx.command("入典").action(async ({ session }) => {
|
|
532
|
+
if (!session.quote) return "请引用合并转发聊天记录进行入典";
|
|
533
|
+
});
|
|
534
|
+
}
|
|
530
535
|
ctx.middleware(async (session, next) => {
|
|
531
536
|
const elements = session.elements;
|
|
532
537
|
if (cfg.openRepeat && detectControl(controlJson, session.guildId, "repeat")) {
|
package/lib/utils.d.ts
CHANGED
|
@@ -129,4 +129,5 @@ export declare function drawBanGDream(avatar: string, inputOptions?: {
|
|
|
129
129
|
export declare function parseJsonControl(text: string): FeatureControl | null;
|
|
130
130
|
export declare function detectControl(controlJson: FeatureControl, guildId: string, funName: string): boolean;
|
|
131
131
|
export declare function handleRoll(session: Session): string;
|
|
132
|
+
export declare function saveArchive(quoteElements: h[], gid: string, session: Session): void;
|
|
132
133
|
export {};
|
package/package.json
CHANGED
package/readme.md
CHANGED