koishi-plugin-starfx-bot 0.3.1 → 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 +15 -3
- package/lib/index.js +13 -10
- package/package.json +1 -1
- package/readme.md +9 -1
package/lib/index.d.ts
CHANGED
|
@@ -6,11 +6,23 @@ 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<
|
|
13
|
-
|
|
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>;
|
|
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>;
|
|
16
28
|
export declare function drawLock(baseImage: string): Promise<h | "输入无效。" | "发生错误。">;
|
package/lib/index.js
CHANGED
|
@@ -47,14 +47,17 @@ 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
|
-
|
|
57
|
-
|
|
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
|
+
]);
|
|
59
|
+
var usage = `<h5>StarFreedomX的自用插件 放了一些小功能</h5>
|
|
60
|
+
`;
|
|
58
61
|
function apply(ctx, cfg) {
|
|
59
62
|
baseDir = ctx.baseDir;
|
|
60
63
|
assetsDir = `${ctx.baseDir}/data/starfx-bot/assets`;
|
|
@@ -88,13 +91,13 @@ function apply(ctx, cfg) {
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
if (cfg.replyBot) {
|
|
94
|
+
if (cfg.replyBot !== "关闭") {
|
|
92
95
|
const bots = ["bot", "机器人", "Bot", "BOT", "机器人!", "机器人!"];
|
|
93
96
|
const texts = elements?.filter((e) => e.type === "text").map((e) => e?.attrs?.content?.trim());
|
|
94
97
|
const ats = elements?.filter((e) => e.type === "at").map((e) => e?.attrs?.id);
|
|
95
98
|
const mentionedBot = texts?.some((t) => bots.includes(t));
|
|
96
99
|
const atMe = ats?.includes(session.selfId);
|
|
97
|
-
if (elements?.length === 1 && mentionedBot || elements?.length === 2 && mentionedBot && atMe) {
|
|
100
|
+
if (elements?.length === 1 && mentionedBot && cfg.replyBot === "无需at" || elements?.length === 2 && mentionedBot && atMe) {
|
|
98
101
|
await session.send("我才不是机器人!");
|
|
99
102
|
}
|
|
100
103
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# koishi-plugin-starfx-bot
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/koishi-plugin-starfx-bot)
|
|
3
|
+
[](https://www.npmjs.com/package/koishi-plugin-starfx-bot) [](https://www.npmjs.com/package/koishi-plugin-starfx-bot) [](https://www.npmjs.com/package/koishi-plugin-starfx-bot)
|
|
4
4
|
|
|
5
5
|
StarFreedomX机器人的小功能,自用
|
|
6
|
+
|
|
7
|
+
已加入的功能列表:
|
|
8
|
+
|
|
9
|
+
* 明日方舟封印功能
|
|
10
|
+
* 闲鱼“卖掉了”功能
|
|
11
|
+
* 艾特我/他又不说话
|
|
12
|
+
* 我才不是机器人!
|
|
13
|
+
* 我也喜欢你!
|