feat: 添加游戏结束指令处理逻辑;优化事件管理中的游戏控制流程

This commit is contained in:
zhaoyingbo 2025-01-25 11:00:25 +00:00
parent 8dc474df92
commit 10d37e5f73
2 changed files with 6 additions and 6 deletions

View File

@ -176,11 +176,15 @@ const chat2Soup = async (ctx: Context) => {
*/
const agent = async (ctx: Context) => {
const {
larkBody: { chatId },
larkBody: { chatId, msgText },
} = ctx
if (!chatId) return
const activeGame = await db.soupGame.getActiveOneByChatId(chatId)
if (!activeGame) return false
if (msgText === "结束游戏" || msgText === "停止游戏") {
startOrStopGame(ctx, false)
return true
}
chat2Soup(ctx)
return true
}

View File

@ -149,12 +149,8 @@ const manageIntent = async (ctx: Context) => {
case 11:
soupAgent.startOrStopGame(ctx, true, "manual")
break
// 结束海龟汤游戏
case 12:
soupAgent.startOrStopGame(ctx, false, "manual")
break
// 通识回答
case 13:
case 12:
default:
groupAgent.agent(ctx)
break