feat(lark-msg): 优化Action消息功能
All checks were successful
/ release (push) Successful in 27s

This commit is contained in:
zhaoyingbo 2024-09-26 01:34:13 +00:00
parent 10d3ef32cb
commit 03c8796c49

View File

@ -23,8 +23,8 @@ export const getMsgType = (body: LarkEvent.Data) => {
* @param body
* @returns Id
*/
export const getChatId = (body: LarkEvent.Data) => {
return body?.event?.message?.chat_id
export const getChatId = (body: LarkEvent.Data & LarkAction.Data) => {
return body?.event?.message?.chat_id || body?.open_chat_id
}
/**
@ -36,24 +36,6 @@ export const getUserId = (body: LarkEvent.Data) => {
return body?.event?.sender?.sender_id?.user_id
}
/**
* Action消息
* @param body Action消息体
* @returns Action消息
*/
export const getIsActionMsg = (body: LarkAction.Data) => {
return !!body?.action
}
/**
* Action类型
* @param body Action消息体
* @returns Action类型
*/
export const getActionType = (body: LarkAction.Data) => {
return body?.action?.tag
}
/**
*
* @param body
@ -88,4 +70,40 @@ export const getMentions = (body: LarkEvent.Data) => {
return body?.event?.message?.mentions
}
/**
* Action消息
* @param body Action消息体
* @returns Action消息
*/
export const getIsActionMsg = (body: LarkAction.Data) => {
return !!body?.action
}
/**
* Action类型
* @param body Action消息体
* @returns Action类型
*/
export const getActionType = (body: LarkAction.Data) => {
return body?.action?.tag
}
/**
* Action参数
* @param body Action消息体
* @returns Action参数
*/
export const getActionValue = (body: LarkAction.Data) => {
return body?.action?.value
}
/**
* Action选项
* @param body Action消息体
* @returns Action选项
*/
export const getActionOption = (body: LarkAction.Data) => {
return body?.action?.option
}
export { LarkAction, LarkEvent }