koishi-plugin-mcdle 0.3.0 → 0.4.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/README.md +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +57 -42
- 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 { MobData, BlockData, ItemData } from './data';
|
|
3
3
|
export declare const name = "mcdle";
|
|
4
|
-
export declare const usage = "## \u4F7F\u7528\n\n\u53D1\u9001 `mcdle` \u67E5\u770B\u73A9\u6CD5\u4E0E\u5168\u90E8\u6307\u4EE4\u3002`mcdle.\u731C [\u540D\u79F0]` \u7528\u6709\u6548\u8BCD\u6761\u5F00\u5C40\u6216\u731C\u6D4B\u3002\u9996\u6B21\u731C\u6D4B\u7684\u8BCD\u6761\u51B3\u5B9A\u751F\u7269\u3001\u7269\u54C1\u6216\u65B9\u5757\u6A21\u5F0F\uFF0C\u7CFB\u7EDF\u518D\u4ECE\u540C\u7C7B\u8BCD\u5E93\u4E2D\u62BD\u53D6\u7B54\u6848\u3002\n\n## \
|
|
4
|
+
export declare const usage = "## \u4F7F\u7528\n\n\u53D1\u9001 `mcdle` \u67E5\u770B\u73A9\u6CD5\u4E0E\u5168\u90E8\u6307\u4EE4\u3002`mcdle.\u731C [\u540D\u79F0]` \u7528\u6709\u6548\u8BCD\u6761\u5F00\u5C40\u6216\u731C\u6D4B\u3002\u9996\u6B21\u731C\u6D4B\u7684\u8BCD\u6761\u51B3\u5B9A\u751F\u7269\u3001\u7269\u54C1\u6216\u65B9\u5757\u6A21\u5F0F\uFF0C\u7CFB\u7EDF\u518D\u4ECE\u540C\u7C7B\u8BCD\u5E93\u4E2D\u62BD\u53D6\u7B54\u6848\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `mcdle` | \u73A9\u6CD5\u4E0E\u6307\u4EE4\u8BF4\u660E |\n| `mcdle.\u731C [\u540D\u79F0]` | \u7528\u6709\u6548\u8BCD\u6761\u5F00\u5C40\u6216\u731C\u6D4B |\n| `mcdle.\u88F8\u731C [\u5F00/\u5173]` | \u5F00\u5173\u672C\u9891\u9053\u7684\u65E0\u524D\u7F00\u7EED\u731C |\n| `mcdle.\u6392\u884C\u699C` | \u7FA4\u5185\u6218\u7EE9 |\n| `mcdle.\u8BCD\u5E93` | \u5168\u90E8\u8BCD\u6761 |\n\n## \u63D0\u793A\n\n| \u7B26\u53F7 | \u542B\u4E49 |\n| --- | --- |\n| \uD83D\uDFE9 | \u5B8C\u5168\u5339\u914D |\n| \uD83D\uDFE8 | \u90E8\u5206\u5339\u914D |\n| \uD83D\uDFE5 | \u4E0D\u5339\u914D |\n| \uD83D\uDFE5\u2B06\uFE0F / \uD83D\uDFE5\u2B07\uFE0F | \u7B54\u6848\u66F4\u5927 / \u66F4\u5C0F |";
|
|
5
5
|
export declare const inject: {
|
|
6
6
|
required: string[];
|
|
7
7
|
optional: string[];
|
|
@@ -9,7 +9,7 @@ export declare const inject: {
|
|
|
9
9
|
export interface Config {
|
|
10
10
|
atReply: boolean;
|
|
11
11
|
quoteReply: boolean;
|
|
12
|
-
|
|
12
|
+
enableDirectInput: boolean;
|
|
13
13
|
addStatusTextAfterEmoji: boolean;
|
|
14
14
|
maxRank: number;
|
|
15
15
|
dailyPlayLimit: number;
|
package/lib/index.js
CHANGED
|
@@ -14956,11 +14956,14 @@ function components() {
|
|
|
14956
14956
|
.m3-header__title{font-size:32px;line-height:40px;font-weight:600;letter-spacing:0;color:var(--md-sys-color-on-surface);margin:0}
|
|
14957
14957
|
.m3-header__support{font-size:14px;line-height:20px;font-weight:400;letter-spacing:.25px;color:var(--md-sys-color-on-surface-variant);margin:0}
|
|
14958
14958
|
|
|
14959
|
-
/*
|
|
14959
|
+
/*
|
|
14960
|
+
* 页脚署名。层次靠字号与字重拉开,不靠压低对比度 ——
|
|
14961
|
+
* outline 是描边色(WCAG 只要求 3:1),拿来写字会掉到 AA 线下。
|
|
14962
|
+
*/
|
|
14960
14963
|
.m3-footnote{
|
|
14961
14964
|
padding-top:16px;text-align:center;
|
|
14962
14965
|
font-size:12px;line-height:16px;letter-spacing:.4px;
|
|
14963
|
-
color:var(--md-sys-color-
|
|
14966
|
+
color:var(--md-sys-color-on-surface-variant);
|
|
14964
14967
|
}
|
|
14965
14968
|
`;
|
|
14966
14969
|
}
|
|
@@ -15570,7 +15573,7 @@ th.list .col{max-width:168px}
|
|
|
15570
15573
|
.thumb img{max-width:38px;max-height:38px;display:block}
|
|
15571
15574
|
.thumb img.sharp{image-rendering:pixelated}
|
|
15572
15575
|
.thumb img.broken{display:none}
|
|
15573
|
-
.thumb .fb{display:none;color:var(--md-sys-color-
|
|
15576
|
+
.thumb .fb{display:none;color:var(--md-sys-color-on-surface-variant)}
|
|
15574
15577
|
.thumb.failed .fb{display:block}
|
|
15575
15578
|
.name .txt{min-width:0}
|
|
15576
15579
|
.name .cn{font-size:15px;font-weight:600;line-height:1.25}
|
|
@@ -15578,7 +15581,7 @@ th.list .col{max-width:168px}
|
|
|
15578
15581
|
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px}
|
|
15579
15582
|
.name.correct .cn,.name.correct .en,.name.correct .no{color:#fff}
|
|
15580
15583
|
.name.correct .en,.name.correct .no{opacity:.78}
|
|
15581
|
-
.name .no{font-size:10px;color:var(--md-sys-color-
|
|
15584
|
+
.name .no{font-size:10px;color:var(--md-sys-color-on-surface-variant);margin-top:3px}
|
|
15582
15585
|
|
|
15583
15586
|
/* 最新一行的强调:外圈描边 + 行首的圆头标记 */
|
|
15584
15587
|
tr.fresh .tile,tr.fresh .name{box-shadow:0 0 0 2px var(--accent)}
|
|
@@ -15609,7 +15612,7 @@ tr.fresh .name::before{content:"";position:absolute;left:0;top:14px;bottom:14px;
|
|
|
15609
15612
|
font-size:11.5px;color:#fff;background:var(--tile);
|
|
15610
15613
|
}
|
|
15611
15614
|
.lg.s-none{color:var(--md-sys-color-on-surface-variant)}
|
|
15612
|
-
.tip{margin-left:auto;font-size:11.5px;color:var(--md-sys-color-
|
|
15615
|
+
.tip{margin-left:auto;font-size:11.5px;color:var(--md-sys-color-on-surface-variant);letter-spacing:.02em}
|
|
15613
15616
|
|
|
15614
15617
|
/* ── 通用区块 ─────────────────────────────────────── */
|
|
15615
15618
|
.sec{margin-top:22px}
|
|
@@ -15665,7 +15668,7 @@ tr.fresh .name::before{content:"";position:absolute;left:0;top:14px;bottom:14px;
|
|
|
15665
15668
|
.reveal .big-thumb img{max-width:112px;max-height:112px;display:block}
|
|
15666
15669
|
.reveal .big-thumb img.sharp{image-rendering:pixelated}
|
|
15667
15670
|
.reveal .big-thumb img.broken{display:none}
|
|
15668
|
-
.reveal .big-thumb .fb{display:none;color:var(--md-sys-color-
|
|
15671
|
+
.reveal .big-thumb .fb{display:none;color:var(--md-sys-color-on-surface-variant)}
|
|
15669
15672
|
.reveal .big-thumb.failed .fb{display:block}
|
|
15670
15673
|
.reveal .cn{font-size:36px;font-weight:600;line-height:1.1}
|
|
15671
15674
|
.reveal .en{font-size:13px;letter-spacing:.1em;color:var(--md-sys-color-on-surface-variant);margin-top:10px}
|
|
@@ -15707,11 +15710,11 @@ tr.fresh .name::before{content:"";position:absolute;left:0;top:14px;bottom:14px;
|
|
|
15707
15710
|
.rk .sp{display:flex;align-items:center;gap:4px;font-size:11px;color:var(--md-sys-color-on-surface-variant)}
|
|
15708
15711
|
.rk .tot{flex:none;text-align:right}
|
|
15709
15712
|
.rk .tot .n{font-size:22px;font-weight:600;color:var(--accent);line-height:1;font-variant-numeric:tabular-nums}
|
|
15710
|
-
.rk .tot .c{font-size:10px;color:var(--md-sys-color-
|
|
15713
|
+
.rk .tot .c{font-size:10px;color:var(--md-sys-color-on-surface-variant);margin-top:5px;letter-spacing:.06em}
|
|
15711
15714
|
|
|
15712
15715
|
.empty{padding:36px 20px;min-width:400px;text-align:center;
|
|
15713
15716
|
color:var(--md-sys-color-on-surface-variant);font-size:13.5px;line-height:2}
|
|
15714
|
-
.empty .px{margin:0 auto 14px;color:var(--md-sys-color-
|
|
15717
|
+
.empty .px{margin:0 auto 14px;color:var(--md-sys-color-on-surface-variant)}
|
|
15715
15718
|
`;
|
|
15716
15719
|
function shell(body, opts) {
|
|
15717
15720
|
const width = opts.width ? `width:${opts.width}px;` : "";
|
|
@@ -15866,7 +15869,7 @@ function winCard(o) {
|
|
|
15866
15869
|
<div class="sec-t"><span>答 案 档 案</span></div>
|
|
15867
15870
|
<div class="attrs">${attrs}</div>
|
|
15868
15871
|
</div>
|
|
15869
|
-
</div>` + noteRow("mcdle.排行榜
|
|
15872
|
+
</div>` + noteRow("mcdle.排行榜 查看累计战绩");
|
|
15870
15873
|
return shell(body, { accent: meta.accent, width: 720 });
|
|
15871
15874
|
}
|
|
15872
15875
|
__name(winCard, "winCard");
|
|
@@ -15918,14 +15921,14 @@ function helpCard(dailyLimit, allowRepeat, middleware) {
|
|
|
15918
15921
|
<div class="row"><span class="cmd">mcdle.猜 [名称]</span><span class="m">开始一局,或提交猜测</span></div>
|
|
15919
15922
|
<div class="row"><span class="cmd">mcdle.猜</span><span class="m">局中直接使用可回看当前棋盘</span></div>
|
|
15920
15923
|
<div class="row"><span class="cmd">mcdle.裸猜 [开/关]</span><span class="m">临时切换本频道的无前缀续猜</span></div>
|
|
15921
|
-
<div class="row"><span class="cmd">mcdle.排行榜</span><span class="m"
|
|
15924
|
+
<div class="row"><span class="cmd">mcdle.排行榜</span><span class="m">查看累计战绩</span></div>
|
|
15922
15925
|
<div class="row"><span class="cmd">mcdle.词库</span><span class="m">查阅全部候选词条</span></div>
|
|
15923
15926
|
</div></div>
|
|
15924
15927
|
</div>
|
|
15925
15928
|
<div class="sec">
|
|
15926
15929
|
<div class="sec-t"><span>规 则 细 则</span></div>
|
|
15927
15930
|
<div class="panel"><div class="rows">
|
|
15928
|
-
<div class="row"><span class="k">·</span><span
|
|
15931
|
+
<div class="row"><span class="k">·</span><span>每个频道每日可开始 <b>${dailyLimit}</b> 局,跨零点重置。</span></div>
|
|
15929
15932
|
<div class="row"><span class="k">·</span><span>${allowRepeat ? "允许重复提交已经猜过的词条。" : "同一局内不能重复提交已猜过的词条。"}</span></div>
|
|
15930
15933
|
<div class="row"><span class="k">·</span><span>${middleware ? "本频道裸猜已开启:只接受当前模式词库中的完整纯文本词条。" : "本频道裸猜已停用:续猜请用完整指令。"}</span></div>
|
|
15931
15934
|
<div class="row"><span class="k">·</span><span>空指令与词库外名称不会开启新局或消耗额度。</span></div>
|
|
@@ -15939,7 +15942,7 @@ __name(helpCard, "helpCard");
|
|
|
15939
15942
|
function rankCard(entries, shown) {
|
|
15940
15943
|
if (!entries.length) {
|
|
15941
15944
|
const body2 = header(null, "排行榜", { big: "0", cap: "上榜人数" }) + `<div class="pad"><div class="empty">${px("trophy", 44)}
|
|
15942
|
-
|
|
15945
|
+
排行榜还空着<br><span style="font-size:12px">用 <span class="cmd">mcdle.猜 苦力怕</span> 开出第一局,成为榜首</span></div></div>`;
|
|
15943
15946
|
return shell(body2, { accent: accentOf(90), width: 560 });
|
|
15944
15947
|
}
|
|
15945
15948
|
const max = Math.max(...entries.map((e) => e.total), 1);
|
|
@@ -15947,7 +15950,7 @@ function rankCard(entries, shown) {
|
|
|
15947
15950
|
const pos = i + 1;
|
|
15948
15951
|
const split = ["mob", "item", "block"].map((m) => {
|
|
15949
15952
|
const n = m === "mob" ? e.mob : m === "item" ? e.item : e.block;
|
|
15950
|
-
return `<span class="sp" style="color:${n ? MODES[m].accent : SCHEME.
|
|
15953
|
+
return `<span class="sp" style="color:${n ? MODES[m].accent : SCHEME.onSurfaceVariant}">${px(MODES[m].icon, 10)}<span>${n}</span></span>`;
|
|
15951
15954
|
}).join("");
|
|
15952
15955
|
const w = Math.round(e.total / max * 100);
|
|
15953
15956
|
return `<div class="rk p${pos <= 3 ? pos : "n"}">
|
|
@@ -15958,7 +15961,7 @@ function rankCard(entries, shown) {
|
|
|
15958
15961
|
<div class="tot"><div class="n">${e.total}</div><div class="c">猜 中</div></div>
|
|
15959
15962
|
</div>`;
|
|
15960
15963
|
}).join("");
|
|
15961
|
-
const body = header(null, "
|
|
15964
|
+
const body = header(null, "累计战绩 · 按累计猜中排序", { big: `${shown}`, cap: "上榜人数" }) + `<div class="pad"><div class="rank">${rows}</div></div>` + noteRow("每猜中一局记一分,按模式分别计数");
|
|
15962
15965
|
return shell(body, { accent: accentOf(90), width: 560 });
|
|
15963
15966
|
}
|
|
15964
15967
|
__name(rankCard, "rankCard");
|
|
@@ -15969,15 +15972,6 @@ var usage = `## 使用
|
|
|
15969
15972
|
|
|
15970
15973
|
发送 \`mcdle\` 查看玩法与全部指令。\`mcdle.猜 [名称]\` 用有效词条开局或猜测。首次猜测的词条决定生物、物品或方块模式,系统再从同类词库中抽取答案。
|
|
15971
15974
|
|
|
15972
|
-
## 提示
|
|
15973
|
-
|
|
15974
|
-
| 符号 | 含义 |
|
|
15975
|
-
| --- | --- |
|
|
15976
|
-
| 🟩 | 完全匹配 |
|
|
15977
|
-
| 🟨 | 部分匹配 |
|
|
15978
|
-
| 🟥 | 不匹配 |
|
|
15979
|
-
| 🟥⬆️ / 🟥⬇️ | 答案更大 / 更小 |
|
|
15980
|
-
|
|
15981
15975
|
## 指令
|
|
15982
15976
|
|
|
15983
15977
|
| 指令 | 说明 |
|
|
@@ -15986,12 +15980,21 @@ var usage = `## 使用
|
|
|
15986
15980
|
| \`mcdle.猜 [名称]\` | 用有效词条开局或猜测 |
|
|
15987
15981
|
| \`mcdle.裸猜 [开/关]\` | 开关本频道的无前缀续猜 |
|
|
15988
15982
|
| \`mcdle.排行榜\` | 群内战绩 |
|
|
15989
|
-
| \`mcdle.词库\` | 全部词条
|
|
15983
|
+
| \`mcdle.词库\` | 全部词条 |
|
|
15984
|
+
|
|
15985
|
+
## 提示
|
|
15986
|
+
|
|
15987
|
+
| 符号 | 含义 |
|
|
15988
|
+
| --- | --- |
|
|
15989
|
+
| 🟩 | 完全匹配 |
|
|
15990
|
+
| 🟨 | 部分匹配 |
|
|
15991
|
+
| 🟥 | 不匹配 |
|
|
15992
|
+
| 🟥⬆️ / 🟥⬇️ | 答案更大 / 更小 |`;
|
|
15990
15993
|
var inject = { required: ["database"], optional: ["puppeteer"] };
|
|
15991
15994
|
var Config = import_koishi.Schema.object({
|
|
15992
15995
|
atReply: import_koishi.Schema.boolean().default(false).description("回复时 @ 用户。"),
|
|
15993
15996
|
quoteReply: import_koishi.Schema.boolean().default(false).description("回复时引用消息。"),
|
|
15994
|
-
|
|
15997
|
+
enableDirectInput: import_koishi.Schema.boolean().default(false).description("对局中直接发送词条名称即可续猜,无需指令前缀。各频道可用「mcdle.裸猜」临时切换。"),
|
|
15995
15998
|
addStatusTextAfterEmoji: import_koishi.Schema.boolean().default(true).description("在状态方块后补一段文字说明。"),
|
|
15996
15999
|
maxRank: import_koishi.Schema.number().default(10).min(0).description("排行榜最多显示的人数。"),
|
|
15997
16000
|
dailyPlayLimit: import_koishi.Schema.number().default(1).min(1).description("每个频道每日可开始的局数,跨零点重置。"),
|
|
@@ -16105,7 +16108,7 @@ function apply(ctx, cfg) {
|
|
|
16105
16108
|
);
|
|
16106
16109
|
const logger = ctx.logger("mcdle");
|
|
16107
16110
|
const middlewareOverrides = /* @__PURE__ */ new Map();
|
|
16108
|
-
const middlewareOn = /* @__PURE__ */ __name((channelId) => channelId === void 0 ? cfg.
|
|
16111
|
+
const middlewareOn = /* @__PURE__ */ __name((channelId) => channelId === void 0 ? cfg.enableDirectInput : middlewareOverrides.get(channelId) ?? cfg.enableDirectInput, "middlewareOn");
|
|
16109
16112
|
ctx.middleware(async (session, next) => {
|
|
16110
16113
|
if (!session.channelId || !middlewareOn(session.channelId)) return await next();
|
|
16111
16114
|
const guess = getMiddlewareGuess(session);
|
|
@@ -16127,11 +16130,11 @@ function apply(ctx, cfg) {
|
|
|
16127
16130
|
ctx.command("mcdle.猜 [guess:string]", "开局或提交一次猜测").action(async ({ session }, guess) => {
|
|
16128
16131
|
await c(session, guess?.trim());
|
|
16129
16132
|
});
|
|
16130
|
-
ctx.command("mcdle.排行榜", "
|
|
16133
|
+
ctx.command("mcdle.排行榜", "查看累计猜中排行榜").action(async ({ session }) => phb(session));
|
|
16131
16134
|
ctx.command("mcdle.词库", "查阅全部候选词条").action(async ({ session }) => ck(session));
|
|
16132
16135
|
ctx.command("mcdle.裸猜 [state:string]", "开关本频道的无前缀续猜").usage("例:mcdle.裸猜(切换)· mcdle.裸猜 开 · mcdle.裸猜 关 · mcdle.裸猜 状态").action(async ({ session }, state) => {
|
|
16133
16136
|
const result = resolveMiddlewareSwitch(
|
|
16134
|
-
cfg.
|
|
16137
|
+
cfg.enableDirectInput,
|
|
16135
16138
|
session.channelId === void 0 ? void 0 : middlewareOverrides.get(session.channelId),
|
|
16136
16139
|
state
|
|
16137
16140
|
);
|
|
@@ -16147,10 +16150,9 @@ function apply(ctx, cfg) {
|
|
|
16147
16150
|
middlewareSwitchText(result.on, result.override !== void 0, result.reverted)
|
|
16148
16151
|
);
|
|
16149
16152
|
});
|
|
16150
|
-
const RULE = "────────────";
|
|
16151
16153
|
function textCard(title, ...sections) {
|
|
16152
16154
|
const body = sections.map((s) => Array.isArray(s) ? s.filter(Boolean).join("\n") : s).filter((s) => !!s && !!s.trim()).join("\n\n");
|
|
16153
|
-
return [`▍${title}`,
|
|
16155
|
+
return [`▍${title}`, body].filter(Boolean).join("\n");
|
|
16154
16156
|
}
|
|
16155
16157
|
__name(textCard, "textCard");
|
|
16156
16158
|
function modeName(mode) {
|
|
@@ -16213,7 +16215,7 @@ function apply(ctx, cfg) {
|
|
|
16213
16215
|
`${meta.tagline},从 ${meta.total} 个候选中锁定唯一答案。`,
|
|
16214
16216
|
`可推理属性:${FIELDS[mode].map((k) => keyMap[k] || k).join(" / ")}`,
|
|
16215
16217
|
[
|
|
16216
|
-
channelOn ? `直接发送词库中的${meta.name}
|
|
16218
|
+
channelOn ? `直接发送词库中的${meta.name}名称,或发送「mcdle.猜 [名称]」` : `mcdle.猜 [名称] 提交一次猜测`,
|
|
16217
16219
|
`今日进度 ${played}/${cfg.dailyPlayLimit}`
|
|
16218
16220
|
]
|
|
16219
16221
|
);
|
|
@@ -16225,7 +16227,7 @@ function apply(ctx, cfg) {
|
|
|
16225
16227
|
(k) => `${fieldLabel(k)} ${displayValues(k, o.answer[k]).map((v) => v.text).join("、")}`
|
|
16226
16228
|
).join(" · ");
|
|
16227
16229
|
return textCard(
|
|
16228
|
-
"猜中了",
|
|
16230
|
+
"🏆 猜中了",
|
|
16229
16231
|
wikiImage(o.answer),
|
|
16230
16232
|
`答案 ${o.answer.chinese_title}${o.answer.title ? ` ${o.answer.title}` : ""}`,
|
|
16231
16233
|
[
|
|
@@ -16281,13 +16283,13 @@ function apply(ctx, cfg) {
|
|
|
16281
16283
|
}
|
|
16282
16284
|
__name(mcdle, "mcdle");
|
|
16283
16285
|
function middlewareSwitchText(on, temporary, reverted) {
|
|
16284
|
-
const mark =
|
|
16286
|
+
const mark = "✅";
|
|
16285
16287
|
const state = on ? "开启" : "停用";
|
|
16286
|
-
const config = cfg.
|
|
16288
|
+
const config = cfg.enableDirectInput ? "开启" : "停用";
|
|
16287
16289
|
if (!temporary) {
|
|
16288
16290
|
return `${mark} 裸猜续局 · ${reverted ? "已复原," : ""}跟随插件配置(${state})`;
|
|
16289
16291
|
}
|
|
16290
|
-
const hint = on ? "仅在已有对局中,直接发送当前模式的完整词条名称才会响应" : "
|
|
16292
|
+
const hint = on ? "仅在已有对局中,直接发送当前模式的完整词条名称才会响应" : "续猜请发送「mcdle.猜 [名称]」";
|
|
16291
16293
|
return [
|
|
16292
16294
|
`${mark} 裸猜续局 · 本频道临时${state}(插件配置:${config})`,
|
|
16293
16295
|
`${hint};再次发送 mcdle.裸猜 可复原`
|
|
@@ -16303,7 +16305,6 @@ function apply(ctx, cfg) {
|
|
|
16303
16305
|
if (["red", "onebot"].includes(session.platform)) {
|
|
16304
16306
|
const allContentNodes = sections.map(
|
|
16305
16307
|
([title, words]) => (0, import_koishi.h)("message", { userId: session.userId }, `▍${title}
|
|
16306
|
-
${RULE}
|
|
16307
16308
|
${words.join(" ")}`)
|
|
16308
16309
|
);
|
|
16309
16310
|
try {
|
|
@@ -16316,7 +16317,6 @@ ${words.join(" ")}`)
|
|
|
16316
16317
|
await sendMsg(
|
|
16317
16318
|
session,
|
|
16318
16319
|
sections.map(([title, words]) => `▍${title}
|
|
16319
|
-
${RULE}
|
|
16320
16320
|
${words.join(" ")}`).join("\n\n")
|
|
16321
16321
|
);
|
|
16322
16322
|
}
|
|
@@ -16378,7 +16378,22 @@ ${words.join(" ")}`).join("\n\n")
|
|
|
16378
16378
|
return candidates[Math.floor(Math.random() * candidates.length)];
|
|
16379
16379
|
}
|
|
16380
16380
|
__name(pickAnswer, "pickAnswer");
|
|
16381
|
+
const busyChannels = /* @__PURE__ */ new Set();
|
|
16381
16382
|
async function c(session, guess, allowStart = true) {
|
|
16383
|
+
const channelId = session.channelId;
|
|
16384
|
+
if (channelId && busyChannels.has(channelId)) {
|
|
16385
|
+
await sendMsg(session, "⏳ 上一次猜测还在处理,稍等一下。");
|
|
16386
|
+
return true;
|
|
16387
|
+
}
|
|
16388
|
+
if (channelId) busyChannels.add(channelId);
|
|
16389
|
+
try {
|
|
16390
|
+
return await guessOnce(session, guess, allowStart);
|
|
16391
|
+
} finally {
|
|
16392
|
+
if (channelId) busyChannels.delete(channelId);
|
|
16393
|
+
}
|
|
16394
|
+
}
|
|
16395
|
+
__name(c, "c");
|
|
16396
|
+
async function guessOnce(session, guess, allowStart = true) {
|
|
16382
16397
|
const record = await ensureRecord(session);
|
|
16383
16398
|
const now = /* @__PURE__ */ new Date();
|
|
16384
16399
|
await resetDailyIfNeeded(session, record, now);
|
|
@@ -16417,7 +16432,7 @@ ${words.join(" ")}`).join("\n\n")
|
|
|
16417
16432
|
}
|
|
16418
16433
|
return true;
|
|
16419
16434
|
}
|
|
16420
|
-
__name(
|
|
16435
|
+
__name(guessOnce, "guessOnce");
|
|
16421
16436
|
function restoreGuessHistory(record) {
|
|
16422
16437
|
const mode = record.gameMode;
|
|
16423
16438
|
if (!mode || !MODES[mode] || !record.answer) return null;
|
|
@@ -16449,8 +16464,8 @@ ${words.join(" ")}`).join("\n\n")
|
|
|
16449
16464
|
await sendMsg(
|
|
16450
16465
|
session,
|
|
16451
16466
|
textCard(
|
|
16452
|
-
"检测到旧版本遗留的一局",
|
|
16453
|
-
"
|
|
16467
|
+
"❌ 检测到旧版本遗留的一局",
|
|
16468
|
+
"这一局是在旧版本下开始的,已有的猜测记录没法用新版图片牌面渲染。",
|
|
16454
16469
|
answerTitle ? `「${answerTitle}」已退回词库,之后仍有机会被抽到。` : null,
|
|
16455
16470
|
allowStart ? "这一局已作废并退还今日额度,马上按这次的完整指令重新开局。" : "这一局已作废并退还今日额度,发送「mcdle.猜 [名称]」重新开局。"
|
|
16456
16471
|
)
|
|
@@ -16548,7 +16563,7 @@ ${words.join(" ")}`).join("\n\n")
|
|
|
16548
16563
|
);
|
|
16549
16564
|
await sendMsg(
|
|
16550
16565
|
session,
|
|
16551
|
-
textCard("
|
|
16566
|
+
textCard("❌ 这一局的牌面已经无法还原", "已经把它收掉了。发送「mcdle.猜 [名称]」重新开一局。")
|
|
16552
16567
|
);
|
|
16553
16568
|
return;
|
|
16554
16569
|
}
|
|
@@ -16684,7 +16699,7 @@ ${words.join(" ")}`).join("\n\n")
|
|
|
16684
16699
|
"mcdle.词库 查阅全部候选词条"
|
|
16685
16700
|
],
|
|
16686
16701
|
[
|
|
16687
|
-
|
|
16702
|
+
`每个频道每日 ${cfg.dailyPlayLimit} 局,跨零点重置。`,
|
|
16688
16703
|
cfg.allowRepeatedGuesses ? "允许重复提交已经猜过的词条。" : "同一局内不能重复提交已猜过的词条。",
|
|
16689
16704
|
channelOn ? "本频道裸猜已开启:仅已有对局、纯文本完整词条、且符合当前模式时响应。" : "本频道裸猜已停用:续猜请用完整指令。",
|
|
16690
16705
|
"空指令和词库外名称不会开启新局或消耗额度。",
|