koishi-plugin-starfx-bot 0.3.2 → 0.3.3
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 +14 -2
- package/lib/index.js +11 -9
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -6,10 +6,22 @@ export interface Config {
|
|
|
6
6
|
openLock: boolean;
|
|
7
7
|
openSold: boolean;
|
|
8
8
|
atNotSay: boolean;
|
|
9
|
-
replyBot:
|
|
9
|
+
replyBot: string;
|
|
10
10
|
iLoveYou: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const Config: Schema<
|
|
12
|
+
export declare const Config: Schema<Schemastery.ObjectS<{
|
|
13
|
+
openLock: Schema<boolean, boolean>;
|
|
14
|
+
openSold: Schema<boolean, boolean>;
|
|
15
|
+
atNotSay: Schema<boolean, boolean>;
|
|
16
|
+
iLoveYou: Schema<boolean, boolean>;
|
|
17
|
+
replyBot: Schema<"关闭" | "无需at" | "必须at", "关闭" | "无需at" | "必须at">;
|
|
18
|
+
}>, {
|
|
19
|
+
openLock: boolean;
|
|
20
|
+
openSold: boolean;
|
|
21
|
+
atNotSay: boolean;
|
|
22
|
+
iLoveYou: boolean;
|
|
23
|
+
replyBot: "关闭" | "无需at" | "必须at";
|
|
24
|
+
} & import("cosmokit").Dict>;
|
|
13
25
|
export declare const usage = "<h5>StarFreedomX\u7684\u81EA\u7528\u63D2\u4EF6 \u653E\u4E86\u4E00\u4E9B\u5C0F\u529F\u80FD</h5>\n ";
|
|
14
26
|
export declare function apply(ctx: Context, cfg: Config): void;
|
|
15
27
|
export declare function getImageSrc(session: Session, param: string): Promise<any>;
|
package/lib/index.js
CHANGED
|
@@ -47,13 +47,15 @@ var fs = __toESM(require("fs"));
|
|
|
47
47
|
var name = "starfx-bot";
|
|
48
48
|
var baseDir;
|
|
49
49
|
var assetsDir;
|
|
50
|
-
var Config = import_koishi.Schema.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
var Config = import_koishi.Schema.intersect([
|
|
51
|
+
import_koishi.Schema.object({
|
|
52
|
+
openLock: import_koishi.Schema.boolean().default(true).description("开启明日方舟封印功能"),
|
|
53
|
+
openSold: import_koishi.Schema.boolean().default(true).description('开启闲鱼"卖掉了"功能'),
|
|
54
|
+
atNotSay: import_koishi.Schema.boolean().default(true).description("开启‘艾特我/他又不说话’功能"),
|
|
55
|
+
iLoveYou: import_koishi.Schema.boolean().default(true).description("开启‘我喜欢你’功能"),
|
|
56
|
+
replyBot: import_koishi.Schema.union(["关闭", "无需at", "必须at"]).default("无需at").description("回复‘我才是不是机器人!’功能")
|
|
57
|
+
})
|
|
58
|
+
]);
|
|
57
59
|
var usage = `<h5>StarFreedomX的自用插件 放了一些小功能</h5>
|
|
58
60
|
`;
|
|
59
61
|
function apply(ctx, cfg) {
|
|
@@ -89,13 +91,13 @@ function apply(ctx, cfg) {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
if (cfg.replyBot) {
|
|
94
|
+
if (cfg.replyBot !== "关闭") {
|
|
93
95
|
const bots = ["bot", "机器人", "Bot", "BOT", "机器人!", "机器人!"];
|
|
94
96
|
const texts = elements?.filter((e) => e.type === "text").map((e) => e?.attrs?.content?.trim());
|
|
95
97
|
const ats = elements?.filter((e) => e.type === "at").map((e) => e?.attrs?.id);
|
|
96
98
|
const mentionedBot = texts?.some((t) => bots.includes(t));
|
|
97
99
|
const atMe = ats?.includes(session.selfId);
|
|
98
|
-
if (elements?.length === 1 && mentionedBot || elements?.length === 2 && mentionedBot && atMe) {
|
|
100
|
+
if (elements?.length === 1 && mentionedBot && cfg.replyBot === "无需at" || elements?.length === 2 && mentionedBot && atMe) {
|
|
99
101
|
await session.send("我才不是机器人!");
|
|
100
102
|
}
|
|
101
103
|
}
|