koishi-plugin-wordle-game 2.10.0 → 3.0.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/lib/config.d.ts +1 -1
- package/lib/index.js +261 -236
- package/package.json +1 -1
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`wordle.\u5F00\u59CB` \u5F00\u5C40\uFF0C\
|
|
2
|
+
export declare const usage = "## \u4F7F\u7528\n\n\u53D1\u9001 `wordle.\u5F00\u59CB` \u5F00\u5C40\uFF0C\u4E4B\u540E\u76F4\u63A5\u53D1\u9001\u731C\u6D4B\u8BCD\u5373\u53EF\u3002\n\n## \u6307\u4EE4\n\n| \u6307\u4EE4 | \u8BF4\u660E |\n| --- | --- |\n| `wordle.\u5F00\u59CB [\u957F\u5EA6]` | \u5F15\u5BFC\u5F0F\u5F00\u5C40 |\n| `wordle.\u5F00\u59CB.<\u6A21\u5F0F> [\u957F\u5EA6]` | \u6307\u5B9A\u6A21\u5F0F\u5F00\u5C40 |\n| `wordle.\u731C <\u5185\u5BB9>` | \u63D0\u4EA4\u731C\u6D4B |\n| `wordle.\u67E5\u8BE2\u8FDB\u5EA6` | \u67E5\u770B\u5F53\u524D\u5BF9\u5C40\u8FDB\u5EA6 |\n| `wordle.\u7ED3\u675F` | \u7ED3\u675F\u5F53\u524D\u5BF9\u5C40 |\n| `wordle.\u6392\u884C\u699C [\u4EBA\u6570]` | \u67E5\u770B\u6392\u884C\u699C |\n| `wordle.\u6218\u7EE9 [@\u67D0\u4EBA]` | \u67E5\u8BE2\u73A9\u5BB6\u6218\u7EE9 |\n| `wordle.\u67E5\u5355\u8BCD <\u8BCD>` | \u5F15\u5BFC\u5F0F\u67E5\u5355\u8BCD |\n| `wordle.\u67E5\u6210\u8BED <\u6210\u8BED>` | \u67E5\u8BE2\u6210\u8BED\u7684\u62FC\u97F3\u4E0E\u89E3\u91CA\uFF08\u6C49\u5178\uFF09 |\n| `wordle.\u62FC\u97F3\u901F\u67E5\u8868` | \u67E5\u770B\u62FC\u97F3\u901F\u67E5\u8868 |\n| `wordle.\u73A9\u6CD5\u4ECB\u7ECD` | \u67E5\u770B\u73A9\u6CD5\u4ECB\u7ECD |\n\n\u6A21\u5F0F\u5305\u62EC\u7ECF\u5178\u3001\u6C49\u515C\u3001\u8BCD\u5F71\u3001Numberle\u3001Math\u3001Lewdle \u53CA\u5176\u4ED6\u8BCD\u5E93\u3002\n\n\u53EF\u7528\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;
|
package/lib/index.js
CHANGED
|
@@ -44,65 +44,65 @@ var path3 = __toESM(require("path"));
|
|
|
44
44
|
var import_koishi = require("koishi");
|
|
45
45
|
var usage = `## 使用
|
|
46
46
|
|
|
47
|
-
\`wordle.开始\`
|
|
47
|
+
发送 \`wordle.开始\` 开局,之后直接发送猜测词即可。
|
|
48
48
|
|
|
49
49
|
## 指令
|
|
50
50
|
|
|
51
51
|
| 指令 | 说明 |
|
|
52
52
|
| --- | --- |
|
|
53
|
-
| \`wordle.开始 [长度]\` |
|
|
53
|
+
| \`wordle.开始 [长度]\` | 引导式开局 |
|
|
54
54
|
| \`wordle.开始.<模式> [长度]\` | 指定模式开局 |
|
|
55
55
|
| \`wordle.猜 <内容>\` | 提交猜测 |
|
|
56
|
-
| \`wordle.查询进度\` |
|
|
57
|
-
| \`wordle.结束\` |
|
|
56
|
+
| \`wordle.查询进度\` | 查看当前对局进度 |
|
|
57
|
+
| \`wordle.结束\` | 结束当前对局 |
|
|
58
58
|
| \`wordle.排行榜 [人数]\` | 查看排行榜 |
|
|
59
|
-
| \`wordle
|
|
60
|
-
| \`wordle.查单词 <词>\` |
|
|
59
|
+
| \`wordle.战绩 [@某人]\` | 查询玩家战绩 |
|
|
60
|
+
| \`wordle.查单词 <词>\` | 引导式查单词 |
|
|
61
61
|
| \`wordle.查成语 <成语>\` | 查询成语的拼音与解释(汉典) |
|
|
62
62
|
| \`wordle.拼音速查表\` | 查看拼音速查表 |
|
|
63
|
-
| \`wordle.玩法介绍\` |
|
|
63
|
+
| \`wordle.玩法介绍\` | 查看玩法介绍 |
|
|
64
64
|
|
|
65
65
|
模式包括经典、汉兜、词影、Numberle、Math、Lewdle 及其他词库。
|
|
66
66
|
|
|
67
67
|
可用选项:\`--hard\`、\`--uhard\`、\`--absurd\`、\`--challenge\`、\`--wordles\`、\`--free\`、\`--all\`。`;
|
|
68
68
|
var Config = import_koishi.Schema.intersect([
|
|
69
69
|
import_koishi.Schema.object({
|
|
70
|
-
isDarkThemeEnabled: import_koishi.Schema.boolean().default(false).description(
|
|
71
|
-
isHighContrastThemeEnabled: import_koishi.Schema.boolean().default(false).description(
|
|
70
|
+
isDarkThemeEnabled: import_koishi.Schema.boolean().default(false).description(`使用黑暗主题。`),
|
|
71
|
+
isHighContrastThemeEnabled: import_koishi.Schema.boolean().default(false).description(`使用高对比度主题,为色觉障碍准备。`)
|
|
72
72
|
}).description("主题设置"),
|
|
73
73
|
import_koishi.Schema.object({
|
|
74
|
-
compositeImagePageWidth: import_koishi.Schema.number().min(1).default(800).description(
|
|
75
|
-
compositeImagePageHeight: import_koishi.Schema.number().min(1).default(100).description(
|
|
76
|
-
maxSimultaneousGuesses: import_koishi.Schema.number().min(1).default(4).description(
|
|
77
|
-
defaultMaxLeaderboardEntries: import_koishi.Schema.number().min(0).default(10).description(
|
|
78
|
-
defaultWordLengthForGuessing: import_koishi.Schema.number().min(1).default(5).description(
|
|
74
|
+
compositeImagePageWidth: import_koishi.Schema.number().min(1).default(800).description(`多词合成图的页面宽度(像素)。`),
|
|
75
|
+
compositeImagePageHeight: import_koishi.Schema.number().min(1).default(100).description(`多词合成图的页面高度(像素)。`),
|
|
76
|
+
maxSimultaneousGuesses: import_koishi.Schema.number().min(1).default(4).description(`同时猜测的单词数量上限。`),
|
|
77
|
+
defaultMaxLeaderboardEntries: import_koishi.Schema.number().min(0).default(10).description(`排行榜默认显示的人数。`),
|
|
78
|
+
defaultWordLengthForGuessing: import_koishi.Schema.number().min(1).default(5).description(`非经典模式下默认的猜测长度。`)
|
|
79
79
|
}).description("游戏设置"),
|
|
80
80
|
import_koishi.Schema.intersect([
|
|
81
81
|
import_koishi.Schema.object({
|
|
82
|
-
enableWordGuessMiddleware: import_koishi.Schema.boolean().default(true).description(
|
|
83
|
-
isPreventUserDuplicateGuessInput: import_koishi.Schema.boolean().default(true).description(
|
|
82
|
+
enableWordGuessMiddleware: import_koishi.Schema.boolean().default(true).description(`对局进行中时,直接发送猜测词即可,无需指令前缀。`),
|
|
83
|
+
isPreventUserDuplicateGuessInput: import_koishi.Schema.boolean().default(true).description(`拦截重复提交的猜测词。`),
|
|
84
84
|
shouldPromptWordLengthInput: import_koishi.Schema.boolean().default(true).description(
|
|
85
|
-
|
|
85
|
+
`引导式开局时,追问一次单词长度。关闭则直接用默认长度。`
|
|
86
86
|
),
|
|
87
87
|
shouldPromptForWordLengthOnNonClassicStart: import_koishi.Schema.boolean().default(true).description(
|
|
88
|
-
|
|
88
|
+
`以非经典模式开局时,追问一次单词长度。关闭则直接用默认长度。`
|
|
89
89
|
)
|
|
90
90
|
}).description("游戏行为设置"),
|
|
91
91
|
import_koishi.Schema.object({
|
|
92
|
-
enableWordGuessTimeLimit: import_koishi.Schema.boolean().default(false).description(
|
|
92
|
+
enableWordGuessTimeLimit: import_koishi.Schema.boolean().default(false).description(`给每次作答加上时间限制。`)
|
|
93
93
|
}),
|
|
94
94
|
import_koishi.Schema.union([
|
|
95
95
|
import_koishi.Schema.object({
|
|
96
96
|
enableWordGuessTimeLimit: import_koishi.Schema.const(true).required(),
|
|
97
|
-
wordGuessTimeLimitInSeconds: import_koishi.Schema.number().min(0).default(120).description(
|
|
97
|
+
wordGuessTimeLimitInSeconds: import_koishi.Schema.number().min(0).default(120).description(`每次作答的时间限制(秒)。`)
|
|
98
98
|
}),
|
|
99
99
|
import_koishi.Schema.object({})
|
|
100
100
|
]),
|
|
101
101
|
import_koishi.Schema.object({
|
|
102
102
|
retractDelay: import_koishi.Schema.number().min(0).default(0).description(
|
|
103
|
-
|
|
103
|
+
`自动撤回延迟(秒),0 表示不撤回。`
|
|
104
104
|
),
|
|
105
|
-
imageType: import_koishi.Schema.union(["png", "jpeg", "webp"]).default("png").description(
|
|
105
|
+
imageType: import_koishi.Schema.union(["png", "jpeg", "webp"]).default("png").description(`发送的图片格式。`)
|
|
106
106
|
})
|
|
107
107
|
])
|
|
108
108
|
]);
|
|
@@ -606,31 +606,31 @@ async function processExtraGameInfos(g, channelId) {
|
|
|
606
606
|
presentPinyins
|
|
607
607
|
}) => {
|
|
608
608
|
const present = presentLetters.length === 0 ? "" : `
|
|
609
|
-
|
|
609
|
+
包含 ${presentLetters}`;
|
|
610
610
|
const absent = absentLetters.length === 0 ? "" : `
|
|
611
|
-
|
|
611
|
+
不包含 ${absentLetters}`;
|
|
612
612
|
const presentWithoutIndex = presentLettersWithIndex.length === 0 ? "" : `
|
|
613
|
-
|
|
613
|
+
位置排除 ${presentLettersWithIndex.join("、")}`;
|
|
614
614
|
const pinyinsCorrectInfo = correctPinyinsWithIndex.length !== 0 ? `
|
|
615
|
-
|
|
615
|
+
正确拼音 ${correctPinyinsWithIndex.join("、")}` : "";
|
|
616
616
|
const pinyinsPresentInfo = presentPinyins.length !== 0 ? `
|
|
617
|
-
|
|
617
|
+
包含拼音 ${presentPinyins.join("、")}` : "";
|
|
618
618
|
const pinyinsAbsentInfo = absentPinyins.length !== 0 ? `
|
|
619
|
-
|
|
619
|
+
不包含拼音 ${absentPinyins.join("、")}` : "";
|
|
620
620
|
const pinyinsPresentWithIndexInfo = presentPinyinsWithIndex.length !== 0 ? `
|
|
621
|
-
|
|
621
|
+
拼音位置排除 ${presentPinyinsWithIndex.join("、")}` : "";
|
|
622
622
|
const tonesCorrectInfo = correctTonesWithIndex.length !== 0 ? `
|
|
623
|
-
|
|
623
|
+
正确声调 ${correctTonesWithIndex.join("、")}` : "";
|
|
624
624
|
const tonesPresentInfo = presentTones.length !== 0 ? `
|
|
625
|
-
|
|
625
|
+
包含声调 ${presentTones.join("、")}` : "";
|
|
626
626
|
const tonesAbsentInfo = absentTones.length !== 0 ? `
|
|
627
|
-
|
|
627
|
+
不包含声调 ${absentTones.join("、")}` : "";
|
|
628
628
|
const tonesPresentWithIndexInfo = presentTonesWithIndex.length !== 0 ? `
|
|
629
|
-
|
|
629
|
+
声调位置排除 ${presentTonesWithIndex.join("、")}` : "";
|
|
630
630
|
return `
|
|
631
|
-
|
|
631
|
+
当前进度 ${correctLetters.join(
|
|
632
632
|
""
|
|
633
|
-
)}
|
|
633
|
+
)}${present}${absent}${presentWithoutIndex}${pinyinsCorrectInfo}${pinyinsPresentInfo}${pinyinsAbsentInfo}${pinyinsPresentWithIndexInfo}${tonesCorrectInfo}${tonesPresentInfo}${tonesAbsentInfo}${tonesPresentWithIndexInfo}`;
|
|
634
634
|
}
|
|
635
635
|
).join("\n");
|
|
636
636
|
}
|
|
@@ -642,9 +642,9 @@ async function processExtraGameRecords(g, channelId) {
|
|
|
642
642
|
);
|
|
643
643
|
const resultStrings = extraGameInfos.map((info) => {
|
|
644
644
|
return `
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
645
|
+
答案 ${info.wordGuess}${info.wordAnswerChineseDefinition !== "" ? `${info.pinyin === "" ? "" : `
|
|
646
|
+
拼音 ${info.pinyin}`}
|
|
647
|
+
释义
|
|
648
648
|
${replaceEscapeCharacters(
|
|
649
649
|
info.wordAnswerChineseDefinition
|
|
650
650
|
)}` : ""}`;
|
|
@@ -714,13 +714,13 @@ __name(getSessionUserName, "getSessionUserName");
|
|
|
714
714
|
// src/commands/basic.ts
|
|
715
715
|
function register(g) {
|
|
716
716
|
const { ctx, config } = g;
|
|
717
|
-
ctx.command("wordle", "
|
|
717
|
+
ctx.command("wordle", "猜单词 · 多词库多模式").alias("wordleGame").action(async ({ session }) => {
|
|
718
718
|
let { userId, username } = session;
|
|
719
719
|
username = await getSessionUserName(g, session);
|
|
720
720
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
721
721
|
await session.execute(`wordle -h`);
|
|
722
722
|
});
|
|
723
|
-
ctx.command("wordle.玩法介绍", "
|
|
723
|
+
ctx.command("wordle.玩法介绍", "查看玩法介绍").action(async ({ session }) => {
|
|
724
724
|
let { userId, username } = session;
|
|
725
725
|
username = await getSessionUserName(g, session);
|
|
726
726
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -13724,9 +13724,9 @@ function calculateGameDuration(startTime, currentTime) {
|
|
|
13724
13724
|
const minutes = Math.floor(elapsedSeconds / 60);
|
|
13725
13725
|
const seconds = elapsedSeconds % 60;
|
|
13726
13726
|
if (minutes > 0) {
|
|
13727
|
-
return
|
|
13727
|
+
return `用时 ${minutes} 分 ${seconds} 秒`;
|
|
13728
13728
|
} else {
|
|
13729
|
-
return
|
|
13729
|
+
return `用时 ${seconds} 秒`;
|
|
13730
13730
|
}
|
|
13731
13731
|
}
|
|
13732
13732
|
__name(calculateGameDuration, "calculateGameDuration");
|
|
@@ -14018,31 +14018,31 @@ function getValidGuessWordLengthRange(command) {
|
|
|
14018
14018
|
}
|
|
14019
14019
|
switch (command) {
|
|
14020
14020
|
case "CET4":
|
|
14021
|
-
return "
|
|
14021
|
+
return "1~15";
|
|
14022
14022
|
case "CET6":
|
|
14023
|
-
return "
|
|
14023
|
+
return "3~16、18";
|
|
14024
14024
|
case "GMAT":
|
|
14025
|
-
return "
|
|
14025
|
+
return "3~18";
|
|
14026
14026
|
case "GRE":
|
|
14027
|
-
return "
|
|
14027
|
+
return "1、3~16";
|
|
14028
14028
|
case "IELTS":
|
|
14029
|
-
return "
|
|
14029
|
+
return "2~15、17";
|
|
14030
14030
|
case "SAT":
|
|
14031
|
-
return "
|
|
14031
|
+
return "3~16";
|
|
14032
14032
|
case "TOEFL":
|
|
14033
|
-
return "
|
|
14033
|
+
return "2~17、20";
|
|
14034
14034
|
case "考研":
|
|
14035
|
-
return "
|
|
14035
|
+
return "2~15";
|
|
14036
14036
|
case "专八":
|
|
14037
|
-
return "
|
|
14037
|
+
return "1~18";
|
|
14038
14038
|
case "专四":
|
|
14039
|
-
return "
|
|
14039
|
+
return "2~16、18";
|
|
14040
14040
|
case "ALL":
|
|
14041
|
-
return "
|
|
14041
|
+
return "1~35、45、52";
|
|
14042
14042
|
case "Numberle":
|
|
14043
|
-
return "
|
|
14043
|
+
return "1~35";
|
|
14044
14044
|
case "Math":
|
|
14045
|
-
return "
|
|
14045
|
+
return "5~12";
|
|
14046
14046
|
default:
|
|
14047
14047
|
return "";
|
|
14048
14048
|
}
|
|
@@ -14062,9 +14062,9 @@ function generateStatsInfo(stats, fastestGuessTime) {
|
|
|
14062
14062
|
}
|
|
14063
14063
|
__name(generateStatsInfo, "generateStatsInfo");
|
|
14064
14064
|
function generateGameEndMessage(gameInfo) {
|
|
14065
|
-
return
|
|
14066
|
-
|
|
14067
|
-
|
|
14065
|
+
return `答案 ${gameInfo.wordGuess}${gameInfo.wordAnswerChineseDefinition !== "" ? `${gameInfo.pinyin === "" ? "" : `
|
|
14066
|
+
拼音 ${gameInfo.pinyin}`}
|
|
14067
|
+
释义
|
|
14068
14068
|
${replaceEscapeCharacters(
|
|
14069
14069
|
gameInfo.wordAnswerChineseDefinition
|
|
14070
14070
|
)}` : ""}`;
|
|
@@ -14112,7 +14112,7 @@ function register2(g) {
|
|
|
14112
14112
|
await session.execute(`wordle.猜 ${content}`);
|
|
14113
14113
|
return;
|
|
14114
14114
|
});
|
|
14115
|
-
ctx.command("wordle.结束", "
|
|
14115
|
+
ctx.command("wordle.结束", "结束当前对局").action(async ({ session }) => {
|
|
14116
14116
|
let { channelId, userId, username, timestamp } = session;
|
|
14117
14117
|
username = await getSessionUserName(g, session);
|
|
14118
14118
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -14121,7 +14121,8 @@ function register2(g) {
|
|
|
14121
14121
|
return await sendMessage(
|
|
14122
14122
|
g,
|
|
14123
14123
|
session,
|
|
14124
|
-
|
|
14124
|
+
`💡 本频道没有进行中的对局。
|
|
14125
|
+
发送「wordle.开始」开一局。`
|
|
14125
14126
|
);
|
|
14126
14127
|
}
|
|
14127
14128
|
await updatePlayerRecordsLose(g, channelId, gameInfo);
|
|
@@ -14131,10 +14132,10 @@ ${await processExtraGameRecords(g, channelId)}` : "";
|
|
|
14131
14132
|
Number(gameInfo.timestamp),
|
|
14132
14133
|
timestamp
|
|
14133
14134
|
);
|
|
14134
|
-
const message =
|
|
14135
|
-
游戏已结束!
|
|
14135
|
+
const message = `✅ 本局已结束
|
|
14136
14136
|
${duration}${gameInfo.isAbsurd ? "" : `
|
|
14137
|
-
${generateGameEndMessage(gameInfo)}`}${processedResult}
|
|
14137
|
+
${generateGameEndMessage(gameInfo)}`}${processedResult}
|
|
14138
|
+
发送「wordle.开始」再来一局。`;
|
|
14138
14139
|
await sendMessage(
|
|
14139
14140
|
g,
|
|
14140
14141
|
session,
|
|
@@ -14143,7 +14144,7 @@ ${generateGameEndMessage(gameInfo)}`}${processedResult}`;
|
|
|
14143
14144
|
await endGame(g, channelId);
|
|
14144
14145
|
return;
|
|
14145
14146
|
});
|
|
14146
|
-
ctx.command("wordle.开始 [guessWordLength:number]", "
|
|
14147
|
+
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> 同时猜测多个单词", {
|
|
14147
14148
|
fallback: 1
|
|
14148
14149
|
}).action(async ({ session, options }, guessWordLength) => {
|
|
14149
14150
|
let { channelId, userId, username } = session;
|
|
@@ -14153,7 +14154,7 @@ ${generateGameEndMessage(gameInfo)}`}${processedResult}`;
|
|
|
14153
14154
|
return await sendMessage(
|
|
14154
14155
|
g,
|
|
14155
14156
|
session,
|
|
14156
|
-
`⚠️ 同时猜测的数量须在 1
|
|
14157
|
+
`⚠️ 同时猜测的数量须在 1 到 ${config.maxSimultaneousGuesses} 之间。`
|
|
14157
14158
|
);
|
|
14158
14159
|
}
|
|
14159
14160
|
const gameInfo = await getGameInfo(g, channelId);
|
|
@@ -14161,23 +14162,26 @@ ${generateGameEndMessage(gameInfo)}`}${processedResult}`;
|
|
|
14161
14162
|
return await sendMessage(
|
|
14162
14163
|
g,
|
|
14163
14164
|
session,
|
|
14164
|
-
`⚠️
|
|
14165
|
+
`⚠️ 本频道已有对局正在进行
|
|
14166
|
+
发送「wordle.结束」收掉这一局,再开新的。`
|
|
14165
14167
|
);
|
|
14166
14168
|
}
|
|
14167
14169
|
await sendMessage(
|
|
14168
14170
|
g,
|
|
14169
14171
|
session,
|
|
14170
|
-
|
|
14172
|
+
`💡 可选模式
|
|
14171
14173
|
${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
14172
|
-
|
|
14174
|
+
发送序号或模式名即可开局,或发送「取消」。`
|
|
14173
14175
|
);
|
|
14174
14176
|
const userInput = await session.prompt();
|
|
14175
14177
|
if (!userInput)
|
|
14176
14178
|
return await sendMessage(
|
|
14177
14179
|
g,
|
|
14178
14180
|
session,
|
|
14179
|
-
|
|
14181
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
14180
14182
|
);
|
|
14183
|
+
if (userInput.trim() === "取消")
|
|
14184
|
+
return await sendMessage(g, session, `✅ 已取消开局。`);
|
|
14181
14185
|
const selectedExam = isNaN(parseInt(userInput)) ? userInput.toUpperCase().trim() : exams[parseInt(userInput) - 1].toUpperCase();
|
|
14182
14186
|
const examsInUpperCase = exams.map((exam) => exam.toUpperCase());
|
|
14183
14187
|
if (examsInUpperCase.includes(selectedExam)) {
|
|
@@ -14186,18 +14190,20 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
14186
14190
|
await sendMessage(
|
|
14187
14191
|
g,
|
|
14188
14192
|
session,
|
|
14189
|
-
|
|
14193
|
+
`💡 可选长度 ${getValidGuessWordLengthRange(
|
|
14190
14194
|
selectedExam
|
|
14191
14195
|
)}
|
|
14192
|
-
|
|
14196
|
+
发送一个长度即可开局,或发送「取消」。`
|
|
14193
14197
|
);
|
|
14194
14198
|
const userInput2 = await session.prompt();
|
|
14195
14199
|
if (!userInput2)
|
|
14196
14200
|
return await sendMessage(
|
|
14197
14201
|
g,
|
|
14198
14202
|
session,
|
|
14199
|
-
|
|
14203
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
14200
14204
|
);
|
|
14205
|
+
if (userInput2.trim() === "取消")
|
|
14206
|
+
return await sendMessage(g, session, `✅ 已取消开局。`);
|
|
14201
14207
|
guessWordLength = parseInt(userInput2);
|
|
14202
14208
|
} else {
|
|
14203
14209
|
guessWordLength = config.defaultWordLengthForGuessing;
|
|
@@ -14214,7 +14220,8 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
14214
14220
|
return await sendMessage(
|
|
14215
14221
|
g,
|
|
14216
14222
|
session,
|
|
14217
|
-
`⚠️
|
|
14223
|
+
`⚠️ 认不出这个模式
|
|
14224
|
+
发送上面列出的序号或模式名。`
|
|
14218
14225
|
);
|
|
14219
14226
|
}
|
|
14220
14227
|
});
|
|
@@ -14228,7 +14235,7 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
14228
14235
|
return await sendMessage(
|
|
14229
14236
|
g,
|
|
14230
14237
|
session,
|
|
14231
|
-
`⚠️ 同时猜测的数量须在 1
|
|
14238
|
+
`⚠️ 同时猜测的数量须在 1 到 ${config.maxSimultaneousGuesses} 之间。`
|
|
14232
14239
|
);
|
|
14233
14240
|
}
|
|
14234
14241
|
const gameInfo = await getGameInfo(g, channelId);
|
|
@@ -14236,7 +14243,8 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
14236
14243
|
return await sendMessage(
|
|
14237
14244
|
g,
|
|
14238
14245
|
session,
|
|
14239
|
-
`⚠️
|
|
14246
|
+
`⚠️ 本频道已有对局正在进行
|
|
14247
|
+
发送「wordle.结束」收掉这一局,再开新的。`
|
|
14240
14248
|
);
|
|
14241
14249
|
}
|
|
14242
14250
|
const selectedWords = [];
|
|
@@ -14322,21 +14330,21 @@ ${exams.map((exam, index) => `${index + 1}. ${exam}`).join("\n")}
|
|
|
14322
14330
|
const htmlImgString = generateImageTags(imageBuffers);
|
|
14323
14331
|
imageBuffer = await generateWordlesImage(g, htmlImgString);
|
|
14324
14332
|
}
|
|
14325
|
-
const gameMode =
|
|
14333
|
+
const gameMode = `经典${wordlesNum > 1 ? `(x${wordlesNum})` : ""}${isHardMode ? `(${isUltraHardMode ? "超" : ""}困难)` : ""}${isAbsurdMode ? `(变态${isChallengeMode ? "挑战" : ""})` : ""}`;
|
|
14326
14334
|
const targetWord = isChallengeMode ? `
|
|
14327
|
-
|
|
14328
|
-
const
|
|
14329
|
-
|
|
14330
|
-
|
|
14335
|
+
目标单词 ${randomWord}` : "";
|
|
14336
|
+
const facts = [
|
|
14337
|
+
"单词长度 5",
|
|
14338
|
+
`机会 ${isAbsurdMode ? "无限" : `${6 + wordlesNum - 1}`} 次`,
|
|
14339
|
+
"候选 2315 个"
|
|
14340
|
+
].join(" · ");
|
|
14331
14341
|
const timeLimit = config.enableWordGuessTimeLimit ? `
|
|
14332
|
-
|
|
14342
|
+
作答时间 ${config.wordGuessTimeLimitInSeconds} 秒` : "";
|
|
14333
14343
|
const image = import_koishi3.h.image(imageBuffer, `image/${config.imageType}`);
|
|
14334
|
-
const message =
|
|
14335
|
-
|
|
14336
|
-
${
|
|
14337
|
-
|
|
14338
|
-
${wordCount}${timeLimit}
|
|
14339
|
-
${image}`;
|
|
14344
|
+
const message = `✅ 对局开始 · ${gameMode}${isChallengeMode ? targetWord : ""}
|
|
14345
|
+
${facts}${timeLimit}
|
|
14346
|
+
${image}
|
|
14347
|
+
直接发送单词即可猜测。`;
|
|
14340
14348
|
return await sendMessage(g, session, message);
|
|
14341
14349
|
});
|
|
14342
14350
|
exams.forEach((exam) => {
|
|
@@ -14345,12 +14353,12 @@ ${image}`;
|
|
|
14345
14353
|
}
|
|
14346
14354
|
ctx.command(
|
|
14347
14355
|
`wordle.开始.${exam} [guessWordLength:number]`,
|
|
14348
|
-
|
|
14356
|
+
`以${exam}模式开局`
|
|
14349
14357
|
).option("free", "--free 自由模式(仅限汉兜与词影)", {
|
|
14350
14358
|
fallback: false
|
|
14351
14359
|
}).option("all", "--all 全成语模式(仅限汉兜与词影)", {
|
|
14352
14360
|
fallback: false
|
|
14353
|
-
}).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>
|
|
14361
|
+
}).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> 同时猜测多个词", {
|
|
14354
14362
|
fallback: 1
|
|
14355
14363
|
}).action(async ({ session, options }, guessWordLength) => {
|
|
14356
14364
|
let { channelId, userId, username, timestamp } = session;
|
|
@@ -14361,18 +14369,20 @@ ${image}`;
|
|
|
14361
14369
|
await sendMessage(
|
|
14362
14370
|
g,
|
|
14363
14371
|
session,
|
|
14364
|
-
|
|
14372
|
+
`💡 可选长度 ${getValidGuessWordLengthRange(
|
|
14365
14373
|
exam
|
|
14366
14374
|
)}
|
|
14367
|
-
|
|
14375
|
+
发送一个长度即可开局,或发送「取消」。`
|
|
14368
14376
|
);
|
|
14369
14377
|
const userInput = await session.prompt();
|
|
14370
14378
|
if (!userInput)
|
|
14371
14379
|
return await sendMessage(
|
|
14372
14380
|
g,
|
|
14373
14381
|
session,
|
|
14374
|
-
|
|
14382
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
14375
14383
|
);
|
|
14384
|
+
if (userInput.trim() === "取消")
|
|
14385
|
+
return await sendMessage(g, session, `✅ 已取消开局。`);
|
|
14376
14386
|
guessWordLength = parseInt(userInput);
|
|
14377
14387
|
} else {
|
|
14378
14388
|
guessWordLength = config.defaultWordLengthForGuessing;
|
|
@@ -14382,17 +14392,17 @@ ${image}`;
|
|
|
14382
14392
|
return await sendMessage(
|
|
14383
14393
|
g,
|
|
14384
14394
|
session,
|
|
14385
|
-
`⚠️ 同时猜测的数量须在 1
|
|
14395
|
+
`⚠️ 同时猜测的数量须在 1 到 ${config.maxSimultaneousGuesses} 之间。`
|
|
14386
14396
|
);
|
|
14387
14397
|
}
|
|
14388
14398
|
if (typeof guessWordLength !== "number" || !isValidGuessWordLength(exam, guessWordLength) && exam !== "Lewdle" && exam !== "汉兜" && exam !== "词影") {
|
|
14389
14399
|
return await sendMessage(
|
|
14390
14400
|
g,
|
|
14391
14401
|
session,
|
|
14392
|
-
|
|
14393
|
-
${exam}
|
|
14402
|
+
`⚠️ 长度不在可选范围内
|
|
14403
|
+
${exam} 的可选长度是 ${getValidGuessWordLengthRange(
|
|
14394
14404
|
exam
|
|
14395
|
-
)}
|
|
14405
|
+
)}。`
|
|
14396
14406
|
);
|
|
14397
14407
|
}
|
|
14398
14408
|
const gameInfo = await getGameInfo(g, channelId);
|
|
@@ -14400,7 +14410,8 @@ ${exam} 长度可选值范围:${getValidGuessWordLengthRange(
|
|
|
14400
14410
|
return await sendMessage(
|
|
14401
14411
|
g,
|
|
14402
14412
|
session,
|
|
14403
|
-
`⚠️
|
|
14413
|
+
`⚠️ 本频道已有对局正在进行
|
|
14414
|
+
发送「wordle.结束」收掉这一局,再开新的。`
|
|
14404
14415
|
);
|
|
14405
14416
|
}
|
|
14406
14417
|
const selectedWords = [];
|
|
@@ -14577,34 +14588,37 @@ ${exam} 长度可选值范围:${getValidGuessWordLengthRange(
|
|
|
14577
14588
|
const htmlImgString = generateImageTags(imageBuffers);
|
|
14578
14589
|
imageBuffer = await generateWordlesImage(g, htmlImgString);
|
|
14579
14590
|
}
|
|
14580
|
-
const gameMode =
|
|
14581
|
-
当前游戏模式为:【${exam}${wordlesNum > 1 ? `(x${wordlesNum})` : ""}${isFreeMode && exam === "汉兜" || isFreeMode && exam === "词影" ? `(自由)` : ""}${isHardMode ? `(${isUltraHardMode ? "超" : ""}困难)` : ""}${isAbsurdMode ? `(变态${isChallengeMode ? "挑战" : ""})` : ""}】`;
|
|
14591
|
+
const gameMode = `✅ 对局开始 · ${exam}${wordlesNum > 1 ? `(x${wordlesNum})` : ""}${isFreeMode && exam === "汉兜" || isFreeMode && exam === "词影" ? `(自由)` : ""}${isHardMode ? `(${isUltraHardMode ? "超" : ""}困难)` : ""}${isAbsurdMode ? `(变态${isChallengeMode ? "挑战" : ""})` : ""}`;
|
|
14582
14592
|
const challengeInfo = isChallengeMode ? `
|
|
14583
|
-
|
|
14584
|
-
const
|
|
14585
|
-
const
|
|
14586
|
-
const
|
|
14593
|
+
目标单词 ${randomWord}` : "";
|
|
14594
|
+
const subject = exam === "汉兜" || exam === "词影" ? "词语" : exam === "Numberle" ? "数字" : exam === "Math" ? "方程式" : "单词";
|
|
14595
|
+
const wordLength = `${subject}长度 ${guessWordLength}`;
|
|
14596
|
+
const guessChance = `机会 ${isAbsurdMode ? "无限" : exam === "汉兜" ? `${10 + wordlesNum - 1}` : exam === "Math" ? `${6 + wordlesNum - 1}` : exam === "词影" ? `${6 + wordlesNum - 1}` : guessWordLength + 1 + wordlesNum - 1} 次`;
|
|
14597
|
+
const wordCount2 = exam === "汉兜" || exam === "词影" ? `候选 ${options.all ? idiomsList.length : commonIdiomsList_default.length} 条` : exam === "Math" ? `候选 ${equations[guessWordLength].length} 个` : `候选 ${exam === "Lewdle" ? "1000" : wordCount} 个`;
|
|
14587
14598
|
const timeLimit = config.enableWordGuessTimeLimit ? `
|
|
14588
|
-
|
|
14599
|
+
作答时间 ${config.wordGuessTimeLimitInSeconds} 秒` : "";
|
|
14589
14600
|
const image = import_koishi3.h.image(imageBuffer, `image/${config.imageType}`);
|
|
14601
|
+
const tail = `
|
|
14602
|
+
直接发送${subject}即可猜测。`;
|
|
14590
14603
|
if (exam === "汉兜" || exam === "词影") {
|
|
14591
14604
|
return await sendMessage(
|
|
14592
14605
|
g,
|
|
14593
14606
|
session,
|
|
14594
14607
|
`${gameMode}
|
|
14595
|
-
${guessChance}
|
|
14596
|
-
${
|
|
14597
|
-
${image}`
|
|
14608
|
+
${[guessChance, wordCount2].join(" · ")}${timeLimit}
|
|
14609
|
+
${image}${tail}`
|
|
14598
14610
|
);
|
|
14599
14611
|
} else {
|
|
14600
14612
|
return await sendMessage(
|
|
14601
14613
|
g,
|
|
14602
14614
|
session,
|
|
14603
14615
|
`${gameMode}${challengeInfo}
|
|
14604
|
-
${
|
|
14605
|
-
|
|
14606
|
-
|
|
14607
|
-
|
|
14616
|
+
${[
|
|
14617
|
+
wordLength,
|
|
14618
|
+
guessChance,
|
|
14619
|
+
...exam === "Numberle" ? [] : [wordCount2]
|
|
14620
|
+
].join(" · ")}${timeLimit}
|
|
14621
|
+
${image}${tail}`
|
|
14608
14622
|
);
|
|
14609
14623
|
}
|
|
14610
14624
|
});
|
|
@@ -14618,7 +14632,7 @@ ${image}`
|
|
|
14618
14632
|
return await sendMessage(
|
|
14619
14633
|
g,
|
|
14620
14634
|
session,
|
|
14621
|
-
`⏳
|
|
14635
|
+
`⏳ 上一次猜测还在处理,稍等一下。`
|
|
14622
14636
|
);
|
|
14623
14637
|
}
|
|
14624
14638
|
await setGuessRunningStatus(g, channelId, true);
|
|
@@ -14629,7 +14643,8 @@ ${image}`
|
|
|
14629
14643
|
return await sendMessage(
|
|
14630
14644
|
g,
|
|
14631
14645
|
session,
|
|
14632
|
-
|
|
14646
|
+
`💡 本频道没有进行中的对局。
|
|
14647
|
+
发送「wordle.开始」开一局。`
|
|
14633
14648
|
);
|
|
14634
14649
|
}
|
|
14635
14650
|
if (options.random) {
|
|
@@ -14639,20 +14654,20 @@ ${image}`
|
|
|
14639
14654
|
await sendMessage(
|
|
14640
14655
|
g,
|
|
14641
14656
|
session,
|
|
14642
|
-
|
|
14657
|
+
`💡 发送一个猜测词,或发送「取消」。`
|
|
14643
14658
|
);
|
|
14644
14659
|
const userInput = await session.prompt();
|
|
14645
14660
|
if (!userInput)
|
|
14646
14661
|
return await sendMessage(
|
|
14647
14662
|
g,
|
|
14648
14663
|
session,
|
|
14649
|
-
|
|
14664
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
14650
14665
|
);
|
|
14651
14666
|
if (userInput === "取消")
|
|
14652
14667
|
return await sendMessage(
|
|
14653
14668
|
g,
|
|
14654
14669
|
session,
|
|
14655
|
-
`✅
|
|
14670
|
+
`✅ 已取消这次猜测。`
|
|
14656
14671
|
);
|
|
14657
14672
|
inputWord = userInput.trim();
|
|
14658
14673
|
}
|
|
@@ -14663,7 +14678,8 @@ ${image}`
|
|
|
14663
14678
|
await sendMessage(
|
|
14664
14679
|
g,
|
|
14665
14680
|
session,
|
|
14666
|
-
`⏳ 作答超过 ${config.wordGuessTimeLimitInSeconds}
|
|
14681
|
+
`⏳ 作答超过 ${config.wordGuessTimeLimitInSeconds} 秒,本局结束。
|
|
14682
|
+
发送「wordle.开始」再来一局。`
|
|
14667
14683
|
);
|
|
14668
14684
|
await endGame(g, channelId);
|
|
14669
14685
|
return;
|
|
@@ -14698,7 +14714,7 @@ ${image}`
|
|
|
14698
14714
|
return await sendMessage(
|
|
14699
14715
|
g,
|
|
14700
14716
|
session,
|
|
14701
|
-
|
|
14717
|
+
`💡 这个已经猜过了,换一个试试。`
|
|
14702
14718
|
);
|
|
14703
14719
|
}
|
|
14704
14720
|
if (!/^[a-zA-Z]+$/.test(inputWord) && gameMode !== "汉兜" && gameMode !== "词影" && gameMode !== "Numberle" && gameMode !== "Math") {
|
|
@@ -14706,7 +14722,8 @@ ${image}`
|
|
|
14706
14722
|
return await sendMessage(
|
|
14707
14723
|
g,
|
|
14708
14724
|
session,
|
|
14709
|
-
`⚠️
|
|
14725
|
+
`⚠️ 猜测里有非字母字符
|
|
14726
|
+
只用 A-Z 组词再试一次。`
|
|
14710
14727
|
);
|
|
14711
14728
|
}
|
|
14712
14729
|
if (!isFourCharacterIdiom(inputWord) && gameMode === "汉兜" || !isFourCharacterIdiom(inputWord) && gameMode === "词影") {
|
|
@@ -14714,7 +14731,7 @@ ${image}`
|
|
|
14714
14731
|
return await sendMessage(
|
|
14715
14732
|
g,
|
|
14716
14733
|
session,
|
|
14717
|
-
`⚠️
|
|
14734
|
+
`⚠️ 这里只收四字词语。`
|
|
14718
14735
|
);
|
|
14719
14736
|
}
|
|
14720
14737
|
if (gameMode === "Numberle" && (!isNumericString(inputWord) || inputWord.length !== guessWordLength)) {
|
|
@@ -14722,7 +14739,7 @@ ${image}`
|
|
|
14722
14739
|
return await sendMessage(
|
|
14723
14740
|
g,
|
|
14724
14741
|
session,
|
|
14725
|
-
`⚠️
|
|
14742
|
+
`⚠️ 数字长度不对,这一局要 ${guessWordLength} 位。`
|
|
14726
14743
|
);
|
|
14727
14744
|
}
|
|
14728
14745
|
if (gameMode === "Math" && (!isMathEquationValid(inputWord) || inputWord.length !== guessWordLength)) {
|
|
@@ -14730,22 +14747,24 @@ ${image}`
|
|
|
14730
14747
|
return await sendMessage(
|
|
14731
14748
|
g,
|
|
14732
14749
|
session,
|
|
14733
|
-
`⚠️
|
|
14750
|
+
`⚠️ 这不是一个成立的方程式
|
|
14751
|
+
只用 0-9 与 + - * / =,且等式两边要相等。`
|
|
14734
14752
|
);
|
|
14735
14753
|
}
|
|
14736
14754
|
if (inputWord.length !== gameInfo.guessWordLength && gameMode !== "汉兜" && gameMode !== "词影" && gameMode !== "Numberle" && gameMode !== "Math") {
|
|
14737
14755
|
await setGuessRunningStatus(g, channelId, false);
|
|
14738
14756
|
const usernameMention = ``;
|
|
14739
|
-
const inputLengthMessage = `⚠️
|
|
14757
|
+
const inputLengthMessage = `⚠️ 单词长度不对
|
|
14758
|
+
「${inputWord}」有 ${inputWord.length} 个字母,这一局要 ${gameInfo.guessWordLength} 个。`;
|
|
14740
14759
|
const presentLettersWithoutAsterisk = uniqueSortedLowercaseLetters(presentLetters);
|
|
14741
14760
|
const processedResult = wordlesNum > 1 ? "\n" + await processExtraGameInfos(g, channelId) : "";
|
|
14742
14761
|
const progressMessage = `当前${calculateGameDuration(
|
|
14743
14762
|
Number(gameInfo.timestamp),
|
|
14744
14763
|
timestamp
|
|
14745
14764
|
)}
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14765
|
+
当前进度 ${correctLetters.join("")}${presentLettersWithoutAsterisk.length === 0 ? `` : `
|
|
14766
|
+
包含字母 ${presentLettersWithoutAsterisk}`}${absentLetters.length === 0 ? "" : `
|
|
14767
|
+
不包含字母 ${absentLetters}`}${processedResult}`;
|
|
14749
14768
|
return await sendMessage(
|
|
14750
14769
|
g,
|
|
14751
14770
|
session,
|
|
@@ -14762,7 +14781,7 @@ ${progressMessage}`
|
|
|
14762
14781
|
return await sendMessage(
|
|
14763
14782
|
g,
|
|
14764
14783
|
session,
|
|
14765
|
-
`⚠️
|
|
14784
|
+
`⚠️ 词库里没有这个单词,换一个试试。`
|
|
14766
14785
|
);
|
|
14767
14786
|
}
|
|
14768
14787
|
}
|
|
@@ -14773,8 +14792,8 @@ ${progressMessage}`
|
|
|
14773
14792
|
return await sendMessage(
|
|
14774
14793
|
g,
|
|
14775
14794
|
session,
|
|
14776
|
-
|
|
14777
|
-
|
|
14795
|
+
`⚠️ 词影的笔画库里还没有这个字
|
|
14796
|
+
换一个常见些的字试试。`
|
|
14778
14797
|
);
|
|
14779
14798
|
}
|
|
14780
14799
|
if (!isIdiomInList(inputWord, idiomsList) && !isFreeMode) {
|
|
@@ -14784,7 +14803,7 @@ ${progressMessage}`
|
|
|
14784
14803
|
return await sendMessage(
|
|
14785
14804
|
g,
|
|
14786
14805
|
session,
|
|
14787
|
-
`⚠️
|
|
14806
|
+
`⚠️ 汉典里查不到这个四字词语,换一个试试。`
|
|
14788
14807
|
);
|
|
14789
14808
|
} else {
|
|
14790
14809
|
userInputPinyin = idiomInfo.pinyin;
|
|
@@ -14823,7 +14842,7 @@ ${progressMessage}`
|
|
|
14823
14842
|
return await sendMessage(
|
|
14824
14843
|
g,
|
|
14825
14844
|
session,
|
|
14826
|
-
`⚠️
|
|
14845
|
+
`⚠️ 汉典里查不到这个四字词语,换一个试试。`
|
|
14827
14846
|
);
|
|
14828
14847
|
} else {
|
|
14829
14848
|
userInputPinyin = idiomInfo.pinyin;
|
|
@@ -14868,18 +14887,17 @@ ${progressMessage}`
|
|
|
14868
14887
|
if (isInputWordWrong) {
|
|
14869
14888
|
await setGuessRunningStatus(g, channelId, false);
|
|
14870
14889
|
const difficulty = isUltraHardMode ? "超困难" : "困难";
|
|
14871
|
-
const rule =
|
|
14872
|
-
|
|
14873
|
-
const message =
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
要求:【${correctLetters.join(
|
|
14890
|
+
const rule = `绿色线索必须保持在原位,黄色线索必须继续使用。${isUltraHardMode ? `
|
|
14891
|
+
黄色线索要避开已经排除的位置,灰色线索不得再用。` : ""}`;
|
|
14892
|
+
const message = `⚠️ 这个词不符合${difficulty}模式的要求
|
|
14893
|
+
${rule}
|
|
14894
|
+
你的输入 ${inputWord}
|
|
14895
|
+
要求 ${correctLetters.join(
|
|
14878
14896
|
""
|
|
14879
|
-
)}
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14897
|
+
)}${presentLetters.length === 0 ? `` : `
|
|
14898
|
+
包含 ${presentLetters}`}${absentLetters.length === 0 || !isUltraHardMode ? `` : `
|
|
14899
|
+
不包含 ${absentLetters}`}${presentLettersWithIndex.length === 0 || !isUltraHardMode ? `` : `
|
|
14900
|
+
避开黄色线索 ${presentLettersWithIndex.join("、")}`}`;
|
|
14883
14901
|
return await sendMessage(g, session, message);
|
|
14884
14902
|
}
|
|
14885
14903
|
}
|
|
@@ -14937,7 +14955,8 @@ ${progressMessage}`
|
|
|
14937
14955
|
await sendMessage(
|
|
14938
14956
|
g,
|
|
14939
14957
|
session,
|
|
14940
|
-
|
|
14958
|
+
`💡 按现有线索,已经没有可用的单词了,本局到此为止。
|
|
14959
|
+
发送「wordle.开始」再来一局。`
|
|
14941
14960
|
);
|
|
14942
14961
|
await endGame(g, channelId);
|
|
14943
14962
|
return;
|
|
@@ -14966,17 +14985,13 @@ ${progressMessage}`
|
|
|
14966
14985
|
await sendMessage(
|
|
14967
14986
|
g,
|
|
14968
14987
|
session,
|
|
14969
|
-
|
|
14970
|
-
它不再是可能的秘密单词!
|
|
14988
|
+
`⚠️ 目标单词 ${targetWord} 已经不可能是答案了
|
|
14971
14989
|
${import_koishi3.h.image(
|
|
14972
14990
|
imageBuffer2,
|
|
14973
14991
|
`image/${config.imageType}`
|
|
14974
14992
|
)}
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
【撤销】:回到上一步。
|
|
14978
|
-
|
|
14979
|
-
注意:无效输入将自动选择【撤销】操作。`
|
|
14993
|
+
发送「撤销」回到上一步,或发送「结束」收掉这一局。
|
|
14994
|
+
没有等到有效输入时,按「撤销」处理。`
|
|
14980
14995
|
);
|
|
14981
14996
|
let userInput = await session.prompt();
|
|
14982
14997
|
const imageBuffer22 = await generateImage(
|
|
@@ -14990,8 +15005,7 @@ ${emptyGridHtml}`
|
|
|
14990
15005
|
return await sendMessage(
|
|
14991
15006
|
g,
|
|
14992
15007
|
session,
|
|
14993
|
-
|
|
14994
|
-
已自动选择【撤销】操作。
|
|
15008
|
+
`⏳ 没有等到有效输入,已按「撤销」处理。
|
|
14995
15009
|
${import_koishi3.h.image(
|
|
14996
15010
|
imageBuffer22,
|
|
14997
15011
|
`image/${config.imageType}`
|
|
@@ -15218,12 +15232,11 @@ ${await processExtraGameRecords(g, channelId)}` : "";
|
|
|
15218
15232
|
timestamp
|
|
15219
15233
|
);
|
|
15220
15234
|
const imageType = config.imageType;
|
|
15221
|
-
const message =
|
|
15222
|
-
太棒了,你猜出来了!
|
|
15235
|
+
const message = `🏆 猜出来了!
|
|
15223
15236
|
${gameDuration}
|
|
15224
15237
|
${import_koishi3.h.image(imageBuffer, `image/${imageType}`)}
|
|
15225
15238
|
${generateGameEndMessage(gameInfo)}${processedResult}
|
|
15226
|
-
|
|
15239
|
+
发送「wordle.开始」再来一局。`;
|
|
15227
15240
|
await sendMessage(
|
|
15228
15241
|
g,
|
|
15229
15242
|
session,
|
|
@@ -15237,19 +15250,20 @@ ${generateGameEndMessage(gameInfo)}${processedResult}
|
|
|
15237
15250
|
const processedResult = wordlesNum > 1 ? `
|
|
15238
15251
|
${await processExtraGameRecords(g, channelId)}` : "";
|
|
15239
15252
|
const challengeMessage = isChallengeMode ? `
|
|
15240
|
-
|
|
15253
|
+
目标单词 ${targetWord} 已经不可能是答案了。` : "";
|
|
15241
15254
|
const answerInfo = isChallengeMode ? "" : `
|
|
15242
15255
|
${generateGameEndMessage(gameInfo)}`;
|
|
15243
15256
|
const gameDuration = calculateGameDuration(
|
|
15244
15257
|
Number(gameInfo.timestamp),
|
|
15245
15258
|
timestamp
|
|
15246
15259
|
);
|
|
15247
|
-
const message =
|
|
15260
|
+
const message = `✅ 本局结束,这次没有猜出来。${challengeMessage}
|
|
15248
15261
|
${import_koishi3.h.image(
|
|
15249
15262
|
imageBuffer,
|
|
15250
15263
|
`image/${config.imageType}`
|
|
15251
15264
|
)}
|
|
15252
|
-
${gameDuration}${answerInfo}${processedResult}
|
|
15265
|
+
${gameDuration}${answerInfo}${processedResult}
|
|
15266
|
+
发送「wordle.开始」再来一局。`;
|
|
15253
15267
|
await sendMessage(
|
|
15254
15268
|
g,
|
|
15255
15269
|
session,
|
|
@@ -15272,7 +15286,7 @@ __name(register2, "register");
|
|
|
15272
15286
|
// src/commands/lookup.ts
|
|
15273
15287
|
function register3(g) {
|
|
15274
15288
|
const { ctx } = g;
|
|
15275
|
-
ctx.command("wordle.查单词 [targetWord:text]", "
|
|
15289
|
+
ctx.command("wordle.查单词 [targetWord:text]", "引导式查单词").action(async ({ session, options }, targetWord) => {
|
|
15276
15290
|
if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
|
|
15277
15291
|
if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
|
|
15278
15292
|
targetWord = session.event.message.quote.content.trim();
|
|
@@ -15288,17 +15302,19 @@ function register3(g) {
|
|
|
15288
15302
|
await sendMessage(
|
|
15289
15303
|
g,
|
|
15290
15304
|
session,
|
|
15291
|
-
|
|
15305
|
+
`💡 可用词库
|
|
15292
15306
|
${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionary}`).join("\n")}
|
|
15293
|
-
|
|
15307
|
+
发送序号或词库名即可查询,或发送「取消」。`
|
|
15294
15308
|
);
|
|
15295
15309
|
const userInput = await session.prompt();
|
|
15296
15310
|
if (!userInput)
|
|
15297
15311
|
return await sendMessage(
|
|
15298
15312
|
g,
|
|
15299
15313
|
session,
|
|
15300
|
-
|
|
15314
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
15301
15315
|
);
|
|
15316
|
+
if (userInput.trim() === "取消")
|
|
15317
|
+
return await sendMessage(g, session, `✅ 已取消。`);
|
|
15302
15318
|
const selectedDictionary = isNaN(parseInt(userInput)) ? userInput.toLowerCase().trim() : availableDictionaryArrayToLowerCase[parseInt(userInput) - 1];
|
|
15303
15319
|
if (availableDictionaryArrayToLowerCase.includes(selectedDictionary)) {
|
|
15304
15320
|
const command = `wordle.查单词.${selectedDictionary}${targetWord ? ` ${targetWord}` : ""}`;
|
|
@@ -15307,13 +15323,14 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
15307
15323
|
return await sendMessage(
|
|
15308
15324
|
g,
|
|
15309
15325
|
session,
|
|
15310
|
-
`⚠️
|
|
15326
|
+
`⚠️ 认不出这一项
|
|
15327
|
+
发送上面列出的序号或名称。`
|
|
15311
15328
|
);
|
|
15312
15329
|
}
|
|
15313
15330
|
});
|
|
15314
15331
|
ctx.command(
|
|
15315
15332
|
"wordle.查单词.ALL [targetWord:text]",
|
|
15316
|
-
"在ALL
|
|
15333
|
+
"在 ALL 词库查释义(英译中)"
|
|
15317
15334
|
).action(async ({ session }, targetWord) => {
|
|
15318
15335
|
if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
|
|
15319
15336
|
if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
|
|
@@ -15328,20 +15345,20 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
15328
15345
|
await sendMessage(
|
|
15329
15346
|
g,
|
|
15330
15347
|
session,
|
|
15331
|
-
|
|
15348
|
+
`💡 发送要查询的单词,或发送「取消」。`
|
|
15332
15349
|
);
|
|
15333
15350
|
const userInput = await session.prompt();
|
|
15334
15351
|
if (!userInput)
|
|
15335
15352
|
return await sendMessage(
|
|
15336
15353
|
g,
|
|
15337
15354
|
session,
|
|
15338
|
-
|
|
15355
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
15339
15356
|
);
|
|
15340
15357
|
if (userInput === "取消")
|
|
15341
15358
|
return await sendMessage(
|
|
15342
15359
|
g,
|
|
15343
15360
|
session,
|
|
15344
|
-
`✅
|
|
15361
|
+
`✅ 已取消这次查询。`
|
|
15345
15362
|
);
|
|
15346
15363
|
targetWord = userInput.trim();
|
|
15347
15364
|
}
|
|
@@ -15349,7 +15366,8 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
15349
15366
|
return await sendMessage(
|
|
15350
15367
|
g,
|
|
15351
15368
|
session,
|
|
15352
|
-
`⚠️
|
|
15369
|
+
`⚠️ 查询词里有非字母字符
|
|
15370
|
+
只用 A-Z 再试一次。`
|
|
15353
15371
|
);
|
|
15354
15372
|
}
|
|
15355
15373
|
const foundWord = findWord(targetWord);
|
|
@@ -15357,14 +15375,14 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
|
|
|
15357
15375
|
return await sendMessage(
|
|
15358
15376
|
g,
|
|
15359
15377
|
session,
|
|
15360
|
-
`⚠️
|
|
15378
|
+
`⚠️ ALL 词库里没有这个单词
|
|
15379
|
+
换一个拼写试试,或发送「wordle.查单词」换个词库。`
|
|
15361
15380
|
);
|
|
15362
15381
|
}
|
|
15363
15382
|
return sendMessage(
|
|
15364
15383
|
g,
|
|
15365
15384
|
session,
|
|
15366
|
-
|
|
15367
|
-
单词释义如下:
|
|
15385
|
+
`📋 ${targetWord}
|
|
15368
15386
|
${replaceEscapeCharacters(
|
|
15369
15387
|
foundWord.translation
|
|
15370
15388
|
)}`
|
|
@@ -15372,7 +15390,7 @@ ${replaceEscapeCharacters(
|
|
|
15372
15390
|
});
|
|
15373
15391
|
ctx.command(
|
|
15374
15392
|
"wordle.查单词.WordWord [targetWord:text]",
|
|
15375
|
-
"在WordWord
|
|
15393
|
+
"在 WordWord 查定义(英译英)"
|
|
15376
15394
|
).action(async ({ session }, targetWord) => {
|
|
15377
15395
|
if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
|
|
15378
15396
|
if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
|
|
@@ -15387,20 +15405,20 @@ ${replaceEscapeCharacters(
|
|
|
15387
15405
|
await sendMessage(
|
|
15388
15406
|
g,
|
|
15389
15407
|
session,
|
|
15390
|
-
|
|
15408
|
+
`💡 发送要查询的单词,或发送「取消」。`
|
|
15391
15409
|
);
|
|
15392
15410
|
const userInput = await session.prompt();
|
|
15393
15411
|
if (!userInput)
|
|
15394
15412
|
return await sendMessage(
|
|
15395
15413
|
g,
|
|
15396
15414
|
session,
|
|
15397
|
-
|
|
15415
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
15398
15416
|
);
|
|
15399
15417
|
if (userInput === "取消")
|
|
15400
15418
|
return await sendMessage(
|
|
15401
15419
|
g,
|
|
15402
15420
|
session,
|
|
15403
|
-
`✅
|
|
15421
|
+
`✅ 已取消这次查询。`
|
|
15404
15422
|
);
|
|
15405
15423
|
targetWord = userInput.trim();
|
|
15406
15424
|
}
|
|
@@ -15408,7 +15426,8 @@ ${replaceEscapeCharacters(
|
|
|
15408
15426
|
return await sendMessage(
|
|
15409
15427
|
g,
|
|
15410
15428
|
session,
|
|
15411
|
-
`⚠️
|
|
15429
|
+
`⚠️ 查询词里有非字母字符
|
|
15430
|
+
只用 A-Z 再试一次。`
|
|
15412
15431
|
);
|
|
15413
15432
|
}
|
|
15414
15433
|
fetchWordDefinitions(g, targetWord).then((responseData) => {
|
|
@@ -15418,13 +15437,14 @@ ${replaceEscapeCharacters(
|
|
|
15418
15437
|
g,
|
|
15419
15438
|
session,
|
|
15420
15439
|
`${capitalizeFirstLetter(targetWord)} Definitions:
|
|
15421
|
-
${serializedDefinitions ? serializedDefinitions :
|
|
15440
|
+
${serializedDefinitions ? serializedDefinitions : `• 这个单词的定义暂未收录。`}`
|
|
15422
15441
|
);
|
|
15423
15442
|
}).catch((error) => {
|
|
15424
15443
|
return sendMessage(
|
|
15425
15444
|
g,
|
|
15426
15445
|
session,
|
|
15427
|
-
`⚠️
|
|
15446
|
+
`⚠️ WordWord 里没有这个单词
|
|
15447
|
+
换一个拼写试试,或发送「wordle.查单词」换个词库。`
|
|
15428
15448
|
);
|
|
15429
15449
|
});
|
|
15430
15450
|
});
|
|
@@ -15442,20 +15462,20 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
|
|
|
15442
15462
|
await sendMessage(
|
|
15443
15463
|
g,
|
|
15444
15464
|
session,
|
|
15445
|
-
|
|
15465
|
+
`💡 发送要查询的成语,或发送「取消」。`
|
|
15446
15466
|
);
|
|
15447
15467
|
const userInput = await session.prompt();
|
|
15448
15468
|
if (!userInput)
|
|
15449
15469
|
return await sendMessage(
|
|
15450
15470
|
g,
|
|
15451
15471
|
session,
|
|
15452
|
-
|
|
15472
|
+
`⏳ 没有等到有效输入,这次先作罢。`
|
|
15453
15473
|
);
|
|
15454
15474
|
if (userInput === "取消")
|
|
15455
15475
|
return await sendMessage(
|
|
15456
15476
|
g,
|
|
15457
15477
|
session,
|
|
15458
|
-
`✅
|
|
15478
|
+
`✅ 已取消这次查询。`
|
|
15459
15479
|
);
|
|
15460
15480
|
targetIdiom = userInput.trim();
|
|
15461
15481
|
}
|
|
@@ -15463,7 +15483,7 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
|
|
|
15463
15483
|
return await sendMessage(
|
|
15464
15484
|
g,
|
|
15465
15485
|
session,
|
|
15466
|
-
`⚠️
|
|
15486
|
+
`⚠️ 这里只收四字词语。`
|
|
15467
15487
|
);
|
|
15468
15488
|
}
|
|
15469
15489
|
const idiomInfo = await getIdiomInfo(g, targetIdiom);
|
|
@@ -15471,18 +15491,18 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
|
|
|
15471
15491
|
return await sendMessage(
|
|
15472
15492
|
g,
|
|
15473
15493
|
session,
|
|
15474
|
-
`⚠️
|
|
15494
|
+
`⚠️ 汉典里查不到这个成语,换一个试试。`
|
|
15475
15495
|
);
|
|
15476
15496
|
}
|
|
15477
15497
|
return await sendMessage(
|
|
15478
15498
|
g,
|
|
15479
15499
|
session,
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15500
|
+
`📋 ${targetIdiom}
|
|
15501
|
+
拼音 ${idiomInfo.pinyin}
|
|
15502
|
+
解释 ${idiomInfo.explanation}`
|
|
15483
15503
|
);
|
|
15484
15504
|
});
|
|
15485
|
-
ctx.command("wordle
|
|
15505
|
+
ctx.command("wordle.战绩 [targetUser:text]", "查询玩家战绩").action(async ({ session }, targetUser) => {
|
|
15486
15506
|
let { userId, username } = session;
|
|
15487
15507
|
const originalUserId = userId;
|
|
15488
15508
|
username = await getSessionUserName(g, session);
|
|
@@ -15513,17 +15533,15 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
|
|
|
15513
15533
|
return sendMessage(
|
|
15514
15534
|
g,
|
|
15515
15535
|
session,
|
|
15516
|
-
|
|
15536
|
+
`📋 这个用户还没有游戏记录。
|
|
15537
|
+
发送「wordle.开始」开一局,记录就有了。`
|
|
15517
15538
|
);
|
|
15518
15539
|
}
|
|
15519
15540
|
const { win, lose, wordGuessCount, stats, fastestGuessTime } = targetUserRecord[0];
|
|
15520
|
-
const queryInfo = `📋
|
|
15521
|
-
|
|
15522
|
-
|
|
15523
|
-
|
|
15524
|
-
详细统计信息如下:
|
|
15525
|
-
${generateStatsInfo(stats, fastestGuessTime)}
|
|
15526
|
-
`;
|
|
15541
|
+
const queryInfo = `📋 ${targetUserRecord[0].username} 的战绩
|
|
15542
|
+
猜出 ${wordGuessCount} 次 · 胜 ${win} 场 · 负 ${lose} 场
|
|
15543
|
+
|
|
15544
|
+
${generateStatsInfo(stats, fastestGuessTime)}`;
|
|
15527
15545
|
return sendMessage(g, session, queryInfo);
|
|
15528
15546
|
});
|
|
15529
15547
|
}
|
|
@@ -15534,7 +15552,7 @@ var import_cheerio2 = require("cheerio");
|
|
|
15534
15552
|
var import_koishi4 = require("koishi");
|
|
15535
15553
|
function register4(g) {
|
|
15536
15554
|
const { ctx, config } = g;
|
|
15537
|
-
ctx.command("wordle.查询进度", "
|
|
15555
|
+
ctx.command("wordle.查询进度", "查看当前对局进度").action(async ({ session }) => {
|
|
15538
15556
|
let { channelId, userId, username, timestamp } = session;
|
|
15539
15557
|
username = await getSessionUserName(g, session);
|
|
15540
15558
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
@@ -15543,7 +15561,8 @@ function register4(g) {
|
|
|
15543
15561
|
return await sendMessage(
|
|
15544
15562
|
g,
|
|
15545
15563
|
session,
|
|
15546
|
-
|
|
15564
|
+
`💡 本频道没有进行中的对局。
|
|
15565
|
+
发送「wordle.开始」开一局。`
|
|
15547
15566
|
);
|
|
15548
15567
|
}
|
|
15549
15568
|
const {
|
|
@@ -15569,7 +15588,7 @@ function register4(g) {
|
|
|
15569
15588
|
presentTones
|
|
15570
15589
|
} = gameInfo;
|
|
15571
15590
|
const usernameMention = ``;
|
|
15572
|
-
const inputLengthMessage = `待猜${gameMode === "汉兜" || gameMode === "词影" ? "词语" : gameMode === "Numberle" ? "数字" : gameMode === "Math" ? "数学方程式" : "单词"}
|
|
15591
|
+
const inputLengthMessage = `待猜${gameMode === "汉兜" || gameMode === "词影" ? "词语" : gameMode === "Numberle" ? "数字" : gameMode === "Math" ? "数学方程式" : "单词"}长度 ${guessWordLength}`;
|
|
15573
15592
|
const extraGameInfo = wordlesNum > 1 ? `
|
|
15574
15593
|
${await processExtraGameInfos(g, channelId)}` : "";
|
|
15575
15594
|
const gameDuration = calculateGameDuration(
|
|
@@ -15577,39 +15596,39 @@ ${await processExtraGameInfos(g, channelId)}` : "";
|
|
|
15577
15596
|
timestamp
|
|
15578
15597
|
);
|
|
15579
15598
|
const progressInfo = `当前${gameDuration}
|
|
15580
|
-
|
|
15599
|
+
当前进度 ${correctLetters.join(
|
|
15581
15600
|
""
|
|
15582
|
-
)}
|
|
15601
|
+
)}`;
|
|
15583
15602
|
const presentInfo = presentLetters.length !== 0 ? `
|
|
15584
|
-
|
|
15603
|
+
包含 ${presentLetters}` : "";
|
|
15585
15604
|
const absentInfo = absentLetters.length !== 0 ? `
|
|
15586
|
-
|
|
15605
|
+
不包含 ${absentLetters}` : "";
|
|
15587
15606
|
const presentWithIndexInfo = presentLettersWithIndex.length !== 0 ? `
|
|
15588
|
-
|
|
15607
|
+
位置排除 ${presentLettersWithIndex.join("、")}` : "";
|
|
15589
15608
|
const pinyinsCorrectInfo = correctPinyinsWithIndex.length !== 0 ? `
|
|
15590
|
-
|
|
15609
|
+
正确拼音 ${correctPinyinsWithIndex.join("、")}` : "";
|
|
15591
15610
|
const pinyinsPresentInfo = presentPinyins.length !== 0 ? `
|
|
15592
|
-
|
|
15611
|
+
包含拼音 ${presentPinyins.join("、")}` : "";
|
|
15593
15612
|
const pinyinsAbsentInfo = absentPinyins.length !== 0 ? `
|
|
15594
|
-
|
|
15613
|
+
不包含拼音 ${absentPinyins.join("、")}` : "";
|
|
15595
15614
|
const pinyinsPresentWithIndexInfo = presentPinyinsWithIndex.length !== 0 ? `
|
|
15596
|
-
|
|
15615
|
+
拼音位置排除 ${presentPinyinsWithIndex.join("、")}` : "";
|
|
15597
15616
|
const tonesCorrectInfo = correctTonesWithIndex.length !== 0 ? `
|
|
15598
|
-
|
|
15617
|
+
正确声调 ${correctTonesWithIndex.join("、")}` : "";
|
|
15599
15618
|
const tonesPresentInfo = presentTones.length !== 0 ? `
|
|
15600
|
-
|
|
15619
|
+
包含声调 ${presentTones.join("、")}` : "";
|
|
15601
15620
|
const tonesAbsentInfo = absentTones.length !== 0 ? `
|
|
15602
|
-
|
|
15621
|
+
不包含声调 ${absentTones.join("、")}` : "";
|
|
15603
15622
|
const tonesPresentWithIndexInfo = presentTonesWithIndex.length !== 0 ? `
|
|
15604
|
-
|
|
15623
|
+
声调位置排除 ${presentTonesWithIndex.join("、")}` : "";
|
|
15605
15624
|
const progressMessage = `${progressInfo}${presentInfo}${absentInfo}${presentWithIndexInfo}${pinyinsCorrectInfo}${pinyinsPresentInfo}${pinyinsAbsentInfo}${pinyinsPresentWithIndexInfo}${tonesCorrectInfo}${tonesPresentInfo}${tonesAbsentInfo}${tonesPresentWithIndexInfo}${extraGameInfo}`;
|
|
15606
15625
|
const timeDifferenceInSeconds = (timestamp - Number(gameInfo.timestamp)) / 1e3;
|
|
15607
15626
|
let message = `${usernameMention}
|
|
15608
|
-
|
|
15609
|
-
|
|
15627
|
+
当前模式 ${gameMode}${wordlesNum > 1 ? `(x${wordlesNum})` : ""}${isHardMode ? `(${isUltraHardMode ? "超" : ""}困难)` : ""}${isAbsurd ? `(变态${isChallengeMode ? "挑战" : ""})` : ""}${isChallengeMode ? `
|
|
15628
|
+
目标单词 ${targetWord}` : ""}`;
|
|
15610
15629
|
if (config.enableWordGuessTimeLimit) {
|
|
15611
15630
|
message += `
|
|
15612
|
-
|
|
15631
|
+
剩余作答时间 ${timeDifferenceInSeconds} 秒`;
|
|
15613
15632
|
}
|
|
15614
15633
|
message += `
|
|
15615
15634
|
${inputLengthMessage}
|
|
@@ -15832,18 +15851,20 @@ function register5(g) {
|
|
|
15832
15851
|
username = await getSessionUserName(g, session);
|
|
15833
15852
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
15834
15853
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
15835
|
-
return "⚠️
|
|
15854
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
15836
15855
|
}
|
|
15837
15856
|
await sendMessage(
|
|
15838
15857
|
g,
|
|
15839
15858
|
session,
|
|
15840
|
-
|
|
15859
|
+
`💡 可查看的排行榜
|
|
15841
15860
|
${rankType.map((type, index) => `${index + 1}. ${type}`).join("\n")}
|
|
15842
|
-
|
|
15861
|
+
发送序号或排行榜名即可查看,或发送「取消」。`
|
|
15843
15862
|
);
|
|
15844
15863
|
const userInput = await session.prompt();
|
|
15845
15864
|
if (!userInput)
|
|
15846
|
-
return sendMessage(g, session,
|
|
15865
|
+
return sendMessage(g, session, `⏳ 没有等到有效输入,这次先作罢。`);
|
|
15866
|
+
if (userInput.trim() === "取消")
|
|
15867
|
+
return sendMessage(g, session, `✅ 已取消。`);
|
|
15847
15868
|
const userInputNumber = parseInt(userInput);
|
|
15848
15869
|
if (!isNaN(userInputNumber) && userInputNumber > 0 && userInputNumber <= rankType.length) {
|
|
15849
15870
|
const rankName = rankType[userInputNumber - 1];
|
|
@@ -15851,7 +15872,8 @@ ${rankType.map((type, index) => `${index + 1}. ${type}`).join("\n")}
|
|
|
15851
15872
|
} else if (rankType.includes(userInput)) {
|
|
15852
15873
|
await session.execute(`wordle.排行榜.${userInput} ${number}`);
|
|
15853
15874
|
} else {
|
|
15854
|
-
return sendMessage(g, session, `⚠️
|
|
15875
|
+
return sendMessage(g, session, `⚠️ 认不出这一项
|
|
15876
|
+
发送上面列出的序号或名称。`);
|
|
15855
15877
|
}
|
|
15856
15878
|
}
|
|
15857
15879
|
);
|
|
@@ -15862,7 +15884,7 @@ ${rankType.map((type, index) => `${index + 1}. ${type}`).join("\n")}
|
|
|
15862
15884
|
username = await getSessionUserName(g, session);
|
|
15863
15885
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
15864
15886
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
15865
|
-
return "⚠️
|
|
15887
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
15866
15888
|
}
|
|
15867
15889
|
let rankType3;
|
|
15868
15890
|
if (type === "总") {
|
|
@@ -15875,13 +15897,15 @@ ${rankType.map((type, index) => `${index + 1}. ${type}`).join("\n")}
|
|
|
15875
15897
|
await sendMessage(
|
|
15876
15898
|
g,
|
|
15877
15899
|
session,
|
|
15878
|
-
|
|
15900
|
+
`💡 可查看的类型
|
|
15879
15901
|
${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
15880
|
-
|
|
15902
|
+
发送序号或类型名即可查看,或发送「取消」。`
|
|
15881
15903
|
);
|
|
15882
15904
|
const userInput = await session.prompt();
|
|
15883
15905
|
if (!userInput)
|
|
15884
|
-
return sendMessage(g, session,
|
|
15906
|
+
return sendMessage(g, session, `⏳ 没有等到有效输入,这次先作罢。`);
|
|
15907
|
+
if (userInput.trim() === "取消")
|
|
15908
|
+
return sendMessage(g, session, `✅ 已取消。`);
|
|
15885
15909
|
const userInputNumber = parseInt(userInput);
|
|
15886
15910
|
if (!isNaN(userInputNumber) && userInputNumber > 0 && userInputNumber <= rankType3.length) {
|
|
15887
15911
|
const rankName = rankType3[userInputNumber - 1];
|
|
@@ -15893,7 +15917,8 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
15893
15917
|
`wordle.排行榜.${type}.${userInput} ${number}`
|
|
15894
15918
|
);
|
|
15895
15919
|
} else {
|
|
15896
|
-
return sendMessage(g, session, `⚠️
|
|
15920
|
+
return sendMessage(g, session, `⚠️ 认不出这一项
|
|
15921
|
+
发送上面列出的序号或名称。`);
|
|
15897
15922
|
}
|
|
15898
15923
|
}
|
|
15899
15924
|
);
|
|
@@ -15907,7 +15932,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
15907
15932
|
username = await getSessionUserName(g, session);
|
|
15908
15933
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
15909
15934
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
15910
|
-
return "⚠️
|
|
15935
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
15911
15936
|
}
|
|
15912
15937
|
return await getLeaderboard(
|
|
15913
15938
|
g,
|
|
@@ -15927,7 +15952,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
15927
15952
|
username = await getSessionUserName(g, session);
|
|
15928
15953
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
15929
15954
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
15930
|
-
return "⚠️
|
|
15955
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
15931
15956
|
}
|
|
15932
15957
|
return await getLeaderboard(
|
|
15933
15958
|
g,
|
|
@@ -15947,13 +15972,13 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
15947
15972
|
username = await getSessionUserName(g, session);
|
|
15948
15973
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
15949
15974
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
15950
|
-
return "⚠️
|
|
15975
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
15951
15976
|
}
|
|
15952
15977
|
return await getLeaderboard(
|
|
15953
15978
|
g,
|
|
15954
15979
|
session,
|
|
15955
15980
|
"lose",
|
|
15956
|
-
"
|
|
15981
|
+
"玩家总输场排行榜",
|
|
15957
15982
|
number
|
|
15958
15983
|
);
|
|
15959
15984
|
}
|
|
@@ -15970,7 +15995,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
15970
15995
|
username = await getSessionUserName(g, session);
|
|
15971
15996
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
15972
15997
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
15973
|
-
return "⚠️
|
|
15998
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
15974
15999
|
}
|
|
15975
16000
|
if (type === "词影" && options.wordles !== 0 || type === "词影" && options.hard) {
|
|
15976
16001
|
if (options.wordles === 0) {
|
|
@@ -15980,7 +16005,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
15980
16005
|
return await sendMessage(
|
|
15981
16006
|
g,
|
|
15982
16007
|
session,
|
|
15983
|
-
`⚠️
|
|
16008
|
+
`⚠️ 词影多猜测排行榜的范围是 1 到 4。`
|
|
15984
16009
|
);
|
|
15985
16010
|
}
|
|
15986
16011
|
return await getWinCountLeaderboardForCiying(
|
|
@@ -16010,7 +16035,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
16010
16035
|
username = await getSessionUserName(g, session);
|
|
16011
16036
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
16012
16037
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
16013
|
-
return "⚠️
|
|
16038
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
16014
16039
|
}
|
|
16015
16040
|
if (type === "词影" && options.wordles !== 0 || type === "词影" && options.hard) {
|
|
16016
16041
|
if (options.wordles === 0) {
|
|
@@ -16020,7 +16045,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
16020
16045
|
return await sendMessage(
|
|
16021
16046
|
g,
|
|
16022
16047
|
session,
|
|
16023
|
-
`⚠️
|
|
16048
|
+
`⚠️ 词影多猜测排行榜的范围是 1 到 4。`
|
|
16024
16049
|
);
|
|
16025
16050
|
}
|
|
16026
16051
|
return await getLoseCountLeaderboardForCiying(
|
|
@@ -16050,7 +16075,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
16050
16075
|
username = await getSessionUserName(g, session);
|
|
16051
16076
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
16052
16077
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
16053
|
-
return "⚠️
|
|
16078
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
16054
16079
|
}
|
|
16055
16080
|
if (type === "词影" && options.wordles !== 0 || type === "词影" && options.hard) {
|
|
16056
16081
|
if (options.wordles === 0) {
|
|
@@ -16060,7 +16085,7 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
16060
16085
|
return await sendMessage(
|
|
16061
16086
|
g,
|
|
16062
16087
|
session,
|
|
16063
|
-
`⚠️
|
|
16088
|
+
`⚠️ 词影多猜测排行榜的范围是 1 到 4。`
|
|
16064
16089
|
);
|
|
16065
16090
|
}
|
|
16066
16091
|
return await getFastestGuessTimeLeaderboardForCiying(
|
|
@@ -16091,13 +16116,13 @@ ${rankType3.map((type2, index) => `${index + 1}. ${type2}`).join("\n")}
|
|
|
16091
16116
|
username = await getSessionUserName(g, session);
|
|
16092
16117
|
await updateNameInPlayerRecord(g, session, userId, username);
|
|
16093
16118
|
if (typeof number !== "number" || isNaN(number) || number < 0) {
|
|
16094
|
-
return "⚠️
|
|
16119
|
+
return "⚠️ 排行榜人数须是不小于 0 的整数。";
|
|
16095
16120
|
}
|
|
16096
16121
|
if (typeof options.wordles !== "number" || options.wordles < 1 || options.wordles > 4) {
|
|
16097
16122
|
return await sendMessage(
|
|
16098
16123
|
g,
|
|
16099
16124
|
session,
|
|
16100
|
-
`⚠️
|
|
16125
|
+
`⚠️ 词影多猜测排行榜的范围是 1 到 4。`
|
|
16101
16126
|
);
|
|
16102
16127
|
}
|
|
16103
16128
|
return await getCiyingSuccessCountLeaderboardForCiying(
|