koishi-plugin-starfx-bot 0.11.1 → 0.12.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 +3 -0
- package/lib/index.js +23 -9
- package/package.json +1 -1
- package/readme.md +20 -17
package/lib/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface Config {
|
|
|
12
12
|
saveArchive: boolean;
|
|
13
13
|
roll: boolean;
|
|
14
14
|
undo: boolean;
|
|
15
|
+
echo: boolean;
|
|
15
16
|
atNotSay: boolean;
|
|
16
17
|
atNotSayProperty: number;
|
|
17
18
|
atNotSayOther: boolean;
|
|
@@ -33,6 +34,7 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
33
34
|
}> | Schemastery.ObjectS<{
|
|
34
35
|
roll: Schema<boolean, boolean>;
|
|
35
36
|
undo: Schema<boolean, boolean>;
|
|
37
|
+
echo: Schema<boolean, boolean>;
|
|
36
38
|
}> | Schemastery.ObjectS<{
|
|
37
39
|
atNotSay: Schema<boolean, boolean>;
|
|
38
40
|
atNotSayProperty: Schema<number, number>;
|
|
@@ -56,6 +58,7 @@ export declare const Config: Schema<Schemastery.ObjectS<{
|
|
|
56
58
|
} & {
|
|
57
59
|
roll: boolean;
|
|
58
60
|
undo: boolean;
|
|
61
|
+
echo: boolean;
|
|
59
62
|
} & {
|
|
60
63
|
atNotSay: boolean;
|
|
61
64
|
atNotSayProperty: number;
|
package/lib/index.js
CHANGED
|
@@ -118,14 +118,6 @@ async function getImageSrc(session, param, option) {
|
|
|
118
118
|
} else if (noParam && !param?.length) {
|
|
119
119
|
return `https://q1.qlogo.cn/g?b=qq&nk=${session.userId}&s=640`;
|
|
120
120
|
}
|
|
121
|
-
const elementArray = session.elements;
|
|
122
|
-
for (const element of elementArray) {
|
|
123
|
-
if (img && element?.type === "img") {
|
|
124
|
-
return element?.attrs?.src;
|
|
125
|
-
} else if (at && element?.type === "at" && element?.attrs?.id) {
|
|
126
|
-
return `https://q1.qlogo.cn/g?b=qq&nk=${element.attrs.id}&s=640`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
121
|
if (quote) {
|
|
130
122
|
const quoteElementArray = session?.quote?.elements;
|
|
131
123
|
if (quoteElementArray?.length) {
|
|
@@ -138,6 +130,14 @@ async function getImageSrc(session, param, option) {
|
|
|
138
130
|
}
|
|
139
131
|
}
|
|
140
132
|
}
|
|
133
|
+
const elementArray = session.elements;
|
|
134
|
+
for (const element of elementArray) {
|
|
135
|
+
if (img && element?.type === "img") {
|
|
136
|
+
return element?.attrs?.src;
|
|
137
|
+
} else if (at && element?.type === "at" && element?.attrs?.id) {
|
|
138
|
+
return `https://q1.qlogo.cn/g?b=qq&nk=${element.attrs.id}&s=640`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
141
|
return "";
|
|
142
142
|
}
|
|
143
143
|
__name(getImageSrc, "getImageSrc");
|
|
@@ -451,7 +451,8 @@ var Config2 = import_koishi2.Schema.intersect([
|
|
|
451
451
|
}).description("语录记录功能"),
|
|
452
452
|
import_koishi2.Schema.object({
|
|
453
453
|
roll: import_koishi2.Schema.boolean().default(true).description("开启roll随机数功能"),
|
|
454
|
-
undo: import_koishi2.Schema.boolean().default(true).description("机器人撤回消息功能")
|
|
454
|
+
undo: import_koishi2.Schema.boolean().default(true).description("机器人撤回消息功能"),
|
|
455
|
+
echo: import_koishi2.Schema.boolean().default(true).description("echo回声洞功能")
|
|
455
456
|
}).description("指令小功能"),
|
|
456
457
|
import_koishi2.Schema.object({
|
|
457
458
|
atNotSay: import_koishi2.Schema.boolean().default(true).description("开启‘艾特我又不说话’功能"),
|
|
@@ -498,6 +499,19 @@ function apply(ctx, cfg) {
|
|
|
498
499
|
}
|
|
499
500
|
});
|
|
500
501
|
}
|
|
502
|
+
if (cfg.echo) {
|
|
503
|
+
ctx.command("echo <params>").action(async ({ session }, params) => {
|
|
504
|
+
if (detectControl(controlJson, session.guildId, "echo")) {
|
|
505
|
+
const elements = session.elements;
|
|
506
|
+
try {
|
|
507
|
+
elements[0].attrs.content = elements[0].attrs?.content.split(" ").slice(1).join(" ");
|
|
508
|
+
return elements;
|
|
509
|
+
} catch (e) {
|
|
510
|
+
return params;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
501
515
|
if (cfg.bangdreamBorder) {
|
|
502
516
|
ctx.command("bdbd [param]").option("starNum", "-n <starNum: number>").option("color", "-c <color: string>").option("train", "-t <train: string>").option("band", "-b <band: string>").action(async ({ session, options }, param) => {
|
|
503
517
|
if (detectControl(controlJson, session.guildId, "bdbd")) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -51,6 +51,7 @@ StarFreedomX机器人的小功能,自用
|
|
|
51
51
|
| `bdbd` | BanG Dream! 边框功能(对应 `bangdreamBorder`) |
|
|
52
52
|
| `roll` | 随机数功能 |
|
|
53
53
|
| `undo` | 撤回功能 |
|
|
54
|
+
| `echo` | echo功能 |
|
|
54
55
|
|
|
55
56
|
---
|
|
56
57
|
|
|
@@ -70,20 +71,22 @@ StarFreedomX机器人的小功能,自用
|
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
## 更新日志
|
|
73
|
-
| 版本
|
|
74
|
-
|
|
75
|
-
| `0.0.1`
|
|
76
|
-
| `0.1.0`
|
|
77
|
-
| `0.2.0`
|
|
78
|
-
| `0.3.0`
|
|
79
|
-
| `0.4.0`
|
|
80
|
-
| `0.5.0`
|
|
81
|
-
| `0.6.0`
|
|
82
|
-
| `0.7.0`
|
|
83
|
-
| `0.8.0`
|
|
84
|
-
| `0.9.0`
|
|
85
|
-
| `0.10.0`
|
|
86
|
-
| `0.10.1`
|
|
87
|
-
| `0.10.2`
|
|
88
|
-
| `0.11.0`
|
|
89
|
-
| `0.11.1`
|
|
74
|
+
| 版本 | 更新日志 |
|
|
75
|
+
|------------|-------------------------------|
|
|
76
|
+
| `0.0.1` | 加入封印功能 |
|
|
77
|
+
| `0.1.0` | 加入"卖掉了"功能 |
|
|
78
|
+
| `0.2.0` | 加入"艾特我又不说话"回复功能 |
|
|
79
|
+
| `0.3.0` | 加入"我喜欢你"和"我才不是机器人!"回复功能 |
|
|
80
|
+
| `0.4.0` | 更改处理库为sharp |
|
|
81
|
+
| `0.5.0` | 加入BanG Dream!边框功能 |
|
|
82
|
+
| `0.6.0` | 加入群语录功能,修复一处bangdream绘制的bug |
|
|
83
|
+
| `0.7.0` | 加入复读功能 |
|
|
84
|
+
| `0.8.0` | 将各个工具函数封装在utils.ts中,更改语录的触发方式 |
|
|
85
|
+
| `0.9.0` | 添加白名单/黑名单模式,对每个功能做过滤 |
|
|
86
|
+
| `0.10.0` | 添加随机数功能 |
|
|
87
|
+
| `0.10.1` | 修复随机数骰子功能输入负数报错的bug |
|
|
88
|
+
| `0.10.2` | 增加roll功能的人称变化 |
|
|
89
|
+
| `0.11.0` | 增加适配于onebot(主要是qq)的撤回功能 |
|
|
90
|
+
| `0.11.1` | 修复bdbd传参错误问题 |
|
|
91
|
+
| `0.11.2` | 优化消息捕获图片逻辑 |
|
|
92
|
+
| `0.12.0` | 加入echo功能 |
|