koishi-plugin-wordle-game 2.1.4 → 2.1.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.
Files changed (2) hide show
  1. package/lib/index.js +17 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -24,7 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  return result;
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.apply = exports.Config = exports.usage = exports.name = exports.inject = void 0;
27
+ exports.Config = exports.usage = exports.name = exports.inject = void 0;
28
+ exports.apply = apply;
28
29
  const koishi_1 = require("koishi");
29
30
  // import {} from 'koishi-plugin-rr-gpt'
30
31
  const cheerio_1 = require("cheerio");
@@ -960,7 +961,6 @@ async function apply(ctx, config) {
960
961
  // 玩家记录输
961
962
  await updatePlayerRecordsLose(channelId, gameInfo);
962
963
  await endGame(channelId);
963
- await setGuessRunningStatus(channelId, false);
964
964
  return await sendMessage(session, `【@${username}】\n作答时间超过【${config.wordGuessTimeLimitInSeconds}】秒!\n很遗憾,你们输了!\n下次猜快点吧~`);
965
965
  // return await sendMessage(session, `【@${username}】\n作答时间超过【${config.wordGuessTimeLimitInSeconds}】秒!\n很遗憾,你们输了!\n下次猜快点吧~\n${h.image(imageBuffer, `image/${config.imageType}`)}`)
966
966
  }
@@ -985,12 +985,15 @@ async function apply(ctx, config) {
985
985
  return await sendMessage(session, `【@${username}】\n输入包含非字母字符,请重新输入!`);
986
986
  }
987
987
  if (!isFourCharacterIdiom(inputWord) && gameMode === '汉兜' || !isFourCharacterIdiom(inputWord) && gameMode === '词影') {
988
+ await setGuessRunningStatus(channelId, false);
988
989
  return await sendMessage(session, `【@${username}】\n您确定您输入的是四字词语吗?`);
989
990
  }
990
991
  if (gameMode === 'Numberle' && !isNumericString(inputWord)) {
992
+ await setGuessRunningStatus(channelId, false);
991
993
  return await sendMessage(session, `【@${username}】\n您确定您输入的是 ${guessWordLength} 长度的数字吗?`);
992
994
  }
993
995
  if (gameMode === 'Math' && !isMathEquationValid(inputWord)) {
996
+ await setGuessRunningStatus(channelId, false);
994
997
  return await sendMessage(session, `【@${username}】\n请使用+-*/=运算符和0-9之间的数字!\n并组成正确的数学方程式!`);
995
998
  }
996
999
  if (inputWord.length !== gameInfo.guessWordLength && gameMode !== '汉兜' && gameMode !== '词影' && gameMode !== 'Numberle' && gameMode !== 'Math') {
@@ -1014,6 +1017,10 @@ async function apply(ctx, config) {
1014
1017
  }
1015
1018
  let userInputPinyin = '';
1016
1019
  if (gameMode === '词影') {
1020
+ if (!checkStrokesData(inputWord)) {
1021
+ await setGuessRunningStatus(channelId, false);
1022
+ return await sendMessage(session, `【@${username}】\n不好意思啊...\n我还没学会这个字(`);
1023
+ }
1017
1024
  if (!isIdiomInList(inputWord, idiomsList) && !isFreeMode) {
1018
1025
  const idiomInfo = await getIdiomInfo(inputWord);
1019
1026
  if (idiomInfo.pinyin === '未找到拼音') {
@@ -2710,6 +2717,14 @@ ${content}
2710
2717
  }
2711
2718
  }
2712
2719
  // hs*
2720
+ function checkStrokesData(inputWord) {
2721
+ for (const char of inputWord) {
2722
+ if (!strokesData[char]) {
2723
+ return false;
2724
+ }
2725
+ }
2726
+ return true;
2727
+ }
2713
2728
  async function getSelectedIdiom(randomIdiom) {
2714
2729
  let selectedIdiom = undefined;
2715
2730
  if (isIdiomInList(randomIdiom, idiomsList)) {
@@ -4470,4 +4485,3 @@ ${content}
4470
4485
  </div>`;
4471
4486
  // apply
4472
4487
  }
4473
- exports.apply = apply;
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.1.4",
4
+ "version": "2.1.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [