koishi-plugin-wordle-game 2.3.5 → 2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2 -2
- package/lib/index.js +13 -13
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface GameRecord {
|
|
|
67
67
|
correctTonesWithIndex: string[];
|
|
68
68
|
presentTonesWithIndex: string[];
|
|
69
69
|
absentTones: string[];
|
|
70
|
-
timestamp:
|
|
70
|
+
timestamp: string;
|
|
71
71
|
remainingWordsList: string[];
|
|
72
72
|
isAbsurd: boolean;
|
|
73
73
|
isChallengeMode: boolean;
|
|
@@ -101,7 +101,7 @@ export interface ExtraGameRecord {
|
|
|
101
101
|
correctTonesWithIndex: string[];
|
|
102
102
|
presentTonesWithIndex: string[];
|
|
103
103
|
absentTones: string[];
|
|
104
|
-
timestamp:
|
|
104
|
+
timestamp: string;
|
|
105
105
|
wordlesNum: number;
|
|
106
106
|
wordleIndex: number;
|
|
107
107
|
isWin: boolean;
|
package/lib/index.js
CHANGED
|
@@ -257,7 +257,7 @@ async function apply(ctx, config) {
|
|
|
257
257
|
guessWordLength: 'unsigned',
|
|
258
258
|
gameMode: 'string',
|
|
259
259
|
isRunning: 'boolean',
|
|
260
|
-
timestamp:
|
|
260
|
+
timestamp: 'string',
|
|
261
261
|
correctLetters: 'list',
|
|
262
262
|
presentLetters: 'string',
|
|
263
263
|
absentLetters: 'string',
|
|
@@ -296,7 +296,7 @@ async function apply(ctx, config) {
|
|
|
296
296
|
strokesHtmlCache: { type: 'json', initial: [[], [], [], []] },
|
|
297
297
|
guessWordLength: 'unsigned',
|
|
298
298
|
gameMode: 'string',
|
|
299
|
-
timestamp:
|
|
299
|
+
timestamp: 'string',
|
|
300
300
|
correctLetters: 'list',
|
|
301
301
|
presentLetters: 'string',
|
|
302
302
|
absentLetters: 'string',
|
|
@@ -572,7 +572,7 @@ async function apply(ctx, config) {
|
|
|
572
572
|
// 结束
|
|
573
573
|
const processedResult = gameInfo.wordlesNum > 1 ? `\n${await processExtraGameRecords(channelId)}` : '';
|
|
574
574
|
await endGame(channelId);
|
|
575
|
-
const duration = calculateGameDuration(gameInfo.timestamp, timestamp);
|
|
575
|
+
const duration = calculateGameDuration(Number(gameInfo.timestamp), timestamp);
|
|
576
576
|
const message = `【@${username}】\n由于您执行了操作:【结束】\n游戏已结束!\n${duration}${gameInfo.isAbsurd ? '' : `\n${generateGameEndMessage(gameInfo)}`}${processedResult}`;
|
|
577
577
|
return await sendMessage(session, message);
|
|
578
578
|
// .action
|
|
@@ -704,7 +704,7 @@ async function apply(ctx, config) {
|
|
|
704
704
|
remainingGuessesCount: 6 + wordlesNum - 1,
|
|
705
705
|
guessWordLength: 5,
|
|
706
706
|
gameMode: '经典',
|
|
707
|
-
timestamp: timestamp,
|
|
707
|
+
timestamp: String(timestamp),
|
|
708
708
|
isHardMode: isHardMode,
|
|
709
709
|
isUltraHardMode,
|
|
710
710
|
correctLetters: correctLetters,
|
|
@@ -733,7 +733,7 @@ async function apply(ctx, config) {
|
|
|
733
733
|
wordGuess: randomWordExtra,
|
|
734
734
|
wordAnswerChineseDefinition: replaceEscapeCharacters(foundWordExtra.translation),
|
|
735
735
|
gameMode: '经典',
|
|
736
|
-
timestamp: timestamp,
|
|
736
|
+
timestamp: String(timestamp),
|
|
737
737
|
correctLetters: correctLetters,
|
|
738
738
|
presentLetters: '',
|
|
739
739
|
absentLetters: '',
|
|
@@ -892,7 +892,7 @@ async function apply(ctx, config) {
|
|
|
892
892
|
remainingGuessesCount: exam === '汉兜' ? 10 + wordlesNum - 1 : exam === 'Math' || exam === '词影' ? 6 + wordlesNum - 1 : guessWordLength + 1 + wordlesNum - 1,
|
|
893
893
|
guessWordLength,
|
|
894
894
|
gameMode: exam,
|
|
895
|
-
timestamp: timestamp,
|
|
895
|
+
timestamp: String(timestamp),
|
|
896
896
|
isHardMode: isHardMode,
|
|
897
897
|
isUltraHardMode,
|
|
898
898
|
correctLetters: correctLetters,
|
|
@@ -959,7 +959,7 @@ async function apply(ctx, config) {
|
|
|
959
959
|
wordGuess: randomWordExtra,
|
|
960
960
|
wordAnswerChineseDefinition: replaceEscapeCharacters(translation),
|
|
961
961
|
gameMode: exam,
|
|
962
|
-
timestamp: timestamp,
|
|
962
|
+
timestamp: String(timestamp),
|
|
963
963
|
correctLetters: correctLetters,
|
|
964
964
|
presentLetters: '',
|
|
965
965
|
absentLetters: '',
|
|
@@ -1043,7 +1043,7 @@ async function apply(ctx, config) {
|
|
|
1043
1043
|
inputWord = userInput.trim();
|
|
1044
1044
|
}
|
|
1045
1045
|
// 作答时间限制
|
|
1046
|
-
const timeDifferenceInSeconds = (timestamp - gameInfo.timestamp) / 1000; // 将时间戳转换为秒
|
|
1046
|
+
const timeDifferenceInSeconds = (timestamp - Number(gameInfo.timestamp)) / 1000; // 将时间戳转换为秒
|
|
1047
1047
|
if (config.enableWordGuessTimeLimit) {
|
|
1048
1048
|
if (timeDifferenceInSeconds > config.wordGuessTimeLimitInSeconds) {
|
|
1049
1049
|
// // 生成 html 字符串
|
|
@@ -1095,7 +1095,7 @@ async function apply(ctx, config) {
|
|
|
1095
1095
|
const inputLengthMessage = `输入的单词长度不对哦!\n您的输入为:【${inputWord}】\n它的长度为:【${inputWord.length}】\n待猜单词的长度为:【${gameInfo.guessWordLength}】`;
|
|
1096
1096
|
const presentLettersWithoutAsterisk = uniqueSortedLowercaseLetters(presentLetters);
|
|
1097
1097
|
const processedResult = wordlesNum > 1 ? '\n' + await processExtraGameInfos(channelId) : '';
|
|
1098
|
-
const progressMessage = `当前${calculateGameDuration(gameInfo.timestamp, timestamp)}\n当前进度:【${correctLetters.join('')}】${presentLettersWithoutAsterisk.length === 0 ? `` : `\n包含字母:【${presentLettersWithoutAsterisk}】`}${absentLetters.length === 0 ? '' : `\n不包含字母:【${absentLetters}】`}${processedResult}`;
|
|
1098
|
+
const progressMessage = `当前${calculateGameDuration(Number(gameInfo.timestamp), timestamp)}\n当前进度:【${correctLetters.join('')}】${presentLettersWithoutAsterisk.length === 0 ? `` : `\n包含字母:【${presentLettersWithoutAsterisk}】`}${absentLetters.length === 0 ? '' : `\n不包含字母:【${absentLetters}】`}${processedResult}`;
|
|
1099
1099
|
return await sendMessage(session, `${usernameMention}\n${inputLengthMessage}\n${progressMessage}`);
|
|
1100
1100
|
}
|
|
1101
1101
|
// 是否存在该单词
|
|
@@ -1408,7 +1408,7 @@ async function apply(ctx, config) {
|
|
|
1408
1408
|
await ctx.database.set('wordle_player_records', { userId: userId }, updateData);
|
|
1409
1409
|
const processedResult = wordlesNum > 1 ? `\n${await processExtraGameRecords(channelId)}` : '';
|
|
1410
1410
|
await endGame(channelId);
|
|
1411
|
-
const gameDuration = calculateGameDuration(gameInfo.timestamp, timestamp);
|
|
1411
|
+
const gameDuration = calculateGameDuration(Number(gameInfo.timestamp), timestamp);
|
|
1412
1412
|
const imageType = config.imageType;
|
|
1413
1413
|
const settlementResult = finalSettlementString === '' ? '' : `最终结算结果如下:\n${finalSettlementString}`;
|
|
1414
1414
|
const message = `
|
|
@@ -1429,7 +1429,7 @@ ${settlementResult}
|
|
|
1429
1429
|
await endGame(channelId);
|
|
1430
1430
|
const challengeMessage = isChallengeMode ? `\n目标单词为:【${targetWord}】\n它不再是可能的秘密单词!` : '';
|
|
1431
1431
|
const answerInfo = isChallengeMode ? '' : `\n${generateGameEndMessage(gameInfo)}`;
|
|
1432
|
-
const gameDuration = calculateGameDuration(gameInfo.timestamp, timestamp);
|
|
1432
|
+
const gameDuration = calculateGameDuration(Number(gameInfo.timestamp), timestamp);
|
|
1433
1433
|
const message = `很遗憾,你们没有猜出来!${challengeMessage}\n但没关系~下次加油哇!\n${koishi_1.h.image(imageBuffer, `image/${config.imageType}`)}\n${gameDuration}${answerInfo}${processedResult}`;
|
|
1434
1434
|
return await sendMessage(session, message);
|
|
1435
1435
|
}
|
|
@@ -1738,7 +1738,7 @@ ${generateStatsInfo(stats, fastestGuessTime)}
|
|
|
1738
1738
|
const usernameMention = `【@${username}】`;
|
|
1739
1739
|
const inputLengthMessage = `待猜${gameMode === '汉兜' || gameMode === '词影' ? '词语' : gameMode === 'Numberle' ? '数字' : gameMode === 'Math' ? '数学方程式' : '单词'}的长度为:【${guessWordLength}】`;
|
|
1740
1740
|
const extraGameInfo = wordlesNum > 1 ? `\n${await processExtraGameInfos(channelId)}` : '';
|
|
1741
|
-
const gameDuration = calculateGameDuration(gameInfo.timestamp, timestamp);
|
|
1741
|
+
const gameDuration = calculateGameDuration(Number(gameInfo.timestamp), timestamp);
|
|
1742
1742
|
const progressInfo = `当前${gameDuration}\n当前进度:【${correctLetters.join('')}】`;
|
|
1743
1743
|
const presentInfo = presentLetters.length !== 0 ? `\n包含:【${presentLetters}】` : '';
|
|
1744
1744
|
const absentInfo = absentLetters.length !== 0 ? `\n不包含:【${absentLetters}】` : '';
|
|
@@ -1752,7 +1752,7 @@ ${generateStatsInfo(stats, fastestGuessTime)}
|
|
|
1752
1752
|
const tonesAbsentInfo = absentTones.length !== 0 ? `\n不包含声调:【${absentTones.join(', ')}】` : '';
|
|
1753
1753
|
const tonesPresentWithIndexInfo = presentTonesWithIndex.length !== 0 ? `\n声调位置排除:【${presentTonesWithIndex.join(', ')}】` : '';
|
|
1754
1754
|
const progressMessage = `${progressInfo}${presentInfo}${absentInfo}${presentWithIndexInfo}${pinyinsCorrectInfo}${pinyinsPresentInfo}${pinyinsAbsentInfo}${pinyinsPresentWithIndexInfo}${tonesCorrectInfo}${tonesPresentInfo}${tonesAbsentInfo}${tonesPresentWithIndexInfo}${extraGameInfo}`;
|
|
1755
|
-
const timeDifferenceInSeconds = (timestamp - gameInfo.timestamp) / 1000;
|
|
1755
|
+
const timeDifferenceInSeconds = (timestamp - Number(gameInfo.timestamp)) / 1000;
|
|
1756
1756
|
let message = `${usernameMention}\n当前游戏模式为:【${gameMode}${wordlesNum > 1 ? `(x${wordlesNum})` : ''}${isHardMode ? `(${isUltraHardMode ? '超' : ''}困难)` : ''}${isAbsurd ? `(变态${isChallengeMode ? '挑战' : ''})` : ''}】${isChallengeMode ? `\n目标单词为:【${targetWord}】` : ''}`;
|
|
1757
1757
|
if (config.enableWordGuessTimeLimit) {
|
|
1758
1758
|
message += `\n剩余作答时间:【${timeDifferenceInSeconds}】秒`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-wordle-game",
|
|
3
3
|
"description": "欢迎来到 [Wordle](https://www.nytimes.com/games/wordle/index.html) | [汉兜](https://handle.antfu.me/) | [词影](https://cy.surprising.studio/) |... 猜单词|猜成语|猜数字|猜数学方程式|... 的小游戏,包含多种词库、多种主题、多种游戏设置和排行榜系统。",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.6",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|