koishi-plugin-mcdle 0.0.3 → 0.0.5
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 +2 -0
- package/lib/index.js +15 -14
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -14650,7 +14650,9 @@ var Config = import_koishi.Schema.object({
|
|
|
14650
14650
|
dailyPlayLimit: import_koishi.Schema.number().default(1).min(1).description("每日游玩次数上限"),
|
|
14651
14651
|
retractDelay: import_koishi.Schema.number().min(0).default(0).description(
|
|
14652
14652
|
`撤回上一条消息的等待时间,单位是秒。值为 0 时不启用自动撤回功能。`
|
|
14653
|
-
)
|
|
14653
|
+
),
|
|
14654
|
+
allowRepeatedGuesses: import_koishi.Schema.boolean().default(false).description("允许重复猜测已猜过的词语(防止撤回时历史不可见)"),
|
|
14655
|
+
disableImages: import_koishi.Schema.boolean().default(false).description("不发送图片(解决网络问题导致的图片下载失败)")
|
|
14654
14656
|
});
|
|
14655
14657
|
function apply(ctx, cfg) {
|
|
14656
14658
|
ctx.model.extend(
|
|
@@ -14697,7 +14699,7 @@ function apply(ctx, cfg) {
|
|
|
14697
14699
|
}
|
|
14698
14700
|
const content = session.content.trim();
|
|
14699
14701
|
if (content.length > 10 || /[,。!?;:'"“”‘’【】()《》.,!?;:'"\[\]()<>]/.test(content)) return next();
|
|
14700
|
-
if (game.guessedChineseTitles.includes(content)) {
|
|
14702
|
+
if (!cfg.allowRepeatedGuesses && game.guessedChineseTitles.includes(content)) {
|
|
14701
14703
|
return next();
|
|
14702
14704
|
}
|
|
14703
14705
|
let dataSource = [];
|
|
@@ -14740,16 +14742,15 @@ function apply(ctx, cfg) {
|
|
|
14740
14742
|
}
|
|
14741
14743
|
__name(mcdle, "mcdle");
|
|
14742
14744
|
async function ck(session) {
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14745
|
+
if (["red", "onebot"].includes(session.platform)) {
|
|
14746
|
+
const allContentNodes = [
|
|
14747
|
+
(0, import_koishi.h)("message", { userId: session.userId }, `生物词库:
|
|
14746
14748
|
${mobChineseTitle.join(" ")}`),
|
|
14747
|
-
|
|
14749
|
+
(0, import_koishi.h)("message", { userId: session.userId }, `方块词库:
|
|
14748
14750
|
${blockChineseTitle.join(" ")}`),
|
|
14749
|
-
|
|
14751
|
+
(0, import_koishi.h)("message", { userId: session.userId }, `物品词库:
|
|
14750
14752
|
${itemChineseTitle.join(" ")}`)
|
|
14751
|
-
|
|
14752
|
-
if (["red", "onebot"].includes(platform)) {
|
|
14753
|
+
];
|
|
14753
14754
|
try {
|
|
14754
14755
|
await session.send((0, import_koishi.h)("figure", {}, allContentNodes));
|
|
14755
14756
|
return;
|
|
@@ -14918,7 +14919,7 @@ ${itemChineseTitle.join(" ")}`
|
|
|
14918
14919
|
await sendMsg(session, `模式数据异常`);
|
|
14919
14920
|
return;
|
|
14920
14921
|
}
|
|
14921
|
-
if (record.guessedChineseTitles.includes(guess)) {
|
|
14922
|
+
if (!cfg.allowRepeatedGuesses && record.guessedChineseTitles.includes(guess)) {
|
|
14922
14923
|
await sendMsg(session, `${guess} 已猜过`);
|
|
14923
14924
|
return;
|
|
14924
14925
|
}
|
|
@@ -15085,13 +15086,13 @@ ${itemChineseTitle.join(" ")}`
|
|
|
15085
15086
|
}
|
|
15086
15087
|
const lastGuess = guesses[guesses.length - 1];
|
|
15087
15088
|
let resultText = "";
|
|
15088
|
-
if (lastGuess.wiki_image_url) {
|
|
15089
|
+
if (!cfg.disableImages && lastGuess.wiki_image_url) {
|
|
15089
15090
|
resultText += `${import_koishi.h.image(lastGuess.wiki_image_url)}
|
|
15090
15091
|
`;
|
|
15091
|
-
|
|
15092
|
-
|
|
15092
|
+
}
|
|
15093
|
+
if (lastGuess.chinese_title) {
|
|
15094
|
+
resultText += `名称:${lastGuess.chinese_title}
|
|
15093
15095
|
`;
|
|
15094
|
-
}
|
|
15095
15096
|
}
|
|
15096
15097
|
for (const key in lastGuess) {
|
|
15097
15098
|
if (key.endsWith("_gui")) continue;
|