feat: 添加游戏结束指令处理逻辑;优化事件管理中的游戏控制流程
This commit is contained in:
parent
8dc474df92
commit
10d37e5f73
@ -176,11 +176,15 @@ const chat2Soup = async (ctx: Context) => {
|
|||||||
*/
|
*/
|
||||||
const agent = async (ctx: Context) => {
|
const agent = async (ctx: Context) => {
|
||||||
const {
|
const {
|
||||||
larkBody: { chatId },
|
larkBody: { chatId, msgText },
|
||||||
} = ctx
|
} = ctx
|
||||||
if (!chatId) return
|
if (!chatId) return
|
||||||
const activeGame = await db.soupGame.getActiveOneByChatId(chatId)
|
const activeGame = await db.soupGame.getActiveOneByChatId(chatId)
|
||||||
if (!activeGame) return false
|
if (!activeGame) return false
|
||||||
|
if (msgText === "结束游戏" || msgText === "停止游戏") {
|
||||||
|
startOrStopGame(ctx, false)
|
||||||
|
return true
|
||||||
|
}
|
||||||
chat2Soup(ctx)
|
chat2Soup(ctx)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -149,12 +149,8 @@ const manageIntent = async (ctx: Context) => {
|
|||||||
case 11:
|
case 11:
|
||||||
soupAgent.startOrStopGame(ctx, true, "manual")
|
soupAgent.startOrStopGame(ctx, true, "manual")
|
||||||
break
|
break
|
||||||
// 结束海龟汤游戏
|
|
||||||
case 12:
|
|
||||||
soupAgent.startOrStopGame(ctx, false, "manual")
|
|
||||||
break
|
|
||||||
// 通识回答
|
// 通识回答
|
||||||
case 13:
|
case 12:
|
||||||
default:
|
default:
|
||||||
groupAgent.agent(ctx)
|
groupAgent.agent(ctx)
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user