koishi-plugin-cocoyyy-console 1.1.0-beta.7 → 1.1.0-beta.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 (3) hide show
  1. package/lib/index.js +16 -5
  2. package/package.json +1 -1
  3. package/readme.md +13 -1
package/lib/index.js CHANGED
@@ -2179,8 +2179,7 @@ var gameList = [
2179
2179
  var commandList = [
2180
2180
  "endgame",
2181
2181
  "gamelist",
2182
- "startgame",
2183
- "reroll"
2182
+ "startgame"
2184
2183
  ];
2185
2184
  function registerGameCommands(ctx, game_config, ai_config) {
2186
2185
  if (game_config?.config_path) {
@@ -2211,7 +2210,7 @@ function registerGameCommands(ctx, game_config, ai_config) {
2211
2210
  is_thinking = true;
2212
2211
  switch (game) {
2213
2212
  case gameList[0].command:
2214
- await session.send("正在开始游戏...后续问答请参照格式:@bot [问题]");
2213
+ await session.send("正在开始游戏...后续问答请参照格式:@bot [问题]\n需要刷新谜题时发送:@bot reroll");
2215
2214
  const resp = await startSituationPuzzle(ai_config);
2216
2215
  return checkResp(resp);
2217
2216
  default:
@@ -2225,9 +2224,11 @@ function registerGameCommands(ctx, game_config, ai_config) {
2225
2224
  if (!dev_mode) {
2226
2225
  if (!is_at_bot(session)) return;
2227
2226
  }
2227
+ if (!is_gaming) return "未开始游戏";
2228
2228
  if (is_thinking) return "正在思考,请耐心等待...";
2229
2229
  try {
2230
2230
  is_thinking = true;
2231
+ await session.send("正在结束游戏...");
2231
2232
  const resp = await endSituationPuzzle(ai_config);
2232
2233
  return checkResp(resp);
2233
2234
  } finally {
@@ -2238,6 +2239,7 @@ function registerGameCommands(ctx, game_config, ai_config) {
2238
2239
  if (!dev_mode) {
2239
2240
  if (!is_at_bot(session)) return;
2240
2241
  }
2242
+ if (!is_gaming) return "未开始游戏";
2241
2243
  if (is_thinking) return "正在思考,请耐心等待...";
2242
2244
  try {
2243
2245
  is_thinking = true;
@@ -2261,8 +2263,17 @@ function registerGameMiddleware(ctx, ai_config) {
2261
2263
  commandList.forEach((element) => {
2262
2264
  if (text.includes(element)) return next();
2263
2265
  });
2264
- const resp = await questSituationPuzzle(text, ai_config);
2265
- return (0, import_koishi12.h)("at", { id: userId }) + " " + checkResp(resp);
2266
+ try {
2267
+ is_thinking = true;
2268
+ if (text.includes("reroll")) {
2269
+ const resp2 = await rerollSituationPuzzle(ai_config);
2270
+ return checkResp(resp2);
2271
+ }
2272
+ const resp = await questSituationPuzzle(text, ai_config);
2273
+ return (0, import_koishi12.h)("at", { id: userId }) + " " + checkResp(resp);
2274
+ } finally {
2275
+ is_thinking = false;
2276
+ }
2266
2277
  });
2267
2278
  }
2268
2279
  __name(registerGameMiddleware, "registerGameMiddleware");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-cocoyyy-console",
3
3
  "description": "自用koishi插件,功能包含复读,记录黑历史,*人等",
4
- "version": "1.1.0-beta.7",
4
+ "version": "1.1.0-beta.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [
package/readme.md CHANGED
@@ -2,4 +2,16 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/koishi-plugin-cocoyyy-console?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-cocoyyy-console)
4
4
 
5
- for self using, function console
5
+ 个人使用,集成多个功能
6
+
7
+ ## 主要功能
8
+
9
+ 所有命令都需要@bot后使用,@bot help可看到具体功能和指令。
10
+
11
+ ### 复读
12
+
13
+ 群内有大于n条消息重复时,bot会自动复读,已判断个人发言的独立和超时重置判断
14
+
15
+ ### 标签
16
+
17
+ 通过指令添加标签,标签和黑历史图片信息存放在数据库,具体需要设置内配置。在使用获取命令时可以从已有黑历史随机抽取并返回。