feat(group-agent): 修复Action消息返回
All checks were successful
Egg Server MIflow / build-image (push) Successful in 47s

This commit is contained in:
zhaoyingbo 2024-09-27 12:20:49 +00:00
parent 6cbc509f96
commit 757b0af2be
2 changed files with 7 additions and 8 deletions

View File

@ -10,11 +10,11 @@ const ACTION_MAP = {
}
/**
*
*
* @param {Context.Data} ctx - body, larkService和logger
* @returns {Promise<void>}
*/
const manageBtnClick = async (ctx: Context.Data): Promise<void> => {
const manageClick = async (ctx: Context.Data): Promise<void> => {
const { body, logger } = ctx
const { action } = body?.action?.value as {
action: keyof typeof ACTION_MAP
@ -30,9 +30,8 @@ const manageBtnClick = async (ctx: Context.Data): Promise<void> => {
* Action消息
* @param {Context.Data} ctx -
*/
export const manageActionMsg = async (ctx: Context.Data) => {
export const manageActionMsg = (ctx: Context.Data) => {
const actionType = getActionType(ctx.body)
if (actionType === "button") manageBtnClick(ctx)
if (actionType === "select_static") manageBtnClick(ctx)
return ctx.genResp.empty200()
if (actionType === "button") manageClick(ctx)
if (actionType === "select_static") manageClick(ctx)
}

View File

@ -26,8 +26,8 @@ export const manageBotReq = async (ctx: Context.Data): Promise<Response> => {
// 处理Event消息
if (getIsEventMsg(body)) manageEventMsg(ctx)
// 处理Action消息
if (getIsActionMsg(body)) return await manageActionMsg(ctx)
if (getIsActionMsg(body)) manageActionMsg(ctx)
// 返回成功响应
return ctx.genResp.ok()
return ctx.genResp.empty200()
}