koishi-plugin-ciyi 1.3.0 → 1.4.1
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 +1 -1
- package/lib/index.js +56 -53
- package/package.json +1 -1
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\
|
|
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\u6E38\u620F\u5E76\u63D0\u4EA4\u731C\u6D4B |\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[];
|
package/lib/index.js
CHANGED
|
@@ -430,7 +430,7 @@ function drawWordGrid(ctx, x, y, word, size, mask) {
|
|
|
430
430
|
const gap = s(g.gap);
|
|
431
431
|
const chars = Array.from(word || "");
|
|
432
432
|
if (chars.length === 0) {
|
|
433
|
-
textCenter(ctx, "—", x + s(14), y + cell / 2, `${s(13)}px ${FONT_SANS}`, C.
|
|
433
|
+
textCenter(ctx, "—", x + s(14), y + cell / 2, `${s(13)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
434
434
|
return s(28);
|
|
435
435
|
}
|
|
436
436
|
let cx = x;
|
|
@@ -472,7 +472,7 @@ function drawHeader(ctx, innerX, innerY, innerW, sub, right) {
|
|
|
472
472
|
brandX,
|
|
473
473
|
innerY + padTop + s(36),
|
|
474
474
|
`italic ${s(10)}px ${FONT_NUM}`,
|
|
475
|
-
C.
|
|
475
|
+
C.onSurfaceVariant
|
|
476
476
|
);
|
|
477
477
|
const subRight = right ? innerX + innerW - padX - s(150) : innerX + innerW - padX;
|
|
478
478
|
textLeftFit(
|
|
@@ -487,7 +487,7 @@ function drawHeader(ctx, innerX, innerY, innerW, sub, right) {
|
|
|
487
487
|
if (right) {
|
|
488
488
|
const rx = innerX + innerW - padX;
|
|
489
489
|
textRight(ctx, right.big, rx, innerY + padTop + s(16), `700 ${s(31)}px ${FONT_NUM}`, C.primary);
|
|
490
|
-
textRight(ctx, right.cap, rx, innerY + padTop + s(44), `${s(10.5)}px ${FONT_SANS}`, C.
|
|
490
|
+
textRight(ctx, right.cap, rx, innerY + padTop + s(44), `${s(10.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
491
491
|
}
|
|
492
492
|
const lineY = innerY + h2;
|
|
493
493
|
ctx.strokeStyle = C.outlineVariant;
|
|
@@ -527,7 +527,7 @@ function drawFooter(ctx, innerX, y, innerW, legendItems, tip) {
|
|
|
527
527
|
lx += s(9) + s(6);
|
|
528
528
|
textLeft(ctx, tier.name, lx, cy, `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
529
529
|
lx += textWidth(tier.name, s(11.5)) + s(4);
|
|
530
|
-
textLeft(ctx, range, lx, cy, `${s(11)}px ${FONT_NUM}`, C.
|
|
530
|
+
textLeft(ctx, range, lx, cy, `${s(11)}px ${FONT_NUM}`, C.onSurfaceVariant);
|
|
531
531
|
lx += textWidth(range, s(11)) + s(13);
|
|
532
532
|
}
|
|
533
533
|
const tipFont = `${s(11.5)}px ${FONT_SANS}`;
|
|
@@ -538,7 +538,7 @@ function drawFooter(ctx, innerX, y, innerW, legendItems, tip) {
|
|
|
538
538
|
innerX + innerW - padX,
|
|
539
539
|
cy,
|
|
540
540
|
tipFont,
|
|
541
|
-
C.
|
|
541
|
+
C.onSurfaceVariant
|
|
542
542
|
);
|
|
543
543
|
return h2 + padY * 2;
|
|
544
544
|
}
|
|
@@ -552,8 +552,8 @@ function drawLegendFull(ctx, x, y, w) {
|
|
|
552
552
|
const cy = y + Math.floor(i / 2) * rowH;
|
|
553
553
|
fillRound(ctx, cx, cy - s(4.5), s(9), s(9), s(SHAPE.full), t.color);
|
|
554
554
|
textLeft(ctx, t.name, cx + s(15), cy, `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
555
|
-
textLeft(ctx, tierRange(i), cx + s(52), cy, `${s(11)}px ${FONT_NUM}`, C.
|
|
556
|
-
textLeft(ctx, t.note, cx + s(100), cy, `${s(11.5)}px ${FONT_SANS}`, C.
|
|
555
|
+
textLeft(ctx, tierRange(i), cx + s(52), cy, `${s(11)}px ${FONT_NUM}`, C.onSurfaceVariant);
|
|
556
|
+
textLeft(ctx, t.note, cx + s(100), cy, `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
557
557
|
}
|
|
558
558
|
return rowH * Math.ceil(TIERS.length / 2) + s(8);
|
|
559
559
|
}
|
|
@@ -637,12 +637,12 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
637
637
|
const mtX = mt0 + Math.max(0, (cols.mt - meterBlockW) / 2);
|
|
638
638
|
const headY = y;
|
|
639
639
|
const fs = s(10.5);
|
|
640
|
-
textLeft(ctx, "序", noX, headY, `${fs}px ${FONT_SANS}`, C.
|
|
641
|
-
textCenter(ctx, "更近 ◀", nb0 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
642
|
-
textCenter(ctx, "猜测", gw0 + cols.gw / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
643
|
-
textCenter(ctx, "▶ 更远", nb1 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
644
|
-
textCenter(ctx, "排名", rk0 + cols.rk / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
645
|
-
textCenter(ctx, "亲疏", mt0 + cols.mt / 2, headY, `${fs}px ${FONT_SANS}`, C.
|
|
640
|
+
textLeft(ctx, "序", noX, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
641
|
+
textCenter(ctx, "更近 ◀", nb0 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
642
|
+
textCenter(ctx, "猜测", gw0 + cols.gw / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
643
|
+
textCenter(ctx, "▶ 更远", nb1 + cols.nb / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
644
|
+
textCenter(ctx, "排名", rk0 + cols.rk / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
645
|
+
textCenter(ctx, "亲疏", mt0 + cols.mt / 2, headY, `${fs}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
646
646
|
let ry = y + s(22);
|
|
647
647
|
let ordinal = 0;
|
|
648
648
|
for (const row of opts.rows) {
|
|
@@ -654,7 +654,7 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
654
654
|
cx + tableW / 2,
|
|
655
655
|
ry + s(10),
|
|
656
656
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
657
|
-
C.
|
|
657
|
+
C.onSurfaceVariant
|
|
658
658
|
);
|
|
659
659
|
ctx.strokeStyle = C.outlineVariant;
|
|
660
660
|
ctx.beginPath();
|
|
@@ -684,7 +684,7 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
684
684
|
noX,
|
|
685
685
|
midY,
|
|
686
686
|
`${s(13)}px ${FONT_NUM}`,
|
|
687
|
-
C.
|
|
687
|
+
C.onSurfaceVariant
|
|
688
688
|
);
|
|
689
689
|
const nbX = nb0 + (cols.nb - gridWidth(history.leftHint, "sm")) / 2;
|
|
690
690
|
drawWordGrid(ctx, nbX, midY - s(13), history.leftHint, "sm", 0);
|
|
@@ -698,7 +698,7 @@ function drawBoardTable(ctx, x, y, w, opts, rowH) {
|
|
|
698
698
|
const hashW = textWidth("#", s(13));
|
|
699
699
|
const rankBlock = hashW + s(3) + rankWidth;
|
|
700
700
|
const rankLeft = rk0 + (cols.rk - rankBlock) / 2;
|
|
701
|
-
textLeft(ctx, "#", rankLeft, midY, `${s(13)}px ${FONT_NUM}`, C.
|
|
701
|
+
textLeft(ctx, "#", rankLeft, midY, `${s(13)}px ${FONT_NUM}`, C.onSurfaceVariant);
|
|
702
702
|
textLeft(ctx, rankText, rankLeft + hashW + s(3), midY, rankFont, tier.color);
|
|
703
703
|
drawNearBar(ctx, mtX, midY, pct, tier);
|
|
704
704
|
ry += rowH;
|
|
@@ -789,7 +789,7 @@ function renderIntroCard(service, opts) {
|
|
|
789
789
|
ix + s(38),
|
|
790
790
|
y + s(104),
|
|
791
791
|
`${s(12)}px ${FONT_SANS}`,
|
|
792
|
-
C.
|
|
792
|
+
C.onSurfaceVariant
|
|
793
793
|
);
|
|
794
794
|
textLeft(
|
|
795
795
|
ctx,
|
|
@@ -797,7 +797,7 @@ function renderIntroCard(service, opts) {
|
|
|
797
797
|
ix + s(38),
|
|
798
798
|
y + s(126),
|
|
799
799
|
`${s(12)}px ${FONT_SANS}`,
|
|
800
|
-
C.
|
|
800
|
+
C.onSurfaceVariant
|
|
801
801
|
);
|
|
802
802
|
textLeft(
|
|
803
803
|
ctx,
|
|
@@ -828,7 +828,7 @@ function renderIntroCard(service, opts) {
|
|
|
828
828
|
ix + s(22),
|
|
829
829
|
iy + ih - s(30),
|
|
830
830
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
831
|
-
C.
|
|
831
|
+
C.onSurfaceVariant
|
|
832
832
|
);
|
|
833
833
|
});
|
|
834
834
|
}
|
|
@@ -842,11 +842,11 @@ function renderWinCard(service, opts) {
|
|
|
842
842
|
const revealH = s(130);
|
|
843
843
|
drawPanel(ctx, ix + s(22), y, iw - s(44), revealH);
|
|
844
844
|
drawSeal(ctx, ix + iw - s(80), y - s(13), s(42), ["中"]);
|
|
845
|
-
textLeft(ctx, "今日答案", ix + s(38), y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.
|
|
845
|
+
textLeft(ctx, "今日答案", ix + s(38), y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
846
846
|
drawWordGrid(ctx, ix + s(38), y + s(40), opts.answer, "lg");
|
|
847
847
|
const ax = ix + iw - s(310);
|
|
848
848
|
if (opts.neighbors.length) {
|
|
849
|
-
textLeft(ctx, "意思最近的几个词", ax, y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.
|
|
849
|
+
textLeft(ctx, "意思最近的几个词", ax, y + s(24), `${s(11.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
850
850
|
let nx = ax;
|
|
851
851
|
let ny = y + s(48);
|
|
852
852
|
const chipFont = `${s(14)}px ${FONT_SANS}`;
|
|
@@ -888,7 +888,7 @@ function renderWinCard(service, opts) {
|
|
|
888
888
|
if (stats[i].u) {
|
|
889
889
|
textLeft(ctx, stats[i].u, sx + s(14) + textWidth(stats[i].n, s(23)) + s(3), y + s(26), `${s(12)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
890
890
|
}
|
|
891
|
-
textLeft(ctx, stats[i].c, sx + s(14), y + s(44), `${s(10.5)}px ${FONT_SANS}`, C.
|
|
891
|
+
textLeft(ctx, stats[i].c, sx + s(14), y + s(44), `${s(10.5)}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
892
892
|
}
|
|
893
893
|
const quip = opts.closest === null ? "一击即中,今日无需第二次落笔" : `从 #${opts.closest} 一步跨到 #1`;
|
|
894
894
|
const footerTip = opts.canStartToday ? "ciyi.猜 山水 · 开启今日新题" : "明日零点换新题 · ciyi.排行榜";
|
|
@@ -945,7 +945,7 @@ function renderRankCard(service, opts) {
|
|
|
945
945
|
panelX + panelW / 2,
|
|
946
946
|
y + s(31),
|
|
947
947
|
`${s(13.5)}px ${FONT_SANS}`,
|
|
948
|
-
C.
|
|
948
|
+
C.onSurfaceVariant
|
|
949
949
|
);
|
|
950
950
|
textCenter(
|
|
951
951
|
ctx,
|
|
@@ -953,7 +953,7 @@ function renderRankCard(service, opts) {
|
|
|
953
953
|
panelX + panelW / 2,
|
|
954
954
|
y + s(61),
|
|
955
955
|
`${s(13.5)}px ${FONT_SANS}`,
|
|
956
|
-
C.
|
|
956
|
+
C.onSurfaceVariant
|
|
957
957
|
);
|
|
958
958
|
} else {
|
|
959
959
|
let ry = y;
|
|
@@ -1005,7 +1005,7 @@ function renderRankCard(service, opts) {
|
|
|
1005
1005
|
`700 ${scoreFont}px ${FONT_NUM}`,
|
|
1006
1006
|
C.onSurface
|
|
1007
1007
|
);
|
|
1008
|
-
textRight(ctx, "次", contentRight, midY, `${unitFont}px ${FONT_SANS}`, C.
|
|
1008
|
+
textRight(ctx, "次", contentRight, midY, `${unitFont}px ${FONT_SANS}`, C.onSurfaceVariant);
|
|
1009
1009
|
ry += rowH;
|
|
1010
1010
|
}
|
|
1011
1011
|
if (opts.hidden > 0) {
|
|
@@ -1015,7 +1015,7 @@ function renderRankCard(service, opts) {
|
|
|
1015
1015
|
contentLeft,
|
|
1016
1016
|
ry + s(16),
|
|
1017
1017
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
1018
|
-
C.
|
|
1018
|
+
C.onSurfaceVariant
|
|
1019
1019
|
);
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
@@ -1033,7 +1033,7 @@ function renderRankCard(service, opts) {
|
|
|
1033
1033
|
panelX,
|
|
1034
1034
|
iy + ih - s(30),
|
|
1035
1035
|
`${s(11.5)}px ${FONT_SANS}`,
|
|
1036
|
-
C.
|
|
1036
|
+
C.onSurfaceVariant
|
|
1037
1037
|
);
|
|
1038
1038
|
});
|
|
1039
1039
|
}
|
|
@@ -1043,7 +1043,7 @@ __name(renderRankCard, "renderRankCard");
|
|
|
1043
1043
|
var name = "ciyi";
|
|
1044
1044
|
var usage = `## 使用
|
|
1045
1045
|
|
|
1046
|
-
|
|
1046
|
+
发送 \`ciyi\` 查看玩法。每日藏一个两字词,用 \`ciyi.猜 <词>\` 开题,之后可以直接发送两字词继续猜。裸词设置只对当前频道生效,重启后恢复默认。
|
|
1047
1047
|
|
|
1048
1048
|
## 指令
|
|
1049
1049
|
|
|
@@ -1051,18 +1051,18 @@ var usage = `## 使用
|
|
|
1051
1051
|
| --- | --- |
|
|
1052
1052
|
| \`ciyi\` | 玩法 |
|
|
1053
1053
|
| \`ciyi.猜 <词>\` | 开始今日游戏并提交猜测 |
|
|
1054
|
-
| \`ciyi.裸词 [开/关]\` |
|
|
1055
|
-
| \`ciyi.排行榜\` |
|
|
1054
|
+
| \`ciyi.裸词 [开/关]\` | 开关本频道的无前缀续猜 |
|
|
1055
|
+
| \`ciyi.排行榜\` | 累计猜中排行榜 |`;
|
|
1056
1056
|
var inject = { required: ["database"], optional: ["canvas"] };
|
|
1057
1057
|
var Config = import_koishi.Schema.object({
|
|
1058
|
-
atReply: import_koishi.Schema.boolean().default(false).description("
|
|
1059
|
-
quoteReply: import_koishi.Schema.boolean().default(false).description("
|
|
1058
|
+
atReply: import_koishi.Schema.boolean().default(false).description("回复时 @ 用户。"),
|
|
1059
|
+
quoteReply: import_koishi.Schema.boolean().default(false).description("回复时引用消息。"),
|
|
1060
1060
|
isEnableMiddleware: import_koishi.Schema.boolean().default(true).description(
|
|
1061
|
-
"
|
|
1061
|
+
"已开题时,直接发送两字词即可续猜,无需指令前缀。各频道可用「ciyi.裸词」临时切换。"
|
|
1062
1062
|
),
|
|
1063
|
-
renderImage: import_koishi.Schema.boolean().default(true).description("
|
|
1064
|
-
maxHistory: import_koishi.Schema.number().default(10).min(0).description("
|
|
1065
|
-
maxRank: import_koishi.Schema.number().default(10).min(0).description("
|
|
1063
|
+
renderImage: import_koishi.Schema.boolean().default(true).description("把猜测板渲染成图片,复用 Koishi Canvas 服务。服务不可用时自动回退为等价文本。"),
|
|
1064
|
+
maxHistory: import_koishi.Schema.number().default(10).min(0).description("猜测板最多列出的历史条数。最新一次猜测始终会列出。"),
|
|
1065
|
+
maxRank: import_koishi.Schema.number().default(10).min(0).description("排行榜最多显示的人数。")
|
|
1066
1066
|
});
|
|
1067
1067
|
function getMiddlewareGuess(session) {
|
|
1068
1068
|
const message = session.event.message;
|
|
@@ -1092,7 +1092,7 @@ function resolveMiddlewareSwitch(config, override, action) {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
const on = arg === "开" || arg === "开启";
|
|
1094
1094
|
if (!on && arg !== "关" && arg !== "关闭") {
|
|
1095
|
-
return { error: "
|
|
1095
|
+
return { error: "裸词开关只认「开」「关」「状态」" };
|
|
1096
1096
|
}
|
|
1097
1097
|
if (on === config) {
|
|
1098
1098
|
return { override: void 0, on: config, reverted: override !== void 0 };
|
|
@@ -1149,23 +1149,24 @@ function apply(ctx, cfg) {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
return await session.execute(`ciyi.猜 ${guess}`);
|
|
1151
1151
|
});
|
|
1152
|
-
ctx.command("ciyi", "
|
|
1152
|
+
ctx.command("ciyi", "词意 · 按意思远近找词").action(async ({ session }) => {
|
|
1153
1153
|
return await wf(session);
|
|
1154
1154
|
});
|
|
1155
1155
|
ctx.command("ciyi.猜 <guess:string>", "报一个两字词").usage("例:ciyi.猜 山水").action(async ({ session }, guess) => {
|
|
1156
1156
|
return await c(session, guess?.trim());
|
|
1157
1157
|
});
|
|
1158
|
-
ctx.command("ciyi.排行榜", "
|
|
1158
|
+
ctx.command("ciyi.排行榜", "查看累计猜中排行榜").action(async ({ session }) => {
|
|
1159
1159
|
return await phb(session);
|
|
1160
1160
|
});
|
|
1161
|
-
ctx.command("ciyi.裸词 [state:string]", "
|
|
1161
|
+
ctx.command("ciyi.裸词 [state:string]", "开关本频道的无前缀续猜").usage("例:ciyi.裸词(切换)· ciyi.裸词 开 · ciyi.裸词 关 · ciyi.裸词 状态").action(async ({ session }, state) => {
|
|
1162
1162
|
const result = resolveMiddlewareSwitch(
|
|
1163
1163
|
cfg.isEnableMiddleware,
|
|
1164
1164
|
session.channelId === void 0 ? void 0 : middlewareOverrides.get(session.channelId),
|
|
1165
1165
|
state
|
|
1166
1166
|
);
|
|
1167
1167
|
if ("error" in result) {
|
|
1168
|
-
return await sendMsg(session, `⚠️ ${result.error}
|
|
1168
|
+
return await sendMsg(session, `⚠️ ${result.error}
|
|
1169
|
+
例:「ciyi.裸词 开」,不带参数则来回切换。`);
|
|
1169
1170
|
}
|
|
1170
1171
|
if (result.override === void 0) middlewareOverrides.delete(session.channelId);
|
|
1171
1172
|
else middlewareOverrides.set(session.channelId, result.override);
|
|
@@ -1288,16 +1289,16 @@ function apply(ctx, cfg) {
|
|
|
1288
1289
|
}
|
|
1289
1290
|
__name(introText, "introText");
|
|
1290
1291
|
function middlewareSwitchText(o) {
|
|
1291
|
-
const mark =
|
|
1292
|
+
const mark = "✅";
|
|
1292
1293
|
const state = o.on ? "开启" : "停用";
|
|
1293
1294
|
const config = cfg.isEnableMiddleware ? "开启" : "停用";
|
|
1294
1295
|
if (!o.temporary) {
|
|
1295
1296
|
return `${mark} 裸词续猜 · ${o.reverted ? "已复原," : ""}跟随插件配置(${state})`;
|
|
1296
1297
|
}
|
|
1297
|
-
const hint = o.on ? "开题后直接发送两字词即可续猜" : "
|
|
1298
|
+
const hint = o.on ? "开题后直接发送两字词即可续猜" : "续猜改用「ciyi.猜 山水」";
|
|
1298
1299
|
return [
|
|
1299
|
-
`${mark} 裸词续猜 ·
|
|
1300
|
-
`${hint}
|
|
1300
|
+
`${mark} 裸词续猜 · 本频道临时${state}(插件配置:${config})`,
|
|
1301
|
+
`${hint};再次发送「ciyi.裸词」复原`
|
|
1301
1302
|
].join("\n");
|
|
1302
1303
|
}
|
|
1303
1304
|
__name(middlewareSwitchText, "middlewareSwitchText");
|
|
@@ -1319,7 +1320,7 @@ function apply(ctx, cfg) {
|
|
|
1319
1320
|
if (!entries.length) {
|
|
1320
1321
|
return textCard(
|
|
1321
1322
|
"词意每日挑战排行榜",
|
|
1322
|
-
"
|
|
1323
|
+
"榜上无名。今日第一个猜中的人,名字会写在这里。"
|
|
1323
1324
|
);
|
|
1324
1325
|
}
|
|
1325
1326
|
return textCard(
|
|
@@ -1422,30 +1423,31 @@ function apply(ctx, cfg) {
|
|
|
1422
1423
|
__name(getTodayGame, "getTodayGame");
|
|
1423
1424
|
async function c(session, guess) {
|
|
1424
1425
|
if (!guess || Array.from(guess).length !== 2) {
|
|
1425
|
-
return await sendMsg(session, "⚠️
|
|
1426
|
+
return await sendMsg(session, "⚠️ 词意只收两字词\n例:「ciyi.猜 山水」。");
|
|
1426
1427
|
}
|
|
1427
1428
|
if (!allWords_default.includes(guess)) {
|
|
1428
|
-
return await sendMsg(session, `⚠️ 「${guess}
|
|
1429
|
+
return await sendMsg(session, `⚠️ 「${guess}」不在词库里
|
|
1430
|
+
换个常见些的词试试。`);
|
|
1429
1431
|
}
|
|
1430
1432
|
const gameInfo = await getTodayGame(session);
|
|
1431
1433
|
if (!gameInfo) {
|
|
1432
1434
|
return await sendMsg(
|
|
1433
1435
|
session,
|
|
1434
|
-
"❌
|
|
1436
|
+
"❌ 今日的题目没能载入\n词库文件暂时读不到,稍后再试一次。"
|
|
1435
1437
|
);
|
|
1436
1438
|
}
|
|
1437
1439
|
if (gameInfo.isOver) {
|
|
1438
1440
|
return await sendMsg(
|
|
1439
1441
|
session,
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
+
`💡 今日挑战已结束,答案是「${gameInfo.answer}」。
|
|
1443
|
+
明日零点换新题,发送「ciyi.排行榜」看战绩。`
|
|
1442
1444
|
);
|
|
1443
1445
|
}
|
|
1444
1446
|
if (gameInfo.guessedHistoryInOneGame.includes(guess)) {
|
|
1445
1447
|
const old = gameInfo.history.find((it) => it.guess === guess);
|
|
1446
1448
|
return await sendMsg(
|
|
1447
1449
|
session,
|
|
1448
|
-
old ?
|
|
1450
|
+
old ? `💡 「${guess}」已经猜过 · #${old.rank} · ${tierOf(old.rank).name}` : `💡 「${guess}」已经猜过`
|
|
1449
1451
|
);
|
|
1450
1452
|
}
|
|
1451
1453
|
if (guess === gameInfo.answer) {
|
|
@@ -1497,7 +1499,8 @@ function apply(ctx, cfg) {
|
|
|
1497
1499
|
const entry = getHistory(guess, rankList);
|
|
1498
1500
|
if (!entry) {
|
|
1499
1501
|
logger.warn(`「${guess}」不在 ${gameInfo.answer} 的榜单中`);
|
|
1500
|
-
return await sendMsg(session, `⚠️ 「${guess}
|
|
1502
|
+
return await sendMsg(session, `⚠️ 「${guess}」不在今日的榜单里
|
|
1503
|
+
换个词试试。`);
|
|
1501
1504
|
}
|
|
1502
1505
|
const history = [...gameInfo.history, entry];
|
|
1503
1506
|
await ctx.database.set(
|