koishi-plugin-wordle-game 2.5.7 → 2.5.9

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 +33 -1
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -1657,7 +1657,9 @@ async function apply(ctx, config) {
1657
1657
  if (!config.enableWordGuessMiddleware) {
1658
1658
  return await next();
1659
1659
  }
1660
- content2 = content2?.trim();
1660
+ if (content2) {
1661
+ content2 = `${import_koishi.h.select(content2, "text")}`.trim();
1662
+ }
1661
1663
  const gameInfo = await getGameInfo(channelId);
1662
1664
  if (!gameInfo.isStarted) {
1663
1665
  return await next();
@@ -2929,6 +2931,11 @@ ${generateStatsInfo(stats, fastestGuessTime)}
2929
2931
  return sendMessage(session, queryInfo, `改名 查询玩家记录 开始游戏`, 2);
2930
2932
  });
2931
2933
  ctx.command("wordleGame.查单词 [targetWord:text]", "查单词引导").action(async ({ session, options }, targetWord) => {
2934
+ if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
2935
+ if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
2936
+ targetWord = session.event.message.quote.content.trim();
2937
+ }
2938
+ }
2932
2939
  let { channelId, userId, username } = session;
2933
2940
  username = await getSessionUserName(session);
2934
2941
  await updateNameInPlayerRecord(session, userId, username);
@@ -2952,6 +2959,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
2952
2959
  }
2953
2960
  });
2954
2961
  ctx.command("wordleGame.查单词.ALL [targetWord:text]", "在ALL词库中查询单词释义(英译中)").action(async ({ session }, targetWord) => {
2962
+ if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
2963
+ if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
2964
+ targetWord = session.event.message.quote.content.trim();
2965
+ }
2966
+ }
2955
2967
  let { userId, username } = session;
2956
2968
  username = await getSessionUserName(session);
2957
2969
  await updateNameInPlayerRecord(session, userId, username);
@@ -2982,6 +2994,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
2982
2994
  ${replaceEscapeCharacters(foundWord.translation)}`, `查单词`);
2983
2995
  });
2984
2996
  ctx.command("wordleGame.查单词.WordWord [targetWord:text]", "在WordWord中查找单词定义(英译英)").action(async ({ session }, targetWord) => {
2997
+ if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
2998
+ if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
2999
+ targetWord = session.event.message.quote.content.trim();
3000
+ }
3001
+ }
2985
3002
  let { userId, username } = session;
2986
3003
  username = await getSessionUserName(session);
2987
3004
  await updateNameInPlayerRecord(session, userId, username);
@@ -3013,6 +3030,11 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
3013
3030
  });
3014
3031
  });
3015
3032
  ctx.command("wordleGame.查成语 [targetIdiom:text]", "查成语引导").action(async ({ session, options }, targetIdiom) => {
3033
+ if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
3034
+ if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
3035
+ targetIdiom = session.event.message.quote.content.trim();
3036
+ }
3037
+ }
3016
3038
  let { channelId, userId, username } = session;
3017
3039
  username = await getSessionUserName(session);
3018
3040
  await updateNameInPlayerRecord(session, userId, username);
@@ -3035,6 +3057,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
3035
3057
  }
3036
3058
  });
3037
3059
  ctx.command("wordleGame.查成语.百度汉语 [targetIdiom:text]", "在百度汉语中查找成语解释").action(async ({ session }, targetIdiom) => {
3060
+ if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
3061
+ if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
3062
+ targetIdiom = session.event.message.quote.content.trim();
3063
+ }
3064
+ }
3038
3065
  let { userId, username } = session;
3039
3066
  username = await getSessionUserName(session);
3040
3067
  await updateNameInPlayerRecord(session, userId, username);
@@ -3066,6 +3093,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
3066
3093
  【解释】${idiomInfo.explanation}`, `查成语`);
3067
3094
  });
3068
3095
  ctx.command("wordleGame.查成语.汉典 [targetIdiom:text]", "在汉典中查找成语解释").action(async ({ session }, targetIdiom) => {
3096
+ if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
3097
+ if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
3098
+ targetIdiom = session.event.message.quote.content.trim();
3099
+ }
3100
+ }
3069
3101
  let { userId, username } = session;
3070
3102
  username = await getSessionUserName(session);
3071
3103
  await updateNameInPlayerRecord(session, userId, username);
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/) |... 猜单词|猜成语|猜数字|猜数学方程式|... 的小游戏,支持QQ官方MD模板,且包含多种词库、主题、游戏设置和排行榜系统等。",
4
- "version": "2.5.7",
4
+ "version": "2.5.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -61,12 +61,12 @@
61
61
  "猜"
62
62
  ],
63
63
  "peerDependencies": {
64
- "koishi": "^4.17.11"
64
+ "koishi": "^4.17.12"
65
65
  },
66
66
  "devDependencies": {
67
67
  "koishi-plugin-markdown-to-image-service": "^1.2.1",
68
68
  "koishi-plugin-monetary": "^0.1.3",
69
- "koishi-plugin-puppeteer": "^3.8.4"
69
+ "koishi-plugin-puppeteer": "^3.9.0"
70
70
  },
71
71
  "dependencies": {
72
72
  "cheerio": "^1.0.0"