koishi-plugin-ciyi 2.1.1 → 2.1.2
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/README.md +1 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Schema, Session } from "koishi";
|
|
2
2
|
import { History } from "./view";
|
|
3
3
|
export declare const name = "ciyi";
|
|
4
|
-
export declare const usage = "## \u4F7F\u7528\n\n\u53D1\u9001 `ciyi` \u67E5\u770B\u73A9\u6CD5\u3002\u6BCF\u65E5\u85CF\u4E00\u4E2A\u4E24\u5B57\u8BCD\uFF0C\u7528 `ciyi.\u731C <\u8BCD>` \u5F00\u9898\uFF0C\u4E4B\u540E\u53EF\u4EE5\u76F4\u63A5\u53D1\u9001\u4E24\u5B57\u8BCD\u7EE7\u7EED\u731C\u3002\u88F8\u8BCD\u8BBE\u7F6E\u53EA\u5BF9\u5F53\u524D\u9891\u9053\u751F\u6548\uFF0C\u91CD\u542F\u540E\u6062\u590D\u9ED8\u8BA4\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `ciyi` | \u73A9\u6CD5 |\n| `ciyi.\u731C <\u8BCD>` | \u5F00\u59CB\u4ECA\u65E5\u5BF9\u5C40\u5E76\u62A5\u4E00\u4E2A\u4E24\u5B57\u8BCD |\n| `ciyi.\u88F8\u8BCD [\u5F00/\u5173]` | \u5F00\u5173\u672C\u9891\u9053\u7684\u65E0\u524D\u7F00\u7EED\u731C |\n| `ciyi.\u6392\u884C\u699C` | \u7D2F\u8BA1\u731C\u4E2D\u6392\u884C\u699C |";
|
|
4
|
+
export declare const usage = "## \u4F7F\u7528\n\n\u53D1\u9001 `ciyi` \u67E5\u770B\u73A9\u6CD5\u3002\u6BCF\u65E5\u85CF\u4E00\u4E2A\u4E24\u5B57\u8BCD\uFF0C\u7528 `ciyi.\u731C <\u8BCD>` \u5F00\u9898\uFF0C\u4E4B\u540E\u53EF\u4EE5\u76F4\u63A5\u53D1\u9001\u4E24\u5B57\u8BCD\u7EE7\u7EED\u731C\uFF0C@ \u6216\u5F15\u7528\u540E\u63A5\u4E24\u5B57\u8BCD\u540C\u6837\u7B97\u3002\u88F8\u8BCD\u8BBE\u7F6E\u53EA\u5BF9\u5F53\u524D\u9891\u9053\u751F\u6548\uFF0C\u91CD\u542F\u540E\u6062\u590D\u9ED8\u8BA4\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `ciyi` | \u73A9\u6CD5 |\n| `ciyi.\u731C <\u8BCD>` | \u5F00\u59CB\u4ECA\u65E5\u5BF9\u5C40\u5E76\u62A5\u4E00\u4E2A\u4E24\u5B57\u8BCD |\n| `ciyi.\u88F8\u8BCD [\u5F00/\u5173]` | \u5F00\u5173\u672C\u9891\u9053\u7684\u65E0\u524D\u7F00\u7EED\u731C |\n| `ciyi.\u6392\u884C\u699C` | \u7D2F\u8BA1\u731C\u4E2D\u6392\u884C\u699C |";
|
|
5
5
|
export declare const inject: {
|
|
6
6
|
required: string[];
|
|
7
7
|
optional: string[];
|
|
@@ -43,7 +43,10 @@ export type { History };
|
|
|
43
43
|
/**
|
|
44
44
|
* 裸词中间件只看消息里的文本,引用、@、图片等非文本元素一律过滤掉:
|
|
45
45
|
* 回复时带上引用或 @ 是常见操作,不应因此把一条两字词挡在门外。
|
|
46
|
-
*
|
|
46
|
+
*
|
|
47
|
+
* 平台还会把被 @ 的那个昵称原样抄进正文(QQ 就是「@昵称 山水」),
|
|
48
|
+
* 前缀与正文之间垫的空白同理,都属于前缀。带前缀时连它们一起摘掉,
|
|
49
|
+
* 摘不干净就照旧不认。摘完之后,正文仍必须是一条完整、无多余空白的两字中文词。
|
|
47
50
|
*/
|
|
48
51
|
export declare function getMiddlewareGuess(session: Session): string | null;
|
|
49
52
|
/** 裸词只能加入已开始且未封题的游戏,不能开题,也不重复提交旧猜测。 */
|
package/lib/index.js
CHANGED
|
@@ -1190,7 +1190,7 @@ __name(renderRankCard, "renderRankCard");
|
|
|
1190
1190
|
var name = "ciyi";
|
|
1191
1191
|
var usage = `## 使用
|
|
1192
1192
|
|
|
1193
|
-
发送 \`ciyi\` 查看玩法。每日藏一个两字词,用 \`ciyi.猜 <词>\`
|
|
1193
|
+
发送 \`ciyi\` 查看玩法。每日藏一个两字词,用 \`ciyi.猜 <词>\` 开题,之后可以直接发送两字词继续猜,@ 或引用后接两字词同样算。裸词设置只对当前频道生效,重启后恢复默认。
|
|
1194
1194
|
|
|
1195
1195
|
## 指令
|
|
1196
1196
|
|
|
@@ -1217,7 +1217,12 @@ function getMiddlewareGuess(session) {
|
|
|
1217
1217
|
if (!message || session.event.user?.isBot || message.user?.isBot) {
|
|
1218
1218
|
return null;
|
|
1219
1219
|
}
|
|
1220
|
-
const
|
|
1220
|
+
const elements = message.elements ?? [];
|
|
1221
|
+
const prefixed = !!message.quote || elements.some(
|
|
1222
|
+
(element) => element.type === "at" || element.type === "quote"
|
|
1223
|
+
);
|
|
1224
|
+
let text = elements.filter((element) => element.type === "text").map((element) => element.attrs.content).filter((content) => typeof content === "string").join("");
|
|
1225
|
+
if (prefixed) text = text.replace(/^\s*@\S*/, "").trim();
|
|
1221
1226
|
if (text !== text.trim() || Array.from(text).length !== 2 || !/^\p{Script=Han}{2}$/u.test(text) || !allWords_default.includes(text)) {
|
|
1222
1227
|
return null;
|
|
1223
1228
|
}
|