koishi-plugin-wordle-game 2.7.2 → 2.8.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 +4 -4
- package/lib/config.d.ts +1 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +103 -133
- package/package.json +2 -6
package/README.md
CHANGED
|
@@ -8,15 +8,15 @@ Koishi 的多模式猜词游戏插件。
|
|
|
8
8
|
|
|
9
9
|
## 使用
|
|
10
10
|
|
|
11
|
-
`
|
|
11
|
+
`wordle.开始` 开局,然后直接输入猜测词。
|
|
12
12
|
|
|
13
13
|
## 指令
|
|
14
14
|
|
|
15
15
|
| 指令 | 说明 |
|
|
16
16
|
| --- | --- |
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
17
|
+
| `wordle.开始 [长度]` | 开始引导 |
|
|
18
|
+
| `wordle.开始.<模式> [长度]` | 指定模式开局 |
|
|
19
|
+
| `wordle.猜 <内容>` | 提交猜测 |
|
|
20
20
|
|
|
21
21
|
模式:`经典`、`汉兜`、`词影`、`Numberle`、`Math`、`Lewdle` 及多种词库。
|
|
22
22
|
|
package/lib/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "koishi";
|
|
2
|
-
export declare const usage = "## \u4F7F\u7528\n\n`
|
|
2
|
+
export declare const usage = "## \u4F7F\u7528\n\n`wordle.\u5F00\u59CB` \u5F00\u5C40\uFF0C\u7136\u540E\u76F4\u63A5\u8F93\u5165\u731C\u6D4B\u8BCD\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `wordle.\u5F00\u59CB [\u957F\u5EA6]` | \u5F00\u59CB\u5F15\u5BFC |\n| `wordle.\u5F00\u59CB.<\u6A21\u5F0F> [\u957F\u5EA6]` | \u6307\u5B9A\u6A21\u5F0F\u5F00\u5C40 |\n| `wordle.\u731C <\u5185\u5BB9>` | \u63D0\u4EA4\u731C\u6D4B |\n\n\u6A21\u5F0F\uFF1A`\u7ECF\u5178`\u3001`\u6C49\u515C`\u3001`\u8BCD\u5F71`\u3001`Numberle`\u3001`Math`\u3001`Lewdle` \u53CA\u591A\u79CD\u8BCD\u5E93\u3002\n\n\u9009\u9879\uFF1A`--hard`\u3001`--uhard`\u3001`--absurd`\u3001`--challenge`\u3001`--wordles`\u3001`--free`\u3001`--all`\u3002";
|
|
3
3
|
export interface Config {
|
|
4
4
|
isDarkThemeEnabled: boolean;
|
|
5
5
|
isHighContrastThemeEnabled: boolean;
|
|
@@ -19,7 +19,6 @@ export interface Config {
|
|
|
19
19
|
wordGuessTimeLimitInSeconds: number;
|
|
20
20
|
retractDelay: number;
|
|
21
21
|
imageType: "png" | "jpeg" | "webp";
|
|
22
|
-
isTextToImageConversionEnabled: boolean;
|
|
23
22
|
pinyinApiEndpoint: string;
|
|
24
23
|
pinyinApiKey: string;
|
|
25
24
|
pinyinApiModel: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { Config, usage };
|
|
|
4
4
|
export type { ExtraCiyingRankInfo, ExtraGameRecord, GameRecord, GamingPlayer, LetterState, PlayerRecord, PlayerStats, WinLoseStats, WordData, WordEntry, } from "./types";
|
|
5
5
|
export declare const inject: {
|
|
6
6
|
required: string[];
|
|
7
|
-
optional: string[];
|
|
8
7
|
};
|
|
9
8
|
export declare const name = "wordle-game";
|
|
10
9
|
export declare function apply(ctx: Context, config: Config): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -289,10 +289,10 @@ var require_vendor = __commonJS({
|
|
|
289
289
|
`;
|
|
290
290
|
}
|
|
291
291
|
const g = f + `100% {${u(n, 1 - n)}}
|
|
292
|
-
}`,
|
|
293
|
-
r[
|
|
292
|
+
}`, h4 = `__svelte_${pt(g)}_${d}`, i = Je(e), { stylesheet: a, rules: r } = ce.get(i) || mt(i, e);
|
|
293
|
+
r[h4] || (r[h4] = true, a.insertRule(`@keyframes ${h4} ${g}`, a.cssRules.length));
|
|
294
294
|
const s = e.style.animation || "";
|
|
295
|
-
return e.style.animation = `${s ? `${s}, ` : ""}${
|
|
295
|
+
return e.style.animation = `${s ? `${s}, ` : ""}${h4} ${o}ms linear ${l2}ms 1 both`, le += 1, h4;
|
|
296
296
|
}
|
|
297
297
|
__name(ue, "ue");
|
|
298
298
|
function fe(e, t) {
|
|
@@ -452,9 +452,9 @@ var require_vendor = __commonJS({
|
|
|
452
452
|
}
|
|
453
453
|
__name(w, "w");
|
|
454
454
|
function f() {
|
|
455
|
-
const { delay:
|
|
456
|
-
s && (b = ue(e, 0, 1, i,
|
|
457
|
-
const c = Se() +
|
|
455
|
+
const { delay: h4 = 0, duration: i = 300, easing: a = be, tick: r = R, css: s } = o || Ce;
|
|
456
|
+
s && (b = ue(e, 0, 1, i, h4, a, s, d++)), r(0, 1);
|
|
457
|
+
const c = Se() + h4, E = c + i;
|
|
458
458
|
u && u.abort(), l2 = true, V(() => B(e, true, "start")), u = Te(
|
|
459
459
|
(A) => {
|
|
460
460
|
if (l2) {
|
|
@@ -489,17 +489,17 @@ var require_vendor = __commonJS({
|
|
|
489
489
|
const u = q;
|
|
490
490
|
u.r += 1;
|
|
491
491
|
function d() {
|
|
492
|
-
const { delay: w = 0, duration: f = 300, easing: g = be, tick:
|
|
492
|
+
const { delay: w = 0, duration: f = 300, easing: g = be, tick: h4 = R, css: i } = o || Ce;
|
|
493
493
|
i && (b = ue(e, 1, 0, f, w, g, i));
|
|
494
494
|
const a = Se() + w, r = a + f;
|
|
495
495
|
V(() => B(e, false, "start")), Te(
|
|
496
496
|
(s) => {
|
|
497
497
|
if (l2) {
|
|
498
498
|
if (s >= r)
|
|
499
|
-
return
|
|
499
|
+
return h4(0, 1), B(e, false, "end"), --u.r || j(u.c), false;
|
|
500
500
|
if (s >= a) {
|
|
501
501
|
const c = g((s - a) / f);
|
|
502
|
-
|
|
502
|
+
h4(1 - c, c);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
return l2;
|
|
@@ -537,7 +537,7 @@ var require_vendor = __commonJS({
|
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
539
|
__name(g, "g");
|
|
540
|
-
function
|
|
540
|
+
function h4(i) {
|
|
541
541
|
const { delay: a = 0, duration: r = 300, easing: s = be, tick: c = R, css: E } = l2 || Ce, A = {
|
|
542
542
|
start: Se() + a,
|
|
543
543
|
b: i
|
|
@@ -556,14 +556,14 @@ var require_vendor = __commonJS({
|
|
|
556
556
|
}
|
|
557
557
|
));
|
|
558
558
|
}
|
|
559
|
-
__name(
|
|
559
|
+
__name(h4, "h");
|
|
560
560
|
return {
|
|
561
561
|
run(i) {
|
|
562
562
|
F(l2) ? Re().then(
|
|
563
563
|
() => {
|
|
564
|
-
l2 = l2(),
|
|
564
|
+
l2 = l2(), h4(i);
|
|
565
565
|
}
|
|
566
|
-
) :
|
|
566
|
+
) : h4(i);
|
|
567
567
|
},
|
|
568
568
|
end() {
|
|
569
569
|
f(), u = d = null;
|
|
@@ -582,13 +582,13 @@ var require_vendor = __commonJS({
|
|
|
582
582
|
const f = l2 && (t.current = l2)(w);
|
|
583
583
|
let g = false;
|
|
584
584
|
t.block && (t.blocks ? t.blocks.forEach(
|
|
585
|
-
(
|
|
586
|
-
i !== b &&
|
|
587
|
-
|
|
585
|
+
(h4, i) => {
|
|
586
|
+
i !== b && h4 && (kt(), tt(
|
|
587
|
+
h4,
|
|
588
588
|
1,
|
|
589
589
|
1,
|
|
590
590
|
() => {
|
|
591
|
-
t.blocks[i] ===
|
|
591
|
+
t.blocks[i] === h4 && (t.blocks[i] = null);
|
|
592
592
|
}
|
|
593
593
|
), xt());
|
|
594
594
|
}
|
|
@@ -630,14 +630,14 @@ var require_vendor = __commonJS({
|
|
|
630
630
|
);
|
|
631
631
|
}
|
|
632
632
|
__name(si, "si");
|
|
633
|
-
function ai(e, t, n, o, l2, b, u, d, w, f, g,
|
|
633
|
+
function ai(e, t, n, o, l2, b, u, d, w, f, g, h4) {
|
|
634
634
|
let i = e.length, a = b.length, r = i;
|
|
635
635
|
const s = {};
|
|
636
636
|
for (; r--; )
|
|
637
637
|
s[e[r].key] = r;
|
|
638
638
|
const c = [], E = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
|
|
639
639
|
for (r = a; r--; ) {
|
|
640
|
-
const k =
|
|
640
|
+
const k = h4(l2, b, r), M = n(k);
|
|
641
641
|
let N = u.get(M);
|
|
642
642
|
N ? o && N.p(k, t) : (N = f(M, k), N.c()), E.set(M, c[r] = N), M in s && A.set(M, Math.abs(r - s[M]));
|
|
643
643
|
}
|
|
@@ -714,14 +714,14 @@ var require_vendor = __commonJS({
|
|
|
714
714
|
if (f.ctx = n ? n(
|
|
715
715
|
e,
|
|
716
716
|
t.props || {},
|
|
717
|
-
(
|
|
717
|
+
(h4, i, ...a) => {
|
|
718
718
|
const r = a.length ? a[0] : i;
|
|
719
|
-
return f.ctx && l2(f.ctx[
|
|
719
|
+
return f.ctx && l2(f.ctx[h4], f.ctx[h4] = r) && (!f.skip_bound && f.bound[h4] && f.bound[h4](r), g && St(e, h4)), i;
|
|
720
720
|
}
|
|
721
721
|
) : [], f.update(), g = true, j(f.before_update), f.fragment = o ? o(f.ctx) : false, t.target) {
|
|
722
722
|
if (t.hydrate) {
|
|
723
|
-
const
|
|
724
|
-
f.fragment && f.fragment.l(
|
|
723
|
+
const h4 = ht(t.target);
|
|
724
|
+
f.fragment && f.fragment.l(h4), h4.forEach(dt);
|
|
725
725
|
} else
|
|
726
726
|
f.fragment && f.fragment.c();
|
|
727
727
|
t.intro && $e(e.$$.fragment), Et(e, t.target, t.anchor, t.customElement), Ne();
|
|
@@ -782,8 +782,8 @@ var require_vendor = __commonJS({
|
|
|
782
782
|
delay: t,
|
|
783
783
|
duration: n,
|
|
784
784
|
easing: o,
|
|
785
|
-
css: /* @__PURE__ */ __name((
|
|
786
|
-
transform: ${f} translate(${(1 -
|
|
785
|
+
css: /* @__PURE__ */ __name((h4, i) => `
|
|
786
|
+
transform: ${f} translate(${(1 - h4) * l2}px, ${(1 - h4) * b}px);
|
|
787
787
|
opacity: ${w - g * i}`, "css")
|
|
788
788
|
};
|
|
789
789
|
}
|
|
@@ -792,10 +792,10 @@ var require_vendor = __commonJS({
|
|
|
792
792
|
var { fallback: t } = e, n = At(e, ["fallback"]);
|
|
793
793
|
const o = /* @__PURE__ */ new Map(), l2 = /* @__PURE__ */ new Map();
|
|
794
794
|
function b(d, w, f) {
|
|
795
|
-
const { delay: g = 0, duration:
|
|
795
|
+
const { delay: g = 0, duration: h4 = /* @__PURE__ */ __name((k) => Math.sqrt(k) * 30, "h"), easing: i = it } = ke(ke({}, n), f), a = w.getBoundingClientRect(), r = d.left - a.left, s = d.top - a.top, c = d.width / a.width, E = d.height / a.height, A = Math.sqrt(r * r + s * s), p = getComputedStyle(w), m = p.transform === "none" ? "" : p.transform, T = +p.opacity;
|
|
796
796
|
return {
|
|
797
797
|
delay: g,
|
|
798
|
-
duration: F(
|
|
798
|
+
duration: F(h4) ? h4(A) : h4,
|
|
799
799
|
easing: i,
|
|
800
800
|
css: /* @__PURE__ */ __name((k, M) => `
|
|
801
801
|
opacity: ${k * T};
|
|
@@ -806,14 +806,14 @@ var require_vendor = __commonJS({
|
|
|
806
806
|
}
|
|
807
807
|
__name(b, "b");
|
|
808
808
|
function u(d, w, f) {
|
|
809
|
-
return (g,
|
|
809
|
+
return (g, h4) => (d.set(h4.key, {
|
|
810
810
|
rect: g.getBoundingClientRect()
|
|
811
811
|
}), () => {
|
|
812
|
-
if (w.has(
|
|
813
|
-
const { rect: i } = w.get(
|
|
814
|
-
return w.delete(
|
|
812
|
+
if (w.has(h4.key)) {
|
|
813
|
+
const { rect: i } = w.get(h4.key);
|
|
814
|
+
return w.delete(h4.key), b(i, g, h4);
|
|
815
815
|
}
|
|
816
|
-
return d.delete(
|
|
816
|
+
return d.delete(h4.key), t && t(g, h4, f);
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
__name(u, "u");
|
|
@@ -869,7 +869,7 @@ var require_vendor = __commonJS({
|
|
|
869
869
|
let d = false;
|
|
870
870
|
const w = [];
|
|
871
871
|
let f = 0, g = R;
|
|
872
|
-
const
|
|
872
|
+
const h4 = /* @__PURE__ */ __name(() => {
|
|
873
873
|
if (f)
|
|
874
874
|
return;
|
|
875
875
|
g();
|
|
@@ -878,13 +878,13 @@ var require_vendor = __commonJS({
|
|
|
878
878
|
}, "h"), i = l2.map((a, r) => Oe2(
|
|
879
879
|
a,
|
|
880
880
|
(s) => {
|
|
881
|
-
w[r] = s, f &= ~(1 << r), d &&
|
|
881
|
+
w[r] = s, f &= ~(1 << r), d && h4();
|
|
882
882
|
},
|
|
883
883
|
() => {
|
|
884
884
|
f |= 1 << r;
|
|
885
885
|
}
|
|
886
886
|
));
|
|
887
|
-
return d = true,
|
|
887
|
+
return d = true, h4(), function() {
|
|
888
888
|
j(i), g();
|
|
889
889
|
};
|
|
890
890
|
}
|
|
@@ -896,7 +896,7 @@ var require_vendor = __commonJS({
|
|
|
896
896
|
};
|
|
897
897
|
(function(e, t) {
|
|
898
898
|
(function(n, o) {
|
|
899
|
-
var l2 = "1.0.2", b = "", u = "?", d = "function", w = "undefined", f = "object", g = "string",
|
|
899
|
+
var l2 = "1.0.2", b = "", u = "?", d = "function", w = "undefined", f = "object", g = "string", h4 = "major", i = "model", a = "name", r = "type", s = "vendor", c = "version", E = "architecture", A = "console", p = "mobile", m = "tablet", T = "smarttv", k = "wearable", M = "embedded", N = 255, P = "Amazon", de = "Apple", qe = "ASUS", ze = "BlackBerry", U = "Browser", K = "Chrome", nt = "Edge", J = "Firefox", Q = "Google", Pe = "Huawei", we = "LG", he2 = "Microsoft", je = "Motorola", ee = "Opera", pe = "Samsung", me = "Sony", Be = "Xiaomi", ge = "Zebra", Ue = "Facebook", rt = /* @__PURE__ */ __name(function(_, x) {
|
|
900
900
|
var y = {};
|
|
901
901
|
for (var S in _)
|
|
902
902
|
x[S] && x[S].length % 2 === 0 ? y[S] = x[S].concat(_[S]) : y[S] = _[S];
|
|
@@ -993,7 +993,7 @@ var require_vendor = __commonJS({
|
|
|
993
993
|
return y = typeof v === g && v.length > N ? _e(v, N) : v, this;
|
|
994
994
|
}, this.setUA(y), this;
|
|
995
995
|
}, "$");
|
|
996
|
-
$.VERSION = l2, $.BROWSER = te([a, c,
|
|
996
|
+
$.VERSION = l2, $.BROWSER = te([a, c, h4]), $.CPU = te([E]), $.DEVICE = te([i, s, r, A, p, T, m, k, M]), $.ENGINE = $.OS = te([a, c]), e.exports && (t = e.exports = $), t.UAParser = $;
|
|
997
997
|
var L = typeof n !== w && (n.jQuery || n.Zepto);
|
|
998
998
|
if (L && !L.ua) {
|
|
999
999
|
var ie = new $();
|
|
@@ -1078,7 +1078,7 @@ var require_main = __commonJS({
|
|
|
1078
1078
|
s: re,
|
|
1079
1079
|
e: _,
|
|
1080
1080
|
a: R,
|
|
1081
|
-
b:
|
|
1081
|
+
b: h4,
|
|
1082
1082
|
c: g,
|
|
1083
1083
|
d: m,
|
|
1084
1084
|
l: J,
|
|
@@ -1339,15 +1339,15 @@ var path3 = __toESM(require("path"));
|
|
|
1339
1339
|
var import_koishi = require("koishi");
|
|
1340
1340
|
var usage = `## 使用
|
|
1341
1341
|
|
|
1342
|
-
\`
|
|
1342
|
+
\`wordle.开始\` 开局,然后直接输入猜测词。
|
|
1343
1343
|
|
|
1344
1344
|
## 指令
|
|
1345
1345
|
|
|
1346
1346
|
| 指令 | 说明 |
|
|
1347
1347
|
| --- | --- |
|
|
1348
|
-
| \`
|
|
1349
|
-
| \`
|
|
1350
|
-
| \`
|
|
1348
|
+
| \`wordle.开始 [长度]\` | 开始引导 |
|
|
1349
|
+
| \`wordle.开始.<模式> [长度]\` | 指定模式开局 |
|
|
1350
|
+
| \`wordle.猜 <内容>\` | 提交猜测 |
|
|
1351
1351
|
|
|
1352
1352
|
模式:\`经典\`、\`汉兜\`、\`词影\`、\`Numberle\`、\`Math\`、\`Lewdle\` 及多种词库。
|
|
1353
1353
|
|
|
@@ -1394,10 +1394,7 @@ var Config = import_koishi.Schema.intersect([
|
|
|
1394
1394
|
retractDelay: import_koishi.Schema.number().min(0).default(0).description(
|
|
1395
1395
|
`撤回上一条消息的等待时间,单位是秒。值为 0 时不启用自动撤回功能。`
|
|
1396
1396
|
),
|
|
1397
|
-
imageType: import_koishi.Schema.union(["png", "jpeg", "webp"]).default("png").description(`发送的图片类型。`)
|
|
1398
|
-
isTextToImageConversionEnabled: import_koishi.Schema.boolean().default(false).description(
|
|
1399
|
-
`是否开启将文本转为图片的功能(可选),如需启用,需要启用 \`markdownToImage\` 服务。`
|
|
1400
|
-
)
|
|
1397
|
+
imageType: import_koishi.Schema.union(["png", "jpeg", "webp"]).default("png").description(`发送的图片类型。`)
|
|
1401
1398
|
})
|
|
1402
1399
|
])
|
|
1403
1400
|
]);
|
|
@@ -1655,7 +1652,7 @@ async function updateDataInTargetFile(logger, newFilePath, targetFilePath, missi
|
|
|
1655
1652
|
__name(updateDataInTargetFile, "updateDataInTargetFile");
|
|
1656
1653
|
|
|
1657
1654
|
// src/commands/basic.ts
|
|
1658
|
-
var
|
|
1655
|
+
var import_koishi2 = require("koishi");
|
|
1659
1656
|
|
|
1660
1657
|
// src/utils/string.ts
|
|
1661
1658
|
function removeDuplicates(inputString) {
|
|
@@ -2037,36 +2034,10 @@ ${replaceEscapeCharacters(
|
|
|
2037
2034
|
__name(processExtraGameRecords, "processExtraGameRecords");
|
|
2038
2035
|
|
|
2039
2036
|
// src/services/message.ts
|
|
2040
|
-
var import_koishi2 = require("koishi");
|
|
2041
2037
|
async function sendMessage(g, session, message) {
|
|
2042
2038
|
const config = g.config;
|
|
2043
2039
|
const { bot, channelId } = session;
|
|
2044
|
-
|
|
2045
|
-
if (config.isTextToImageConversionEnabled) {
|
|
2046
|
-
const lines = message.toString().split("\n");
|
|
2047
|
-
const isOnlyImgTag = lines.length === 1 && lines[0].trim().startsWith("<img");
|
|
2048
|
-
if (isOnlyImgTag) {
|
|
2049
|
-
[messageId] = await session.send(message);
|
|
2050
|
-
} else {
|
|
2051
|
-
const modifiedMessage = lines.map((line) => {
|
|
2052
|
-
if (line.trim() !== "" && !line.includes("<img")) {
|
|
2053
|
-
return `# ${line}`;
|
|
2054
|
-
} else {
|
|
2055
|
-
return line + "\n";
|
|
2056
|
-
}
|
|
2057
|
-
}).join("\n");
|
|
2058
|
-
g.ctx.inject(["markdownToImage"], async (ctx) => {
|
|
2059
|
-
const imageBuffer = await ctx.markdownToImage.convertToImage(
|
|
2060
|
-
modifiedMessage
|
|
2061
|
-
);
|
|
2062
|
-
[messageId] = await session.send(
|
|
2063
|
-
import_koishi2.h.image(imageBuffer, `image/${config.imageType}`)
|
|
2064
|
-
);
|
|
2065
|
-
});
|
|
2066
|
-
}
|
|
2067
|
-
} else {
|
|
2068
|
-
[messageId] = await session.send(message);
|
|
2069
|
-
}
|
|
2040
|
+
const [messageId] = await session.send(message);
|
|
2070
2041
|
if (config.retractDelay > 0 && messageId) {
|
|
2071
2042
|
const prevMessage = g.lastMessageInfo.get(channelId);
|
|
2072
2043
|
if (prevMessage) {
|
|
@@ -2123,20 +2094,20 @@ __name(getSessionUserName, "getSessionUserName");
|
|
|
2123
2094
|
// src/commands/basic.ts
|
|
2124
2095
|
function register(g) {
|
|
2125
2096
|
const { ctx, config } = g;
|
|
2126
|
-
ctx.command("
|
|
2097
|
+
ctx.command("wordle", "猜单词游戏帮助").alias("wordleGame").action(async ({ session }) => {
|
|
2127
2098
|
let { userId, username } = session;
|
|
2128
2099
|
username = await getSessionUserName(g, session);
|
|
2129
2100
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
2130
|
-
await session.execute(`
|
|
2101
|
+
await session.execute(`wordle -h`);
|
|
2131
2102
|
});
|
|
2132
|
-
ctx.command("
|
|
2103
|
+
ctx.command("wordle.玩法介绍", "游戏玩法介绍").action(async ({ session }) => {
|
|
2133
2104
|
let { userId, username } = session;
|
|
2134
2105
|
username = await getSessionUserName(g, session);
|
|
2135
2106
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
2136
2107
|
return sendMessage(
|
|
2137
2108
|
g,
|
|
2138
2109
|
session,
|
|
2139
|
-
|
|
2110
|
+
import_koishi2.h.image(g.data.introductionImgBuffer, `image/${config.imageType}`)
|
|
2140
2111
|
);
|
|
2141
2112
|
});
|
|
2142
2113
|
}
|
|
@@ -2144,7 +2115,7 @@ __name(register, "register");
|
|
|
2144
2115
|
|
|
2145
2116
|
// src/commands/game.ts
|
|
2146
2117
|
var fs4 = __toESM(require("fs"));
|
|
2147
|
-
var
|
|
2118
|
+
var import_koishi3 = require("koishi");
|
|
2148
2119
|
|
|
2149
2120
|
// src/assets/Wordle/词汇/badWordsList.json
|
|
2150
2121
|
var badWordsList_default = [
|
|
@@ -15156,7 +15127,7 @@ function register2(g) {
|
|
|
15156
15127
|
return await next();
|
|
15157
15128
|
}
|
|
15158
15129
|
if (content) {
|
|
15159
|
-
content = `${
|
|
15130
|
+
content = `${import_koishi3.h.select(content, "text")}`.trim();
|
|
15160
15131
|
}
|
|
15161
15132
|
const gameInfo = await getGameInfo(g, channelId);
|
|
15162
15133
|
if (!gameInfo.isStarted) {
|
|
@@ -15182,10 +15153,10 @@ function register2(g) {
|
|
|
15182
15153
|
if (content.length !== gameInfo.guessWordLength) {
|
|
15183
15154
|
return await next();
|
|
15184
15155
|
}
|
|
15185
|
-
await session.execute(`
|
|
15156
|
+
await session.execute(`wordle.猜 ${content}`);
|
|
15186
15157
|
return;
|
|
15187
15158
|
});
|
|
15188
|
-
ctx.command("
|
|
15159
|
+
ctx.command("wordle.加入 [money:number]", "加入游戏").action(async ({ session }, money = 0) => {
|
|
15189
15160
|
let { channelId, userId, username, user } = session;
|
|
15190
15161
|
username = await getSessionUserName(g, session);
|
|
15191
15162
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -15239,7 +15210,7 @@ ${emptyGridHtml}`
|
|
|
15239
15210
|
g,
|
|
15240
15211
|
session,
|
|
15241
15212
|
`⚠️ 你已经在游戏中。
|
|
15242
|
-
${
|
|
15213
|
+
${import_koishi3.h.image(
|
|
15243
15214
|
imageBuffer,
|
|
15244
15215
|
`image/${config.imageType}`
|
|
15245
15216
|
)}`
|
|
@@ -15346,7 +15317,7 @@ ${import_koishi4.h.image(
|
|
|
15346
15317
|
}
|
|
15347
15318
|
}
|
|
15348
15319
|
});
|
|
15349
|
-
ctx.command("
|
|
15320
|
+
ctx.command("wordle.退出", "退出游戏").action(async ({ session }) => {
|
|
15350
15321
|
let { channelId, userId, username } = session;
|
|
15351
15322
|
username = await getSessionUserName(g, session);
|
|
15352
15323
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -15377,7 +15348,7 @@ ${import_koishi4.h.image(
|
|
|
15377
15348
|
`✅ 已退出。剩余玩家:${numberOfPlayers} 人。`
|
|
15378
15349
|
);
|
|
15379
15350
|
});
|
|
15380
|
-
ctx.command("
|
|
15351
|
+
ctx.command("wordle.结束", "结束游戏").action(async ({ session }) => {
|
|
15381
15352
|
let { channelId, userId, username, timestamp } = session;
|
|
15382
15353
|
username = await getSessionUserName(g, session);
|
|
15383
15354
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -15408,7 +15379,7 @@ ${generateGameEndMessage(gameInfo)}`}${processedResult}`;
|
|
|
15408
15379
|
await endGame(g, channelId);
|
|
15409
15380
|
return;
|
|
15410
15381
|
});
|
|
15411
|
-
ctx.command("
|
|
15382
|
+
ctx.command("wordle.开始 [guessWordLength:number]", "开始游戏引导").option("hard", "--hard 困难模式", { fallback: false }).option("ultraHardMode", "--uhard 超困难模式", { fallback: false }).option("absurd", "--absurd 变态模式", { fallback: false }).option("challenge", "--challenge 变态挑战模式", { fallback: false }).option("wordles", "--wordles <value:number> 同时猜测多个单词", {
|
|
15412
15383
|
fallback: 1
|
|
15413
15384
|
}).action(async ({ session, options }, guessWordLength) => {
|
|
15414
15385
|
let { channelId, userId, username } = session;
|
|
@@ -15473,7 +15444,7 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
15473
15444
|
const absurdOption = options.absurd ? ` --absurd` : "";
|
|
15474
15445
|
const challengeOption = options.challenge ? ` --challenge` : "";
|
|
15475
15446
|
const wordlesOption = options.wordles > 1 ? `--wordles ${options.wordles}` : "";
|
|
15476
|
-
const command = `
|
|
15447
|
+
const command = `wordle.开始.${selectedExam}${hardOption}${uhardOption}${absurdOption}${challengeOption}${wordlesOption} ${guessWordLength}`;
|
|
15477
15448
|
return await session.execute(command);
|
|
15478
15449
|
} else {
|
|
15479
15450
|
return await sendMessage(
|
|
@@ -15483,7 +15454,7 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
15483
15454
|
);
|
|
15484
15455
|
}
|
|
15485
15456
|
});
|
|
15486
|
-
ctx.command("
|
|
15457
|
+
ctx.command("wordle.开始.经典", "开始经典猜单词游戏").option("hard", "--hard 困难模式", { fallback: false }).option("ultraHardMode", "--uhard 超困难模式", { fallback: false }).option("absurd", "--absurd 变态模式", { fallback: false }).option("challenge", "--challenge 变态挑战模式", { fallback: false }).option("wordles", "--wordles <value:number> 同时猜测多个单词", {
|
|
15487
15458
|
fallback: 1
|
|
15488
15459
|
}).action(async ({ session, options }) => {
|
|
15489
15460
|
let { channelId, userId, username, platform, timestamp } = session;
|
|
@@ -15607,7 +15578,7 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
15607
15578
|
const wordCount = "待猜单词数量为:【2315】";
|
|
15608
15579
|
const timeLimit = config.enableWordGuessTimeLimit ? `
|
|
15609
15580
|
作答时间为:【${config.wordGuessTimeLimitInSeconds}】秒` : "";
|
|
15610
|
-
const image =
|
|
15581
|
+
const image = import_koishi3.h.image(imageBuffer, `image/${config.imageType}`);
|
|
15611
15582
|
const message = `游戏开始!
|
|
15612
15583
|
当前游戏模式为:${gameMode}${isChallengeMode ? targetWord : ""}
|
|
15613
15584
|
${wordLength}
|
|
@@ -15621,7 +15592,7 @@ ${image}`;
|
|
|
15621
15592
|
return;
|
|
15622
15593
|
}
|
|
15623
15594
|
ctx.command(
|
|
15624
|
-
`
|
|
15595
|
+
`wordle.开始.${exam} [guessWordLength:number]`,
|
|
15625
15596
|
`开始猜${exam}单词游戏`
|
|
15626
15597
|
).option("free", "--free 自由模式(仅限汉兜与词影)", {
|
|
15627
15598
|
fallback: false
|
|
@@ -15879,7 +15850,7 @@ ${exam} 长度可选值范围:${getValidGuessWordLengthRange(
|
|
|
15879
15850
|
const wordCount2 = exam === "汉兜" || exam === "词影" ? `待猜词语|成语数量为:【${options.all ? idiomsList.length : commonIdiomsList_default.length}】` : exam === "Math" ? `待猜方程式数量为:【${equations[guessWordLength].length}】` : `待猜单词数量为:【${exam === "Lewdle" ? "1000" : wordCount}】`;
|
|
15880
15851
|
const timeLimit = config.enableWordGuessTimeLimit ? `
|
|
15881
15852
|
作答时间为:【${config.wordGuessTimeLimitInSeconds}】秒` : "";
|
|
15882
|
-
const image =
|
|
15853
|
+
const image = import_koishi3.h.image(imageBuffer, `image/${config.imageType}`);
|
|
15883
15854
|
if (exam === "汉兜" || exam === "词影") {
|
|
15884
15855
|
return await sendMessage(
|
|
15885
15856
|
g,
|
|
@@ -15902,7 +15873,7 @@ ${image}`
|
|
|
15902
15873
|
}
|
|
15903
15874
|
});
|
|
15904
15875
|
});
|
|
15905
|
-
ctx.command("
|
|
15876
|
+
ctx.command("wordle.猜 [inputWord:text]", "做出一次猜测").option("random", "-r 随机", { fallback: false }).action(async ({ session, options }, inputWord) => {
|
|
15906
15877
|
let { channelId, userId, username, platform, timestamp } = session;
|
|
15907
15878
|
let gameInfo = await getGameInfo(g, channelId);
|
|
15908
15879
|
inputWord = inputWord?.trim();
|
|
@@ -16271,7 +16242,7 @@ ${progressMessage}`
|
|
|
16271
16242
|
session,
|
|
16272
16243
|
`目标单词为:【${targetWord}】
|
|
16273
16244
|
它不再是可能的秘密单词!
|
|
16274
|
-
${
|
|
16245
|
+
${import_koishi3.h.image(
|
|
16275
16246
|
imageBuffer2,
|
|
16276
16247
|
`image/${config.imageType}`
|
|
16277
16248
|
)}
|
|
@@ -16295,14 +16266,14 @@ ${emptyGridHtml}`
|
|
|
16295
16266
|
session,
|
|
16296
16267
|
`⚠️ 输入无效或超时。
|
|
16297
16268
|
已自动选择【撤销】操作。
|
|
16298
|
-
${
|
|
16269
|
+
${import_koishi3.h.image(
|
|
16299
16270
|
imageBuffer22,
|
|
16300
16271
|
`image/${config.imageType}`
|
|
16301
16272
|
)}`
|
|
16302
16273
|
);
|
|
16303
16274
|
}
|
|
16304
16275
|
if (userInput === "结束") {
|
|
16305
|
-
await session.execute(`
|
|
16276
|
+
await session.execute(`wordle.结束`);
|
|
16306
16277
|
return;
|
|
16307
16278
|
} else {
|
|
16308
16279
|
await setGuessRunningStatus(g, channelId, false);
|
|
@@ -16310,7 +16281,7 @@ ${import_koishi4.h.image(
|
|
|
16310
16281
|
g,
|
|
16311
16282
|
session,
|
|
16312
16283
|
`✅ 已撤销,挑战继续。
|
|
16313
|
-
${
|
|
16284
|
+
${import_koishi3.h.image(
|
|
16314
16285
|
imageBuffer22,
|
|
16315
16286
|
`image/${config.imageType}`
|
|
16316
16287
|
)}`
|
|
@@ -16534,7 +16505,7 @@ ${finalSettlementString}`;
|
|
|
16534
16505
|
const message = `
|
|
16535
16506
|
太棒了,你猜出来了!
|
|
16536
16507
|
${gameDuration}
|
|
16537
|
-
${
|
|
16508
|
+
${import_koishi3.h.image(imageBuffer, `image/${imageType}`)}
|
|
16538
16509
|
${generateGameEndMessage(gameInfo)}${processedResult}
|
|
16539
16510
|
${settlementResult}
|
|
16540
16511
|
`;
|
|
@@ -16559,7 +16530,7 @@ ${generateGameEndMessage(gameInfo)}`;
|
|
|
16559
16530
|
timestamp
|
|
16560
16531
|
);
|
|
16561
16532
|
const message = `本局未猜出。${challengeMessage}
|
|
16562
|
-
${
|
|
16533
|
+
${import_koishi3.h.image(
|
|
16563
16534
|
imageBuffer,
|
|
16564
16535
|
`image/${config.imageType}`
|
|
16565
16536
|
)}
|
|
@@ -16576,7 +16547,7 @@ ${gameDuration}${answerInfo}${processedResult}`;
|
|
|
16576
16547
|
await sendMessage(
|
|
16577
16548
|
g,
|
|
16578
16549
|
session,
|
|
16579
|
-
|
|
16550
|
+
import_koishi3.h.image(imageBuffer, `image/${config.imageType}`)
|
|
16580
16551
|
);
|
|
16581
16552
|
return;
|
|
16582
16553
|
});
|
|
@@ -16586,7 +16557,7 @@ __name(register2, "register");
|
|
|
16586
16557
|
// src/commands/lookup.ts
|
|
16587
16558
|
function register3(g) {
|
|
16588
16559
|
const { ctx } = g;
|
|
16589
|
-
ctx.command("
|
|
16560
|
+
ctx.command("wordle.查单词 [targetWord:text]", "查单词引导").action(async ({ session, options }, targetWord) => {
|
|
16590
16561
|
if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
|
|
16591
16562
|
if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
|
|
16592
16563
|
targetWord = session.event.message.quote.content.trim();
|
|
@@ -16615,7 +16586,7 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
16615
16586
|
);
|
|
16616
16587
|
const selectedDictionary = isNaN(parseInt(userInput)) ? userInput.toLowerCase().trim() : availableDictionaryArrayToLowerCase[parseInt(userInput) - 1];
|
|
16617
16588
|
if (availableDictionaryArrayToLowerCase.includes(selectedDictionary)) {
|
|
16618
|
-
const command = `
|
|
16589
|
+
const command = `wordle.查单词.${selectedDictionary}${targetWord ? ` ${targetWord}` : ""}`;
|
|
16619
16590
|
return await session.execute(command);
|
|
16620
16591
|
} else {
|
|
16621
16592
|
return await sendMessage(
|
|
@@ -16626,7 +16597,7 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
16626
16597
|
}
|
|
16627
16598
|
});
|
|
16628
16599
|
ctx.command(
|
|
16629
|
-
"
|
|
16600
|
+
"wordle.查单词.ALL [targetWord:text]",
|
|
16630
16601
|
"在ALL词库中查询单词释义(英译中)"
|
|
16631
16602
|
).action(async ({ session }, targetWord) => {
|
|
16632
16603
|
if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
|
|
@@ -16685,7 +16656,7 @@ ${replaceEscapeCharacters(
|
|
|
16685
16656
|
);
|
|
16686
16657
|
});
|
|
16687
16658
|
ctx.command(
|
|
16688
|
-
"
|
|
16659
|
+
"wordle.查单词.WordWord [targetWord:text]",
|
|
16689
16660
|
"在WordWord中查找单词定义(英译英)"
|
|
16690
16661
|
).action(async ({ session }, targetWord) => {
|
|
16691
16662
|
if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
|
|
@@ -16742,7 +16713,7 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
|
|
|
16742
16713
|
);
|
|
16743
16714
|
});
|
|
16744
16715
|
});
|
|
16745
|
-
ctx.command("
|
|
16716
|
+
ctx.command("wordle.查成语 [targetIdiom:text]", "查成语引导").action(async ({ session, options }, targetIdiom) => {
|
|
16746
16717
|
if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
|
|
16747
16718
|
if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
|
|
16748
16719
|
targetIdiom = session.event.message.quote.content.trim();
|
|
@@ -16768,7 +16739,7 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
16768
16739
|
);
|
|
16769
16740
|
const selectedDictionary = isNaN(parseInt(userInput)) ? userInput.trim() : availableDictionaryArray[parseInt(userInput) - 1];
|
|
16770
16741
|
if (availableDictionaryArray.includes(selectedDictionary)) {
|
|
16771
|
-
const command = `
|
|
16742
|
+
const command = `wordle.查成语.${selectedDictionary}${targetIdiom ? ` ${targetIdiom}` : ""}`;
|
|
16772
16743
|
return await session.execute(command);
|
|
16773
16744
|
} else {
|
|
16774
16745
|
return await sendMessage(
|
|
@@ -16779,7 +16750,7 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
16779
16750
|
}
|
|
16780
16751
|
});
|
|
16781
16752
|
ctx.command(
|
|
16782
|
-
"
|
|
16753
|
+
"wordle.查成语.百度汉语 [targetIdiom:text]",
|
|
16783
16754
|
"在百度汉语中查找成语解释"
|
|
16784
16755
|
).action(async ({ session }, targetIdiom) => {
|
|
16785
16756
|
if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
|
|
@@ -16836,7 +16807,7 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
16836
16807
|
);
|
|
16837
16808
|
});
|
|
16838
16809
|
ctx.command(
|
|
16839
|
-
"
|
|
16810
|
+
"wordle.查成语.汉典 [targetIdiom:text]",
|
|
16840
16811
|
"在汉典中查找成语解释"
|
|
16841
16812
|
).action(async ({ session }, targetIdiom) => {
|
|
16842
16813
|
if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
|
|
@@ -16893,7 +16864,7 @@ ${idiomInfo.explanation}`
|
|
|
16893
16864
|
);
|
|
16894
16865
|
});
|
|
16895
16866
|
ctx.command(
|
|
16896
|
-
"
|
|
16867
|
+
"wordle.单词查找器 [wordleIndexs:text]",
|
|
16897
16868
|
"使用WordFinder查找匹配的单词"
|
|
16898
16869
|
).option("auto", "-a 自动查找(根据游戏进程)", { fallback: false }).option("wordLength", "-l <length> 指定要搜索的单词长度", {
|
|
16899
16870
|
fallback: void 0
|
|
@@ -16957,7 +16928,7 @@ ${idiomInfo.explanation}`
|
|
|
16957
16928
|
}
|
|
16958
16929
|
if (wordlesNum === 1) {
|
|
16959
16930
|
await session.execute(
|
|
16960
|
-
`
|
|
16931
|
+
`wordle.单词查找器 -l ${guessWordLength} --ct ${presentLetters} --wt ${absentLetters}`
|
|
16961
16932
|
);
|
|
16962
16933
|
} else {
|
|
16963
16934
|
let userInput = "";
|
|
@@ -16984,13 +16955,13 @@ ${idiomInfo.explanation}`
|
|
|
16984
16955
|
if (index > 0 && index <= wordlesNum) {
|
|
16985
16956
|
if (index === 1) {
|
|
16986
16957
|
await session.execute(
|
|
16987
|
-
`
|
|
16958
|
+
`wordle.单词查找器 -l ${guessWordLength} --ct ${presentLetters} --wt ${absentLetters}`
|
|
16988
16959
|
);
|
|
16989
16960
|
} else {
|
|
16990
16961
|
const gameInfo2 = await getGameInfo2(g, channelId, index);
|
|
16991
16962
|
const { guessWordLength: guessWordLength2, absentLetters: absentLetters2, presentLetters: presentLetters2 } = gameInfo2;
|
|
16992
16963
|
await session.execute(
|
|
16993
|
-
`
|
|
16964
|
+
`wordle.单词查找器 -l ${guessWordLength2} --ct ${presentLetters2} --wt ${absentLetters2}`
|
|
16994
16965
|
);
|
|
16995
16966
|
}
|
|
16996
16967
|
} else {
|
|
@@ -17027,7 +16998,7 @@ ${idiomInfo.explanation}`
|
|
|
17027
16998
|
const result = await fetchAndParseWords(g, url);
|
|
17028
16999
|
return await sendMessage(g, session, `${result}`);
|
|
17029
17000
|
});
|
|
17030
|
-
ctx.command("
|
|
17001
|
+
ctx.command("wordle.查询玩家记录 [targetUser:text]", "查询玩家记录").action(async ({ session }, targetUser) => {
|
|
17031
17002
|
let { userId, username } = session;
|
|
17032
17003
|
const originalUserId = userId;
|
|
17033
17004
|
username = await getSessionUserName(g, session);
|
|
@@ -17084,10 +17055,10 @@ __name(register3, "register");
|
|
|
17084
17055
|
|
|
17085
17056
|
// src/commands/progress.ts
|
|
17086
17057
|
var import_cheerio2 = require("cheerio");
|
|
17087
|
-
var
|
|
17058
|
+
var import_koishi4 = require("koishi");
|
|
17088
17059
|
function register4(g) {
|
|
17089
17060
|
const { ctx, config } = g;
|
|
17090
|
-
ctx.command("
|
|
17061
|
+
ctx.command("wordle.查询进度", "查询当前游戏进度").action(async ({ session }) => {
|
|
17091
17062
|
let { channelId, userId, username, timestamp } = session;
|
|
17092
17063
|
username = await getSessionUserName(g, session);
|
|
17093
17064
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -17169,7 +17140,7 @@ ${inputLengthMessage}
|
|
|
17169
17140
|
${progressMessage}`;
|
|
17170
17141
|
return await sendMessage(g, session, message);
|
|
17171
17142
|
});
|
|
17172
|
-
ctx.command("
|
|
17143
|
+
ctx.command("wordle.拼音速查表", "查看拼音速查表").action(async ({ session }) => {
|
|
17173
17144
|
let { channelId, userId, username } = session;
|
|
17174
17145
|
username = await getSessionUserName(g, session);
|
|
17175
17146
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -17182,7 +17153,7 @@ ${progressMessage}`;
|
|
|
17182
17153
|
return sendMessage(
|
|
17183
17154
|
g,
|
|
17184
17155
|
session,
|
|
17185
|
-
|
|
17156
|
+
import_koishi4.h.image(imageBuffer2, `image/${config.imageType}`)
|
|
17186
17157
|
);
|
|
17187
17158
|
}
|
|
17188
17159
|
const wordlesNum = gameInfo.wordlesNum;
|
|
@@ -17220,7 +17191,7 @@ ${progressMessage}`;
|
|
|
17220
17191
|
return sendMessage(
|
|
17221
17192
|
g,
|
|
17222
17193
|
session,
|
|
17223
|
-
|
|
17194
|
+
import_koishi4.h.image(imageBuffer, `image/${config.imageType}`)
|
|
17224
17195
|
);
|
|
17225
17196
|
});
|
|
17226
17197
|
}
|
|
@@ -17379,7 +17350,7 @@ __name(getLeaderboardFastestGuessTime, "getLeaderboardFastestGuessTime");
|
|
|
17379
17350
|
// src/commands/leaderboard.ts
|
|
17380
17351
|
function register5(g) {
|
|
17381
17352
|
const { ctx, config } = g;
|
|
17382
|
-
ctx.command("
|
|
17353
|
+
ctx.command("wordle.排行榜 [number:number]", "查看排行榜").action(
|
|
17383
17354
|
async ({ session }, number = config.defaultMaxLeaderboardEntries) => {
|
|
17384
17355
|
let { username, userId } = session;
|
|
17385
17356
|
username = await getSessionUserName(g, session);
|
|
@@ -17400,16 +17371,16 @@ ${rankType.map((type, index) => `${index + 1}. ${type}`).join("\n")}
|
|
|
17400
17371
|
const userInputNumber = parseInt(userInput);
|
|
17401
17372
|
if (!isNaN(userInputNumber) && userInputNumber > 0 && userInputNumber <= rankType.length) {
|
|
17402
17373
|
const rankName = rankType[userInputNumber - 1];
|
|
17403
|
-
await session.execute(`
|
|
17374
|
+
await session.execute(`wordle.排行榜.${rankName} ${number}`);
|
|
17404
17375
|
} else if (rankType.includes(userInput)) {
|
|
17405
|
-
await session.execute(`
|
|
17376
|
+
await session.execute(`wordle.排行榜.${userInput} ${number}`);
|
|
17406
17377
|
} else {
|
|
17407
17378
|
return sendMessage(g, session, `⚠️ 输入无效,请重新输入。`);
|
|
17408
17379
|
}
|
|
17409
17380
|
}
|
|
17410
17381
|
);
|
|
17411
17382
|
rankType2.forEach((type) => {
|
|
17412
|
-
ctx.command(`
|
|
17383
|
+
ctx.command(`wordle.排行榜.${type} [number:number]`, `查看${type}排行榜`).action(
|
|
17413
17384
|
async ({ session }, number = config.defaultMaxLeaderboardEntries) => {
|
|
17414
17385
|
let { username, userId } = session;
|
|
17415
17386
|
username = await getSessionUserName(g, session);
|
|
@@ -17439,11 +17410,11 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17439
17410
|
if (!isNaN(userInputNumber) && userInputNumber > 0 && userInputNumber <= rankType3.length) {
|
|
17440
17411
|
const rankName = rankType3[userInputNumber - 1];
|
|
17441
17412
|
await session.execute(
|
|
17442
|
-
`
|
|
17413
|
+
`wordle.排行榜.${type}.${rankName} ${number}`
|
|
17443
17414
|
);
|
|
17444
17415
|
} else if (rankType3.includes(userInput)) {
|
|
17445
17416
|
await session.execute(
|
|
17446
|
-
`
|
|
17417
|
+
`wordle.排行榜.${type}.${userInput} ${number}`
|
|
17447
17418
|
);
|
|
17448
17419
|
} else {
|
|
17449
17420
|
return sendMessage(g, session, `⚠️ 输入无效,请重新输入。`);
|
|
@@ -17451,7 +17422,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17451
17422
|
}
|
|
17452
17423
|
);
|
|
17453
17424
|
});
|
|
17454
|
-
ctx.command("
|
|
17425
|
+
ctx.command("wordle.排行榜.损益 [number:number]", "查看玩家损益排行榜").action(
|
|
17455
17426
|
async ({ session }, number = config.defaultMaxLeaderboardEntries) => {
|
|
17456
17427
|
let { username, userId } = session;
|
|
17457
17428
|
username = await getSessionUserName(g, session);
|
|
@@ -17470,7 +17441,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17470
17441
|
}
|
|
17471
17442
|
);
|
|
17472
17443
|
ctx.command(
|
|
17473
|
-
"
|
|
17444
|
+
"wordle.排行榜.猜出次数 [number:number]",
|
|
17474
17445
|
"查看玩家猜出次数排行榜"
|
|
17475
17446
|
).action(
|
|
17476
17447
|
async ({ session }, number = config.defaultMaxLeaderboardEntries) => {
|
|
@@ -17491,7 +17462,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17491
17462
|
}
|
|
17492
17463
|
);
|
|
17493
17464
|
ctx.command(
|
|
17494
|
-
"
|
|
17465
|
+
"wordle.排行榜.总.胜场 [number:number]",
|
|
17495
17466
|
"查看玩家总胜场排行榜"
|
|
17496
17467
|
).action(
|
|
17497
17468
|
async ({ session }, number = config.defaultMaxLeaderboardEntries) => {
|
|
@@ -17512,7 +17483,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17512
17483
|
}
|
|
17513
17484
|
);
|
|
17514
17485
|
ctx.command(
|
|
17515
|
-
"
|
|
17486
|
+
"wordle.排行榜.总.输场 [number:number]",
|
|
17516
17487
|
"查看玩家总输场排行榜"
|
|
17517
17488
|
).action(
|
|
17518
17489
|
async ({ session }, number = config.defaultMaxLeaderboardEntries) => {
|
|
@@ -17534,7 +17505,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17534
17505
|
);
|
|
17535
17506
|
rankType4.forEach((type) => {
|
|
17536
17507
|
ctx.command(
|
|
17537
|
-
`
|
|
17508
|
+
`wordle.排行榜.${type}.胜场 [number:number]`,
|
|
17538
17509
|
`查看${type}胜场排行榜`
|
|
17539
17510
|
).option("hard", "--hard 查看困难模式", { fallback: false }).option("wordles", "--wordles <value:number> 查看多猜测模式", {
|
|
17540
17511
|
fallback: 0
|
|
@@ -17574,7 +17545,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17574
17545
|
}
|
|
17575
17546
|
);
|
|
17576
17547
|
ctx.command(
|
|
17577
|
-
`
|
|
17548
|
+
`wordle.排行榜.${type}.输场 [number:number]`,
|
|
17578
17549
|
`查看${type}输场排行榜`
|
|
17579
17550
|
).option("hard", "--hard 查看困难模式", { fallback: false }).option("wordles", "--wordles <value:number> 查看多猜测模式", {
|
|
17580
17551
|
fallback: 0
|
|
@@ -17614,7 +17585,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17614
17585
|
}
|
|
17615
17586
|
);
|
|
17616
17587
|
ctx.command(
|
|
17617
|
-
`
|
|
17588
|
+
`wordle.排行榜.${type}.最快用时 [number:number]`,
|
|
17618
17589
|
`查看${type}最快用时排行榜`
|
|
17619
17590
|
).option("hard", "--hard 查看困难模式", { fallback: false }).option("wordles", "--wordles <value:number> 查看多猜测模式", {
|
|
17620
17591
|
fallback: 0
|
|
@@ -17655,7 +17626,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
17655
17626
|
);
|
|
17656
17627
|
});
|
|
17657
17628
|
ctx.command(
|
|
17658
|
-
"
|
|
17629
|
+
"wordle.排行榜.词影.猜出次数 [number:number]",
|
|
17659
17630
|
"查看玩家猜出次数排行榜(词影)"
|
|
17660
17631
|
).option("hard", "--hard 查看困难模式", { fallback: false }).option("wordles", "--wordles <value:number> 查看多猜测模式", {
|
|
17661
17632
|
fallback: 1
|
|
@@ -17690,8 +17661,7 @@ __name(register5, "register");
|
|
|
17690
17661
|
|
|
17691
17662
|
// src/index.ts
|
|
17692
17663
|
var inject = {
|
|
17693
|
-
required: ["monetary", "database", "puppeteer"]
|
|
17694
|
-
optional: ["markdownToImage"]
|
|
17664
|
+
required: ["monetary", "database", "puppeteer"]
|
|
17695
17665
|
};
|
|
17696
17666
|
var name = "wordle-game";
|
|
17697
17667
|
async function apply(ctx, config) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-wordle-game",
|
|
3
|
-
"description": "Koishi
|
|
4
|
-
"version": "2.
|
|
3
|
+
"description": "Koishi 的多模式猜词游戏插件。",
|
|
4
|
+
"version": "2.8.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"monetary",
|
|
19
19
|
"database",
|
|
20
20
|
"puppeteer"
|
|
21
|
-
],
|
|
22
|
-
"optional": [
|
|
23
|
-
"markdownToImage"
|
|
24
21
|
]
|
|
25
22
|
}
|
|
26
23
|
},
|
|
@@ -56,7 +53,6 @@
|
|
|
56
53
|
"koishi": "^4.18.11"
|
|
57
54
|
},
|
|
58
55
|
"devDependencies": {
|
|
59
|
-
"koishi-plugin-markdown-to-image-service": "^1.2.5",
|
|
60
56
|
"koishi-plugin-monetary": "^0.1.3",
|
|
61
57
|
"koishi-plugin-puppeteer": "^3.9.0"
|
|
62
58
|
},
|