koishi-plugin-wordle-game 2.5.7 → 2.5.8

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 +30 -0
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -2929,6 +2929,11 @@ ${generateStatsInfo(stats, fastestGuessTime)}
2929
2929
  return sendMessage(session, queryInfo, `改名 查询玩家记录 开始游戏`, 2);
2930
2930
  });
2931
2931
  ctx.command("wordleGame.查单词 [targetWord:text]", "查单词引导").action(async ({ session, options }, targetWord) => {
2932
+ if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
2933
+ if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
2934
+ targetWord = session.event.message.quote.content.trim();
2935
+ }
2936
+ }
2932
2937
  let { channelId, userId, username } = session;
2933
2938
  username = await getSessionUserName(session);
2934
2939
  await updateNameInPlayerRecord(session, userId, username);
@@ -2952,6 +2957,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
2952
2957
  }
2953
2958
  });
2954
2959
  ctx.command("wordleGame.查单词.ALL [targetWord:text]", "在ALL词库中查询单词释义(英译中)").action(async ({ session }, targetWord) => {
2960
+ if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
2961
+ if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
2962
+ targetWord = session.event.message.quote.content.trim();
2963
+ }
2964
+ }
2955
2965
  let { userId, username } = session;
2956
2966
  username = await getSessionUserName(session);
2957
2967
  await updateNameInPlayerRecord(session, userId, username);
@@ -2982,6 +2992,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
2982
2992
  ${replaceEscapeCharacters(foundWord.translation)}`, `查单词`);
2983
2993
  });
2984
2994
  ctx.command("wordleGame.查单词.WordWord [targetWord:text]", "在WordWord中查找单词定义(英译英)").action(async ({ session }, targetWord) => {
2995
+ if (!targetWord && session.event.message.quote && session.event.message.quote.content) {
2996
+ if (/^[a-zA-Z]+$/.test(session.event.message.quote.content.trim())) {
2997
+ targetWord = session.event.message.quote.content.trim();
2998
+ }
2999
+ }
2985
3000
  let { userId, username } = session;
2986
3001
  username = await getSessionUserName(session);
2987
3002
  await updateNameInPlayerRecord(session, userId, username);
@@ -3013,6 +3028,11 @@ ${serializedDefinitions ? serializedDefinitions : `- 该单词定义暂未收录
3013
3028
  });
3014
3029
  });
3015
3030
  ctx.command("wordleGame.查成语 [targetIdiom:text]", "查成语引导").action(async ({ session, options }, targetIdiom) => {
3031
+ if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
3032
+ if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
3033
+ targetIdiom = session.event.message.quote.content.trim();
3034
+ }
3035
+ }
3016
3036
  let { channelId, userId, username } = session;
3017
3037
  username = await getSessionUserName(session);
3018
3038
  await updateNameInPlayerRecord(session, userId, username);
@@ -3035,6 +3055,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
3035
3055
  }
3036
3056
  });
3037
3057
  ctx.command("wordleGame.查成语.百度汉语 [targetIdiom:text]", "在百度汉语中查找成语解释").action(async ({ session }, targetIdiom) => {
3058
+ if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
3059
+ if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
3060
+ targetIdiom = session.event.message.quote.content.trim();
3061
+ }
3062
+ }
3038
3063
  let { userId, username } = session;
3039
3064
  username = await getSessionUserName(session);
3040
3065
  await updateNameInPlayerRecord(session, userId, username);
@@ -3066,6 +3091,11 @@ ${availableDictionaryArray.map((dictionary, index) => `${index + 1}. ${dictionar
3066
3091
  【解释】${idiomInfo.explanation}`, `查成语`);
3067
3092
  });
3068
3093
  ctx.command("wordleGame.查成语.汉典 [targetIdiom:text]", "在汉典中查找成语解释").action(async ({ session }, targetIdiom) => {
3094
+ if (!targetIdiom && session.event.message.quote && session.event.message.quote.content) {
3095
+ if (isFourCharacterIdiom(session.event.message.quote.content.trim())) {
3096
+ targetIdiom = session.event.message.quote.content.trim();
3097
+ }
3098
+ }
3069
3099
  let { userId, username } = session;
3070
3100
  username = await getSessionUserName(session);
3071
3101
  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.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [