koishi-plugin-starfx-bot 0.3.2 → 0.3.4

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 CHANGED
@@ -6,10 +6,25 @@ export interface Config {
6
6
  openLock: boolean;
7
7
  openSold: boolean;
8
8
  atNotSay: boolean;
9
- replyBot: boolean;
9
+ atNotSayOther: boolean;
10
+ replyBot: string;
10
11
  iLoveYou: boolean;
11
12
  }
12
- export declare const Config: Schema<Config>;
13
+ export declare const Config: Schema<Schemastery.ObjectS<{
14
+ openLock: Schema<boolean, boolean>;
15
+ openSold: Schema<boolean, boolean>;
16
+ atNotSay: Schema<boolean, boolean>;
17
+ atNotSayOther: Schema<boolean, boolean>;
18
+ iLoveYou: Schema<boolean, boolean>;
19
+ replyBot: Schema<"关闭" | "无需at" | "必须at", "关闭" | "无需at" | "必须at">;
20
+ }>, {
21
+ openLock: boolean;
22
+ openSold: boolean;
23
+ atNotSay: boolean;
24
+ atNotSayOther: boolean;
25
+ iLoveYou: boolean;
26
+ replyBot: "关闭" | "无需at" | "必须at";
27
+ } & import("cosmokit").Dict>;
13
28
  export declare const usage = "<h5>StarFreedomX\u7684\u81EA\u7528\u63D2\u4EF6 \u653E\u4E86\u4E00\u4E9B\u5C0F\u529F\u80FD</h5>\n ";
14
29
  export declare function apply(ctx: Context, cfg: Config): void;
15
30
  export declare function getImageSrc(session: Session, param: string): Promise<any>;
package/lib/index.js CHANGED
@@ -47,13 +47,16 @@ 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.object({
51
- openLock: import_koishi.Schema.boolean().default(true).description("开启明日方舟封印功能"),
52
- openSold: import_koishi.Schema.boolean().default(true).description('开启闲鱼"卖掉了"功能'),
53
- atNotSay: import_koishi.Schema.boolean().default(true).description("开启‘艾特我/他又不说话’功能"),
54
- replyBot: import_koishi.Schema.boolean().default(true).description("开启回复‘机器人’功能"),
55
- iLoveYou: import_koishi.Schema.boolean().default(true).description("开启‘我喜欢你’功能")
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
+ atNotSayOther: import_koishi.Schema.boolean().default(true).description("开启‘艾特他又不说话’功能"),
56
+ iLoveYou: import_koishi.Schema.boolean().default(true).description("开启‘我喜欢你’功能"),
57
+ replyBot: import_koishi.Schema.union(["关闭", "无需at", "必须at"]).default("无需at").description("回复‘我才是不是机器人!’功能")
58
+ })
59
+ ]);
57
60
  var usage = `<h5>StarFreedomX的自用插件 放了一些小功能</h5>
58
61
  `;
59
62
  function apply(ctx, cfg) {
@@ -80,22 +83,24 @@ function apply(ctx, cfg) {
80
83
  ctx.middleware(async (session, next) => {
81
84
  const elements = session.elements;
82
85
  console.log(elements);
83
- if (cfg.atNotSay) {
86
+ if (cfg.atNotSay || cfg.atNotSayOther) {
84
87
  if (elements.length === 1 && elements[0].type === "at") {
85
88
  if (elements[0].attrs.id === session.selfId) {
86
- await session.send("艾特我又不说话");
89
+ if (cfg.atNotSay)
90
+ await session.send("艾特我又不说话");
87
91
  } else {
88
- await session.send("艾特他又不说话");
92
+ if (cfg.atNotSayOther)
93
+ await session.send("艾特他又不说话");
89
94
  }
90
95
  }
91
96
  }
92
- if (cfg.replyBot) {
97
+ if (cfg.replyBot !== "关闭") {
93
98
  const bots = ["bot", "机器人", "Bot", "BOT", "机器人!", "机器人!"];
94
99
  const texts = elements?.filter((e) => e.type === "text").map((e) => e?.attrs?.content?.trim());
95
100
  const ats = elements?.filter((e) => e.type === "at").map((e) => e?.attrs?.id);
96
101
  const mentionedBot = texts?.some((t) => bots.includes(t));
97
102
  const atMe = ats?.includes(session.selfId);
98
- if (elements?.length === 1 && mentionedBot || elements?.length === 2 && mentionedBot && atMe) {
103
+ if (elements?.length === 1 && mentionedBot && cfg.replyBot === "无需at" || elements?.length === 2 && mentionedBot && atMe) {
99
104
  await session.send("我才不是机器人!");
100
105
  }
101
106
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "contributors": [
5
5
  "StarFreedomX <starfreedomx@outlook.com>"
6
6
  ],
7
- "version": "0.3.2",
7
+ "version": "0.3.4",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
10
10
  "files": [
package/readme.md CHANGED
@@ -4,10 +4,20 @@
4
4
 
5
5
  StarFreedomX机器人的小功能,自用
6
6
 
7
- 已加入的功能列表:
7
+ # 已加入的功能列表:
8
8
 
9
9
  * 明日方舟封印功能
10
10
  * 闲鱼“卖掉了”功能
11
11
  * 艾特我/他又不说话
12
12
  * 我才不是机器人!
13
13
  * 我也喜欢你!
14
+
15
+ # 更新日志
16
+ | 版本 | 更新日志 |
17
+ |---------|----------------------------|
18
+ | `0.0.1` | 加入封印功能 |
19
+ | `0.1.0` | 加入"卖掉了"功能 |
20
+ | `0.2.0` | 加入"艾特我又不说话"回复功能 |
21
+ | `0.3.0` | 加入"我喜欢你"和"我才不是机器人!"回复功能 |
22
+ | `0.3.3` | 修订添加"我才不是机器人"是否需要at |
23
+ | `0.3.4` | 分离"艾特我/他又不说话"的两个选项为单独的开关 |