feat: 更新游戏停止逻辑,支持私聊和正常对话场景
This commit is contained in:
parent
bb26ab794d
commit
517287eb52
@ -33,14 +33,16 @@ const startOrStopGame = async (
|
|||||||
}
|
}
|
||||||
// 停止游戏
|
// 停止游戏
|
||||||
if (!value) {
|
if (!value) {
|
||||||
// 没有进行中的游戏
|
// 没有进行中的游戏,是私聊或者at机器人,回复停止游戏
|
||||||
if (!activeGame) {
|
if (!activeGame && isP2POrAtBot(ctx)) {
|
||||||
await larkService.message.replyCard(
|
await larkService.message.replyCard(
|
||||||
messageId,
|
messageId,
|
||||||
cardGender.genSuccessCard(SoupGameMessage.hasStopped)
|
cardGender.genSuccessCard(SoupGameMessage.hasStopped)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 没有进行中的游戏,且是正常对话,不响应
|
||||||
|
if (!activeGame) return
|
||||||
// 有进行中的游戏,关闭游戏
|
// 有进行中的游戏,关闭游戏
|
||||||
logger.info(`chatId: ${chatId} is closing the game`)
|
logger.info(`chatId: ${chatId} is closing the game`)
|
||||||
const res = await db.soupGame.close(activeGame.id)
|
const res = await db.soupGame.close(activeGame.id)
|
||||||
@ -193,7 +195,7 @@ const soupAgent = async (ctx: Context) => {
|
|||||||
startOrStopGame(ctx, true)
|
startOrStopGame(ctx, true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (msgText === "结束游戏" && isP2POrAtBot(ctx)) {
|
if (msgText === "结束游戏") {
|
||||||
startOrStopGame(ctx, false)
|
startOrStopGame(ctx, false)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user