koishi-plugin-cocoyyy-console 1.1.0-beta.6 → 1.1.0-beta.7
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 +18 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2105,6 +2105,7 @@ async function startSituationPuzzle(config) {
|
|
|
2105
2105
|
chatHistory2 = [];
|
|
2106
2106
|
gameTimeout = null;
|
|
2107
2107
|
}, GAME_TIMEOUT_MINUTES * 60 * 1e3);
|
|
2108
|
+
logger.info("[startSituationPuzzle Info]: ai api send message success");
|
|
2108
2109
|
return resp;
|
|
2109
2110
|
}
|
|
2110
2111
|
__name(startSituationPuzzle, "startSituationPuzzle");
|
|
@@ -2123,6 +2124,7 @@ async function questSituationPuzzle(content, config) {
|
|
|
2123
2124
|
logger.error("[questSituationPuzzle Error]: " + err);
|
|
2124
2125
|
return null;
|
|
2125
2126
|
}
|
|
2127
|
+
logger.info("[questSituationPuzzle Info]: ai api send message success");
|
|
2126
2128
|
if (resp.includes("猜中了")) {
|
|
2127
2129
|
is_gaming = false;
|
|
2128
2130
|
chatPrompt = [];
|
|
@@ -2141,6 +2143,7 @@ async function endSituationPuzzle(config) {
|
|
|
2141
2143
|
logger.error("[endSituationPuzzle Error]: " + err);
|
|
2142
2144
|
return null;
|
|
2143
2145
|
}
|
|
2146
|
+
logger.info("[endSituationPuzzle Info]: ai api send message success");
|
|
2144
2147
|
return resp;
|
|
2145
2148
|
}
|
|
2146
2149
|
__name(endSituationPuzzle, "endSituationPuzzle");
|
|
@@ -2158,6 +2161,7 @@ async function rerollSituationPuzzle(config) {
|
|
|
2158
2161
|
chatPrompt.push({ role: "system", content: [{ type: "text", text: prompt_start }] });
|
|
2159
2162
|
chatPrompt.push({ role: "assistant", content: [{ type: "text", text: resp }] });
|
|
2160
2163
|
is_gaming = true;
|
|
2164
|
+
logger.info("[rerollSituationPuzzle Info]: ai api send message success");
|
|
2161
2165
|
return resp;
|
|
2162
2166
|
}
|
|
2163
2167
|
__name(rerollSituationPuzzle, "rerollSituationPuzzle");
|
|
@@ -2199,17 +2203,22 @@ function registerGameCommands(ctx, game_config, ai_config) {
|
|
|
2199
2203
|
if (!dev_mode) {
|
|
2200
2204
|
if (!is_at_bot(session)) return;
|
|
2201
2205
|
}
|
|
2202
|
-
if (is_gaming)
|
|
2203
|
-
|
|
2206
|
+
if (is_gaming) return "游戏正在进行中,请先结束游戏";
|
|
2207
|
+
if (is_thinking) return "正在思考,请耐心等待...";
|
|
2204
2208
|
const game = args?.[0];
|
|
2205
2209
|
if (!game) return "请提供正确格式,如:@bot startgame [游戏]";
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2210
|
+
try {
|
|
2211
|
+
is_thinking = true;
|
|
2212
|
+
switch (game) {
|
|
2213
|
+
case gameList[0].command:
|
|
2214
|
+
await session.send("正在开始游戏...后续问答请参照格式:@bot [问题]");
|
|
2215
|
+
const resp = await startSituationPuzzle(ai_config);
|
|
2216
|
+
return checkResp(resp);
|
|
2217
|
+
default:
|
|
2218
|
+
return `游戏不存在,请输入gamelist查看所有游戏`;
|
|
2219
|
+
}
|
|
2220
|
+
} finally {
|
|
2221
|
+
is_thinking = false;
|
|
2213
2222
|
}
|
|
2214
2223
|
});
|
|
2215
2224
|
ctx.command("endgame", "结束游戏").action(async ({ session }) => {
|