koishi-plugin-game-mini 0.1.3 → 0.1.4

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.js CHANGED
@@ -39,10 +39,15 @@ function apply(ctx, config) {
39
39
  tooSmall: '猜小啦!当前范围更新为 [{0}-{1}]',
40
40
  tooBig: '猜大啦!当前范围更新为 [{0}-{1}]',
41
41
  correct: '恭喜你猜中了!正确数字就是 {0} 🎉',
42
- botFirstGuess: '我先来猜一个:{0},该你啦~',
43
42
  botWin: '哈哈我猜中了!我猜的是 {0},正确数字就是 {0},我赢啦 🎉',
44
43
  botGuessTooSmall: '我猜 {0},猜小啦!当前范围 [{1}-{2}]',
45
- botGuessTooBig: '我猜 {0},猜大啦!当前范围 [{1}-{2}]'
44
+ botGuessTooBig: '我猜 {0},猜大啦!当前范围 [{1}-{2}]',
45
+ commandDesc: '猜数字小游戏指令,支持启动/停止游戏',
46
+ helpTitle: '猜数字小游戏使用帮助:',
47
+ helpStart: '1. guess start - 启动猜数字游戏,初始范围为配置的最小值-最大值',
48
+ helpStop: '2. guess stop - 停止当前猜数字游戏,并公布正确数字',
49
+ helpInput: '3. 游戏运行时直接输入数字 - 参与猜数字,系统会提示猜大/猜小或猜对',
50
+ helpOptionDesc: '查看指令帮助'
46
51
  }
47
52
  };
48
53
  try {
@@ -119,9 +124,19 @@ function apply(ctx, config) {
119
124
  }
120
125
  await session.send(reply);
121
126
  });
122
- ctx.command('guess <action:string>').action(async ({ session }, action) => {
127
+ ctx.command('guess <action:string>', '猜数字小游戏指令,支持启动/停止游戏')
128
+ .option('help', '-h 查看指令帮助')
129
+ .action(async ({ session, options }, action) => {
123
130
  if (!session)
124
131
  return '';
132
+ if (options?.help) {
133
+ const helpText = `${session.text('guessNumber.helpTitle')}
134
+ ${session.text('guessNumber.helpStart')}
135
+ ${session.text('guessNumber.helpStop')}
136
+ ${session.text('guessNumber.helpInput')}`;
137
+ await session.send(helpText);
138
+ return '';
139
+ }
125
140
  const key = getSessionKey(session);
126
141
  let state = guessNumberStates.get(key) || {
127
142
  target: 0,
@@ -141,7 +156,6 @@ function apply(ctx, config) {
141
156
  state.started = true;
142
157
  state.botGuess = [];
143
158
  guessNumberStates.set(key, state);
144
- // 移除启动时Bot先猜数的逻辑,仅提示游戏开始
145
159
  const msg = session.text('guessNumber.start', [config.guessNumber.min, config.guessNumber.max]);
146
160
  await session.send(msg);
147
161
  return '';
@@ -8,4 +8,10 @@ guessNumber:
8
8
  correct: 恭喜你猜中了!正确数字就是 {0} 🎉
9
9
  botWin: 哈哈我猜中了!我猜的是 {0},正确数字就是 {0},我赢啦 🎉
10
10
  botGuessTooSmall: 我猜 {0},猜小啦!当前范围 [{1}-{2}]
11
- botGuessTooBig: 我猜 {0},猜大啦!当前范围 [{1}-{2}]
11
+ botGuessTooBig: 我猜 {0},猜大啦!当前范围 [{1}-{2}]
12
+ commandDesc: 猜数字小游戏指令,支持启动/停止游戏
13
+ helpTitle: 猜数字小游戏使用帮助:
14
+ helpStart: 1. guess start - 启动猜数字游戏,初始范围为配置的最小值-最大值
15
+ helpStop: 2. guess stop - 停止当前猜数字游戏,并公布正确数字
16
+ helpInput: 3. 游戏运行时直接输入数字 - 参与猜数字,系统会提示猜大/猜小或猜对
17
+ helpOptionDesc: 查看指令帮助
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-game-mini",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "一款简单的猜数字小游戏,支持Bot参与",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",