koishi-plugin-wordle-game 2.7.0 → 2.7.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/README.md +39 -74
- package/lib/index.js +27 -77
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
koishi-plugin-wordle-game
|
|
2
|
-
|
|
2
|
+
=========================
|
|
3
3
|
|
|
4
4
|
[<img alt="github" src="https://img.shields.io/badge/github-araea/wordle_game-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/araea/koishi-plugin-wordle-game)
|
|
5
5
|
[<img alt="npm" src="https://img.shields.io/npm/v/koishi-plugin-wordle-game.svg?style=for-the-badge&color=fc8d62&logo=npm" height="20">](https://www.npmjs.com/package/koishi-plugin-wordle-game)
|
|
6
6
|
|
|
7
7
|
Koishi 的 Wordle | 汉兜 | 词影 | Numberle | Math | Lewdle 游戏插件。
|
|
8
8
|
|
|
9
|
-
支持以下游戏:
|
|
10
|
-
|
|
11
9
|
- [Wordle](https://www.nytimes.com/games/wordle/index.html)
|
|
12
10
|
- [汉兜](https://handle.antfu.me/)
|
|
13
11
|
- [词影](https://cy.surprising.studio/)
|
|
@@ -17,23 +15,18 @@ Koishi 的 Wordle | 汉兜 | 词影 | Numberle | Math | Lewdle 游戏插件。
|
|
|
17
15
|
|
|
18
16
|
## 使用
|
|
19
17
|
|
|
20
|
-
1. 启用 `monetary
|
|
18
|
+
1. 启用 `monetary`、`database`、`puppeteer` 服务。
|
|
21
19
|
2. 设置指令别名。
|
|
22
|
-
3.
|
|
23
|
-
4. 输入猜测词。
|
|
20
|
+
3. `wordleGame.开始` 引导开局,然后直接输入猜测词。
|
|
24
21
|
|
|
25
22
|
## 注意事项
|
|
26
23
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## 特性
|
|
32
|
-
|
|
33
|
-
- 词影模式拥有细分排行榜,可通过 `help` 指令探索。
|
|
34
|
-
- 可在 `idioms.json` 中自行添加成语(如“原神启动”),注意 JSON 格式,末项无逗号。
|
|
24
|
+
- 成语报未知错误时,检查 `data/wordleGame/idioms.json` 的拼音。
|
|
25
|
+
- 汉兜遇到词库里没有的四字词,会走配置「拼音接口设置」里的 OpenAI 兼容接口;留空则不发请求,只提示手动补全。
|
|
26
|
+
- 词影模式有细分排行榜,`help` 可查。
|
|
27
|
+
- 可在 `idioms.json` 自行加词(如「原神启动」),注意 JSON 末项无逗号。
|
|
35
28
|
|
|
36
|
-
##
|
|
29
|
+
## 指令
|
|
37
30
|
|
|
38
31
|
### `wordleGame.开始 [待猜词长度]`
|
|
39
32
|
|
|
@@ -41,53 +34,28 @@ Koishi 的 Wordle | 汉兜 | 词影 | Numberle | Math | Lewdle 游戏插件。
|
|
|
41
34
|
|
|
42
35
|
#### `wordleGame.开始.<模式> [待猜词长度]`
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
- `经典`, `CET4/6`, `GMAT`, `GRE`, `IELTS`, `SAT`, `TOEFL`, `考研`, `专八/四`
|
|
46
|
-
- `ALL`, `Lewdle`, `Numberle`, `Math`, `汉兜`, `词影`
|
|
47
|
-
|
|
48
|
-
- **通用选项**:
|
|
49
|
-
|
|
50
|
-
- `--hard` (困难模式)
|
|
51
|
-
- 绿色线索必须保持固定。
|
|
52
|
-
- 黄色线索必须重复使用。
|
|
53
|
-
- 词影模式下,提高匹配难度。
|
|
54
|
-
|
|
55
|
-
- `--uhard` (超困难模式)
|
|
56
|
-
- 基于困难模式。
|
|
57
|
-
- 黄色线索必须移离其原位。
|
|
58
|
-
- 灰色线索不得再次使用。
|
|
37
|
+
可用模式:`经典`、`CET4/6`、`GMAT`、`GRE`、`IELTS`、`SAT`、`TOEFL`、`考研`、`专八/四`、`ALL`、`Lewdle`、`Numberle`、`Math`、`汉兜`、`词影`。
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
- AI 将尽量避免给出答案,每次猜测仅透露最少信息,甚至可能更换秘密词。
|
|
62
|
-
- [玩法参考](https://qntm.org/absurdle)
|
|
39
|
+
通用选项:
|
|
63
40
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
- `--hard` 困难:绿色线索保持固定,黄色线索必须再用。词影模式下提高匹配难度。
|
|
42
|
+
- `--uhard` 超困难:基于困难。黄色线索必须离位,灰色线索不得再用。
|
|
43
|
+
- `--absurd` 荒谬:尽量少给信息,甚至可能更换秘密词。[玩法参考](https://qntm.org/absurdle)
|
|
44
|
+
- `--challenge` 挑战:从一个给定目标词反向推导秘密词。[玩法参考](https://qntm.org/challenge)
|
|
45
|
+
- `--wordles <数量>` 同时猜多个词,默认 1 ~ 4,可配置。
|
|
67
46
|
|
|
68
|
-
|
|
69
|
-
- 同时猜测多个词,默认数量 1 ~ 4,可配置。
|
|
47
|
+
汉兜与词影:
|
|
70
48
|
|
|
71
|
-
-
|
|
49
|
+
- `--free` 任意四字词都可作猜测。
|
|
50
|
+
- `--all` 词库扩到 29766+(含生僻字)。关掉时用 7208 个常用成语。
|
|
72
51
|
|
|
73
|
-
|
|
74
|
-
- 任意四字词语均可作为猜测词。
|
|
75
|
-
|
|
76
|
-
- `--all` (全成语模式)
|
|
77
|
-
- 开启后,词库扩展至 29766+ (含生僻字,极难)。
|
|
78
|
-
- 关闭时,使用 7208 个常用成语 (义务教育)。
|
|
79
|
-
|
|
80
|
-
> 注:经典模式和汉兜模式可投入货币,获胜有奖励。可同时启用多种难度模式。
|
|
52
|
+
经典模式和汉兜模式可投入货币,获胜有奖励。多种难度可同时开。
|
|
81
53
|
|
|
82
54
|
### `wordleGame.猜 <猜测内容>`
|
|
83
55
|
|
|
84
|
-
|
|
85
|
-
- 选项:
|
|
86
|
-
- `-r`: 随机猜测一次。
|
|
87
|
-
|
|
88
|
-
---
|
|
56
|
+
猜单词、成语等。`-r` 随机猜一次。
|
|
89
57
|
|
|
90
|
-
##
|
|
58
|
+
## 示例
|
|
91
59
|
|
|
92
60
|
<!-- markdownlint-disable MD033 -->
|
|
93
61
|
<details>
|
|
@@ -127,30 +95,27 @@ Koishi 的 Wordle | 汉兜 | 词影 | Numberle | Math | Lewdle 游戏插件。
|
|
|
127
95
|
|
|
128
96
|
## 致谢
|
|
129
97
|
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
-
|
|
147
|
-
- [koishi-plugin-wordle](https://www.npmjs.com/package/koishi-plugin-wordle)
|
|
148
|
-
- [nonebot-plugin-wordle](https://github.com/noneplugin/nonebot-plugin-wordle)
|
|
149
|
-
- [Wordle 2315 words list](https://gist.github.com/DevilXD/6ad6cc1fe37872d069a795edd51233b2#file-wordle_words-txt)
|
|
98
|
+
- [Koishi](https://koishi.chat/)
|
|
99
|
+
- ly、麦神等朋友
|
|
100
|
+
- [Akisa](https://forum.koishi.xyz/u/akisa/summary)
|
|
101
|
+
- [汉典](https://www.zdic.net/)
|
|
102
|
+
- [百度汉语](https://hanyu.baidu.com/)
|
|
103
|
+
- [WordFinder](https://wordword.org/)
|
|
104
|
+
- [skywind3000/ECDICT](https://github.com/skywind3000/ECDICT)
|
|
105
|
+
- [Wordle](https://www.nytimes.com/games/wordle/index.html)
|
|
106
|
+
- [汉兜](https://handle.antfu.me/)
|
|
107
|
+
- [词影](https://cy.surprising.studio/)
|
|
108
|
+
- [Numberle (dduarte)](https://dduarte.github.io/numberle/)
|
|
109
|
+
- [Numberle (numberle.org)](https://numberle.org/)
|
|
110
|
+
- [LewdleGame](https://www.lewdlegame.com/App)
|
|
111
|
+
- [WordlePlay](https://wordleplay.com/wordle-games)
|
|
112
|
+
- [koishi-plugin-wordle](https://www.npmjs.com/package/koishi-plugin-wordle)
|
|
113
|
+
- [nonebot-plugin-wordle](https://github.com/noneplugin/nonebot-plugin-wordle)
|
|
114
|
+
- [Wordle 2315 words list](https://gist.github.com/DevilXD/6ad6cc1fe37872d069a795edd51233b2#file-wordle_words-txt)
|
|
150
115
|
|
|
151
116
|
## QQ 群
|
|
152
117
|
|
|
153
|
-
-
|
|
118
|
+
- 956758505
|
|
154
119
|
|
|
155
120
|
<br>
|
|
156
121
|
|
package/lib/index.js
CHANGED
|
@@ -14073,6 +14073,7 @@ __name(generateLetterTilesHtmlForHandle, "generateLetterTilesHtmlForHandle");
|
|
|
14073
14073
|
|
|
14074
14074
|
// src/services/renderer.ts
|
|
14075
14075
|
var path = __toESM(require("path"));
|
|
14076
|
+
var import_url = require("url");
|
|
14076
14077
|
|
|
14077
14078
|
// src/html/template.ts
|
|
14078
14079
|
var htmlSuffix = `</div>
|
|
@@ -14998,13 +14999,26 @@ var defaultPinyinsHtml = ` <div grid="~ cols-2 gap-3" h-min="
|
|
|
14998
14999
|
</div>`;
|
|
14999
15000
|
|
|
15000
15001
|
// src/services/renderer.ts
|
|
15002
|
+
async function capture(g, html, viewport, fileOrigin = false) {
|
|
15003
|
+
const page = await g.ctx.puppeteer.page();
|
|
15004
|
+
try {
|
|
15005
|
+
await page.setViewport({ ...viewport, deviceScaleFactor: 1 });
|
|
15006
|
+
if (fileOrigin) {
|
|
15007
|
+
await page.goto(
|
|
15008
|
+
(0, import_url.pathToFileURL)(path.join(__dirname, "emptyHtml.html")).href
|
|
15009
|
+
);
|
|
15010
|
+
}
|
|
15011
|
+
await page.setContent(html, { waitUntil: "load" });
|
|
15012
|
+
return await page.screenshot({
|
|
15013
|
+
fullPage: true,
|
|
15014
|
+
type: g.config.imageType
|
|
15015
|
+
});
|
|
15016
|
+
} finally {
|
|
15017
|
+
await page.close();
|
|
15018
|
+
}
|
|
15019
|
+
}
|
|
15020
|
+
__name(capture, "capture");
|
|
15001
15021
|
async function generateImage(g, styledHtml, gridHtml) {
|
|
15002
|
-
const browser = g.ctx.puppeteer.browser;
|
|
15003
|
-
const context = await browser.createBrowserContext();
|
|
15004
|
-
const page = await context.newPage();
|
|
15005
|
-
await page.setViewport({ width: 611, height: 731, deviceScaleFactor: 1 });
|
|
15006
|
-
const filePath = path.join(__dirname, "emptyHtml.html").replace(/\\/g, "/");
|
|
15007
|
-
await page.goto("file://" + filePath);
|
|
15008
15022
|
const html = `${htmlPrefix}
|
|
15009
15023
|
${styledHtml}
|
|
15010
15024
|
${htmlAfterStyle(g.config)}
|
|
@@ -15012,27 +15026,10 @@ async function generateImage(g, styledHtml, gridHtml) {
|
|
|
15012
15026
|
${gridHtml}
|
|
15013
15027
|
</div>
|
|
15014
15028
|
${htmlSuffix}`;
|
|
15015
|
-
|
|
15016
|
-
const imageBuffer = await page.screenshot({
|
|
15017
|
-
fullPage: true,
|
|
15018
|
-
type: g.config.imageType
|
|
15019
|
-
});
|
|
15020
|
-
await page.close();
|
|
15021
|
-
await context.close();
|
|
15022
|
-
return imageBuffer;
|
|
15029
|
+
return capture(g, html, { width: 611, height: 731 });
|
|
15023
15030
|
}
|
|
15024
15031
|
__name(generateImage, "generateImage");
|
|
15025
15032
|
async function generateImageForCiying(g, gridHtml, rowNum) {
|
|
15026
|
-
const browser = g.ctx.puppeteer.browser;
|
|
15027
|
-
const context = await browser.createBrowserContext();
|
|
15028
|
-
const page = await context.newPage();
|
|
15029
|
-
await page.setViewport({
|
|
15030
|
-
width: 611,
|
|
15031
|
-
height: 140 * rowNum,
|
|
15032
|
-
deviceScaleFactor: 1
|
|
15033
|
-
});
|
|
15034
|
-
const filePath = path.join(__dirname, "emptyHtml.html").replace(/\\/g, "/");
|
|
15035
|
-
await page.goto("file://" + filePath);
|
|
15036
15033
|
const html = `<html lang="zh" class="h-full ${g.config.isDarkThemeEnabled ? "dark" : ""}">
|
|
15037
15034
|
<head>
|
|
15038
15035
|
<meta charset="UTF-8">
|
|
@@ -15065,23 +15062,10 @@ ${gridHtml}
|
|
|
15065
15062
|
|
|
15066
15063
|
</body>
|
|
15067
15064
|
</html>`;
|
|
15068
|
-
|
|
15069
|
-
const imageBuffer = await page.screenshot({
|
|
15070
|
-
fullPage: true,
|
|
15071
|
-
type: g.config.imageType
|
|
15072
|
-
});
|
|
15073
|
-
await page.close();
|
|
15074
|
-
await context.close();
|
|
15075
|
-
return imageBuffer;
|
|
15065
|
+
return capture(g, html, { width: 611, height: 140 * rowNum }, true);
|
|
15076
15066
|
}
|
|
15077
15067
|
__name(generateImageForCiying, "generateImageForCiying");
|
|
15078
15068
|
async function generateImageForHandle(g, gridHtml) {
|
|
15079
|
-
const browser = g.ctx.puppeteer.browser;
|
|
15080
|
-
const context = await browser.createBrowserContext();
|
|
15081
|
-
const page = await context.newPage();
|
|
15082
|
-
await page.setViewport({ width: 611, height: 731, deviceScaleFactor: 1 });
|
|
15083
|
-
const filePath = path.join(__dirname, "emptyHtml.html").replace(/\\/g, "/");
|
|
15084
|
-
await page.goto("file://" + filePath);
|
|
15085
15069
|
const html = `<html lang="en" class="${g.config.isDarkThemeEnabled ? "dark" : ""}" style="--vh: 7.55px;">
|
|
15086
15070
|
<head>
|
|
15087
15071
|
<meta charset="UTF-8">
|
|
@@ -15104,23 +15088,10 @@ async function generateImageForHandle(g, gridHtml) {
|
|
|
15104
15088
|
</div>
|
|
15105
15089
|
</body>
|
|
15106
15090
|
</html>`;
|
|
15107
|
-
|
|
15108
|
-
const imageBuffer = await page.screenshot({
|
|
15109
|
-
fullPage: true,
|
|
15110
|
-
type: g.config.imageType
|
|
15111
|
-
});
|
|
15112
|
-
await page.close();
|
|
15113
|
-
await context.close();
|
|
15114
|
-
return imageBuffer;
|
|
15091
|
+
return capture(g, html, { width: 611, height: 731 }, true);
|
|
15115
15092
|
}
|
|
15116
15093
|
__name(generateImageForHandle, "generateImageForHandle");
|
|
15117
15094
|
async function generateHandlePinyinsImage(g, pinyinsHtml) {
|
|
15118
|
-
const browser = g.ctx.puppeteer.browser;
|
|
15119
|
-
const context = await browser.createBrowserContext();
|
|
15120
|
-
const page = await context.newPage();
|
|
15121
|
-
await page.setViewport({ width: 420, height: 570, deviceScaleFactor: 1 });
|
|
15122
|
-
const filePath = path.join(__dirname, "emptyHtml.html").replace(/\\/g, "/");
|
|
15123
|
-
await page.goto("file://" + filePath);
|
|
15124
15095
|
const html = `<html lang="en" class="${g.config.isDarkThemeEnabled ? "dark" : ""}" style="--vh: 6.04px;">
|
|
15125
15096
|
<head>
|
|
15126
15097
|
<meta charset="UTF-8">
|
|
@@ -15147,27 +15118,10 @@ async function generateHandlePinyinsImage(g, pinyinsHtml) {
|
|
|
15147
15118
|
</div>
|
|
15148
15119
|
</body>
|
|
15149
15120
|
</html>`;
|
|
15150
|
-
|
|
15151
|
-
const imageBuffer = await page.screenshot({
|
|
15152
|
-
fullPage: true,
|
|
15153
|
-
type: g.config.imageType
|
|
15154
|
-
});
|
|
15155
|
-
await page.close();
|
|
15156
|
-
await context.close();
|
|
15157
|
-
return imageBuffer;
|
|
15121
|
+
return capture(g, html, { width: 420, height: 570 }, true);
|
|
15158
15122
|
}
|
|
15159
15123
|
__name(generateHandlePinyinsImage, "generateHandlePinyinsImage");
|
|
15160
15124
|
async function generateWordlesImage(g, htmlImgString) {
|
|
15161
|
-
const browser = g.ctx.puppeteer.browser;
|
|
15162
|
-
const context = await browser.createBrowserContext();
|
|
15163
|
-
const page = await context.newPage();
|
|
15164
|
-
await page.setViewport({
|
|
15165
|
-
width: g.config.compositeImagePageWidth,
|
|
15166
|
-
height: g.config.compositeImagePageHeight,
|
|
15167
|
-
deviceScaleFactor: 1
|
|
15168
|
-
});
|
|
15169
|
-
const filePath = path.join(__dirname, "emptyHtml.html").replace(/\\/g, "/");
|
|
15170
|
-
await page.goto("file://" + filePath);
|
|
15171
15125
|
const html = `<!DOCTYPE html>
|
|
15172
15126
|
<html lang="en">
|
|
15173
15127
|
<head>
|
|
@@ -15206,14 +15160,10 @@ async function generateWordlesImage(g, htmlImgString) {
|
|
|
15206
15160
|
</div>
|
|
15207
15161
|
</body>
|
|
15208
15162
|
</html>`;
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
type: g.config.imageType
|
|
15163
|
+
return capture(g, html, {
|
|
15164
|
+
width: g.config.compositeImagePageWidth,
|
|
15165
|
+
height: g.config.compositeImagePageHeight
|
|
15213
15166
|
});
|
|
15214
|
-
await page.close();
|
|
15215
|
-
await context.close();
|
|
15216
|
-
return wordlesImageBuffer;
|
|
15217
15167
|
}
|
|
15218
15168
|
__name(generateWordlesImage, "generateWordlesImage");
|
|
15219
15169
|
|